analyzing-patterns
Automatically activated when user asks to "find patterns in...", "identify repeated code...", "analyze the architecture...", "what design patterns are used...", or needs to understand code organization, recurring structures, or architectural decisions
What this skill does
# Analyzing Patterns
You are an expert in recognizing software design patterns, architectural patterns, and code organization strategies. This skill provides systematic pattern analysis to identify recurring structures, conventions, and design decisions in codebases.
## Your Capabilities
1. **Design Pattern Recognition**: Identify Gang of Four and modern design patterns
2. **Architectural Pattern Analysis**: Recognize system-level patterns and structures
3. **Code Pattern Detection**: Find repeated code structures and conventions
4. **Convention Extraction**: Document naming, organization, and style patterns
5. **Anti-Pattern Identification**: Spot problematic patterns and suggest improvements
## When to Use This Skill
Claude should automatically invoke this skill when:
- User asks "what patterns are used in this code?"
- Questions about "find repeated/duplicated code"
- Requests to "analyze the architecture"
- Asking about "design patterns in this codebase"
- Understanding code organization strategies
- Identifying naming conventions
- Recognizing structural similarities
- Refactoring opportunities
- Code review focusing on patterns
## Pattern Analysis Methodology
### Phase 1: Pattern Discovery
```
1. Scan for structural patterns
- File/directory organization
- Naming conventions
- Import/export patterns
2. Identify design patterns
- Creational (Factory, Singleton, Builder)
- Structural (Adapter, Decorator, Facade)
- Behavioral (Observer, Strategy, Command)
3. Recognize architectural patterns
- MVC, MVVM, MVP
- Layered architecture
- Microservices
- Event-driven
- Repository pattern
```
### Phase 2: Pattern Analysis
```
1. Document each pattern
- Pattern name and type
- Where it's used (files, line numbers)
- Why it's used (intent)
- How it's implemented
2. Evaluate implementation
- Correctly implemented?
- Consistent usage?
- Appropriate for use case?
3. Note variations
- Different implementations
- Adaptations to context
- Deviations from standard
```
### Phase 3: Synthesis & Reporting
```
1. Categorize findings
- Group by pattern type
- Organize by layer/component
- Prioritize by importance
2. Identify meta-patterns
- Overall architectural style
- Dominant paradigm (OOP, FP, etc.)
- Consistency level
3. Provide insights
- What patterns work well
- Where patterns are missing
- Refactoring opportunities
- Consistency improvements
```
## Pattern Categories
### Design Patterns (Gang of Four)
#### Creational Patterns
```
Factory Pattern
- Purpose: Object creation without specifying exact class
- Signs: factory(), create(), build() methods
- Files: factories/, creators/
Singleton Pattern
- Purpose: Single instance globally
- Signs: getInstance(), static instance, private constructor
- Files: config/, services/
Builder Pattern
- Purpose: Complex object construction step-by-step
- Signs: builder(), withX() chaining methods
- Files: builders/, constructors/
Prototype Pattern
- Purpose: Clone existing objects
- Signs: clone(), copy() methods
- Files: prototypes/, templates/
Abstract Factory Pattern
- Purpose: Families of related objects
- Signs: Multiple factory methods, product families
- Files: factories/abstract/
```
#### Structural Patterns
```
Adapter Pattern
- Purpose: Interface compatibility
- Signs: adapter classes, interface conversion
- Files: adapters/, wrappers/
Decorator Pattern
- Purpose: Add behavior without modifying
- Signs: Wrapper classes, enhanced functionality
- Files: decorators/, wrappers/
Facade Pattern
- Purpose: Simplified interface to complex system
- Signs: High-level API hiding complexity
- Files: facades/, api/
Proxy Pattern
- Purpose: Placeholder/surrogate for another object
- Signs: Proxy classes, lazy initialization
- Files: proxies/, surrogates/
Composite Pattern
- Purpose: Tree structures, part-whole hierarchies
- Signs: Recursive structures, children/parent relationships
- Files: composites/, tree/
```
#### Behavioral Patterns
```
Observer Pattern
- Purpose: Notify multiple objects of state changes
- Signs: subscribe(), notify(), event emitters
- Files: observers/, events/, pubsub/
Strategy Pattern
- Purpose: Interchangeable algorithms
- Signs: Strategy interfaces, algorithm selection
- Files: strategies/, algorithms/
Command Pattern
- Purpose: Encapsulate requests as objects
- Signs: Command classes, execute() methods, undo/redo
- Files: commands/, actions/
State Pattern
- Purpose: Behavior changes based on state
- Signs: State classes, transition methods
- Files: states/, state-machine/
Template Method Pattern
- Purpose: Algorithm skeleton with customizable steps
- Signs: Abstract base class with template method
- Files: templates/, base-classes/
Iterator Pattern
- Purpose: Sequential access to elements
- Signs: next(), hasNext(), iterators
- Files: iterators/, collections/
Chain of Responsibility
- Purpose: Pass request along chain of handlers
- Signs: Handler chains, next() delegation
- Files: handlers/, middleware/
```
### Architectural Patterns
```
MVC (Model-View-Controller)
- Structure: models/, views/, controllers/
- Signs: Separation of data, UI, logic
MVVM (Model-View-ViewModel)
- Structure: models/, views/, viewmodels/
- Signs: Data binding, reactive updates
Repository Pattern
- Structure: repositories/, models/
- Signs: Data access abstraction
Service Layer Pattern
- Structure: services/, domain/
- Signs: Business logic encapsulation
Layered Architecture
- Structure: presentation/, business/, data/, infrastructure/
- Signs: Clear layer boundaries
Microservices Architecture
- Structure: Multiple services, each deployable
- Signs: Service boundaries, APIs, event buses
Event-Driven Architecture
- Structure: events/, handlers/, publishers/
- Signs: Publish/subscribe, event handlers
Hexagonal Architecture (Ports & Adapters)
- Structure: core/, ports/, adapters/
- Signs: Core domain isolated from external concerns
```
### Code-Level Patterns
```
Naming Conventions
- camelCase, PascalCase, snake_case, kebab-case
- Prefixes: is/has/get/set/handle/on
- Suffixes: -er, -or, -able, -Service, -Controller
File Organization Patterns
- Feature-based (by domain)
- Layer-based (by type)
- Atomic design (atoms, molecules, organisms)
- Flat vs. nested structures
Module Patterns
- CommonJS: module.exports, require()
- ES Modules: export, import
- Barrel exports: index.js re-exports
- Namespace patterns
Error Handling Patterns
- Try-catch blocks
- Error boundaries (React)
- Result types (Ok/Err)
- Exception hierarchies
Async Patterns
- Callbacks
- Promises
- Async/await
- Observables/Streams
```
## Analysis Strategies
### Finding Design Patterns
```bash
# Factory Pattern
grep -r "factory\|create.*Function\|build.*Function" --include="*.ts"
# Singleton Pattern
grep -r "getInstance\|static.*instance" --include="*.js"
# Observer Pattern
grep -r "subscribe\|addEventListener\|on\(" --include="*.ts"
# Strategy Pattern
grep -r "interface.*Strategy\|class.*Strategy" --include="*.ts"
# Decorator Pattern
grep -r "@.*decorator\|class.*Decorator" --include="*.ts"
```
### Finding Architectural Patterns
```bash
# MVC/MVVM structure
ls -la | grep -E "models|views|controllers|viewmodels"
# Repository pattern
grep -r "Repository" --include="*.ts"
find . -type d -name "*repository*"
# Service layer
find . -type d -name "*service*"
grep -r "class.*Service" --include="*.ts"
# Layered architecture
ls -la | grep -E "presentation|business|data|infrastructure"
```
### Finding Code Patterns
```bash
# Naming patterns
grep -r "^export (function|class|const)" --include="*.ts" | head -50
# Import patterns
grep -r "^import" --include="*.ts" | sort | uniq -c | sort -rn
# Repeated code blocks
# (Manual analysis of similar structures)
```
## Resources Available
### Scripts
Located in `{baseDir}/scripts/`:
- **pattern-detector.py**: Automated pattern recognition in code
- **duplicate-finder.sh**: Find duplRelated in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.