Install any skill in seconds. Free to start, no credit card required.
Get Started Free →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
.claude/skills/aiskillstore-analyzing-patterns/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-09 | ✗→✓ | ▲ Improved | 428% | 0% |
| case-23 | ✗→✓ | ▲ Improved | 73% | 0% |
| case-05 | ✓→✗ | ▼ Worse | 116% | 0% |
| case-07 | ✓→✗ | ▼ Worse | 62% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 106% | 0% |
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.
Claude should automatically invoke this skill when:
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 pattern1. 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 standard1. 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 improvementsFactory 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/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/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/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 concernsNaming 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/Streamsbash# 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"
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"
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)
Located in {baseDir}/scripts/:
Usage example:
bashpython {baseDir}/scripts/pattern-detector.py --directory ./src bash {baseDir}/scripts/duplicate-finder.sh ./src python {baseDir}/scripts/convention-analyzer.py --path ./src
Located in {baseDir}/references/:
Located in {baseDir}/assets/:
When analyzing for design patterns:
bash grep -r "factory\|singleton\|builder\|observer" --include="*.ts" find . -type d -name "*factory*" -o -name "*builder*" -o -name "*observer*"
markdown ## Design Patterns Found
### Factory Pattern
src/factories/userFactory.ts:10-35### Observer Pattern
src/events/eventEmitter.ts:15-88### Singleton Pattern
src/services/apiClient.ts:5-20When searching for code duplication:
bash # Find similar file names (might indicate duplication) find . -name ".ts" | sort
# Find similar function signatures grep -r "function.User" --include=".ts"
markdown ## Code Duplication Analysis
### High Similarity (Consider Refactoring)
#### User Validation Logic
src/auth/validate.ts:15-35src/api/users/validate.ts:22-42src/forms/userForm.ts:88-108src/utils/userValidation.ts#### Data Fetching Pattern
useFetch()When examining overall architecture:
bash tree -L 3 -d src/
src/ ├── api/ # API layer (external communication) ├── components/ # Presentation layer (UI) ├── services/ # Business logic layer ├── models/ # Data models ├── utils/ # Utilities (cross-cutting) └── store/ # State management
markdown ## Architecture Analysis
### Overall Pattern Layered Architecture with clear separation of concerns
### Layers
components/)services/)api/)store/)### Data Flow Component → Service → API → Service → Store → Component
### Strengths
### Considerations
Signs:
- One class/object does too much
- Thousands of lines
- Many responsibilities
- Hard to maintain
Example:
class ApplicationManager {
// Handles auth, routing, data, UI, everything
}Signs:
- No clear structure
- Tangled dependencies
- Hard to follow flow
- Minimal abstraction
Example:
- Everything in one file
- No functions/modules
- Global variables everywhereSigns:
- Duplicated code blocks
- Similar functions with slight variations
- No shared abstractions
Solution: Extract to shared functions/modulesSigns:
- Hard-coded values without explanation
- Unclear constants
- No named constants
Example:
if (status === 3) { /* what is 3? */ }
Solution: const STATUS_ACTIVE = 3;Signs:
- Direct dependencies everywhere
- Hard to test in isolation
- Changes ripple through system
Solution: Dependency injection, interfacesmarkdown## Pattern Analysis Report ### Overview [Brief summary of architectural style and dominant patterns] ### Design Patterns Found #### [Pattern Name] - **Type**: Creational/Structural/Behavioral - **Location**: `file/path.ts:lines` - **Purpose**: [Why this pattern exists] - **Implementation**: [How it's implemented] - **Quality**: ✓ Well-implemented / ⚠ Needs improvement - **Notes**: [Additional observations] ### Architectural Patterns #### Overall Architecture - **Pattern**: [Architecture type] - **Structure**: [Directory/layer organization] - **Data Flow**: [How data moves through system] - **Strengths**: [What works well] - **Weaknesses**: [What could improve] ### Code-Level Patterns #### Naming Conventions - **Functions**: [camelCase, verb-first, etc.] - **Classes**: [PascalCase, noun-based, etc.] - **Files**: [kebab-case, PascalCase, etc.] - **Consistency**: ✓ High / ⚠ Medium / ✗ Low #### File Organization - **Strategy**: [Feature-based, type-based, etc.] - **Structure**: [Flat, nested, hybrid] - **Consistency**: [Assessment] ### Repeated Patterns #### [Pattern Description] - **Occurrences**: [Number of times, locations] - **Variation**: [How consistent is usage] - **Assessment**: [Good repetition or duplication?] - **Action**: [Extract, refactor, or leave as-is] ### Anti-Patterns Detected #### [Anti-Pattern Name] - **Location**: `file/path.ts` - **Issue**: [What's problematic] - **Impact**: [How it affects code quality] - **Recommendation**: [How to fix] ### Recommendations 1. **[Priority]** [Recommendation] - Current: [Current state] - Proposed: [Desired state] - Benefit: [Why this helps] - Effort: [Low/Medium/High] ### Summary **Strengths**: - [What's done well] **Areas for Improvement**: - [What could be better] **Overall Assessment**: [Quality rating and summary]
Remember: Patterns are tools, not goals. Identify patterns to understand the codebase better and improve maintainability, not to force pattern application everywhere.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 16,563 | 17,467 | +5% | 1 | 1 | 0% | 370 | 4,332 | +1071% | 0 | 0 | — |
case-02 | pass→pass | 16,197 | 19,775 | +22% | 1 | 1 | 0% | 3,463 | 7,121 | +106% | 0 | 0 | — |
case-03 | fail→fail | 16,641 | 22,135 | +33% | 1 | 1 | 0% | 2,074 | 6,928 | +234% | 0 | 0 | — |
case-04 | fail→fail | 12,812 | 12,460 | -3% | 1 | 1 | 0% | 1,274 | 6,102 | +379% | 0 | 0 | — |
case-05 | pass→fail | 18,757 | 22,353 | +19% | 1 | 1 | 0% | 3,303 | 7,149 | +116% | 0 | 0 | — |
case-06 | pass→pass | 12,382 | 22,526 | +82% | 1 | 1 | 0% | 2,124 | 7,127 | +236% | 0 | 0 | — |
case-07 | pass→fail | 21,488 | 17,043 | -21% | 1 | 1 | 0% | 2,724 | 4,401 | +62% | 0 | 0 | — |
case-08 | pass→pass | 6,878 | 12,875 | +87% | 1 | 1 | 0% | 1,257 | 5,398 | +329% | 0 | 0 | — |
case-09 | fail→pass | 13,522 | 30,831 | +128% | 1 | 1 | 0% | 1,360 | 7,187 | +428% | 0 | 0 | — |
case-10 | fail→fail | 16,955 | 18,529 | +9% | 1 | 1 | 0% | 3,283 | 7,838 | +139% | 0 | 0 | — |
case-11 | pass→pass | 15,507 | 20,406 | +32% | 1 | 1 | 0% | 2,721 | 7,918 | +191% | 0 | 0 | — |
case-12 | pass→pass | 17,861 | 17,942 | +0% | 1 | 1 | 0% | 2,356 | 6,532 | +177% | 0 | 0 | — |
case-13 | pass→pass | 18,390 | 22,442 | +22% | 1 | 1 | 0% | 2,717 | 6,951 | +156% | 0 | 0 | — |
case-14 | fail→fail | 4,659 | 14,857 | +219% | 1 | 1 | 0% | 760 | 6,591 | +767% | 0 | 0 | — |
case-19 | pass→pass | 26,836 | 27,217 | +1% | 1 | 1 | 0% | 3,577 | 8,731 | +144% | 0 | 0 | — |
case-15 | pass→pass | 13,068 | 16,448 | +26% | 1 | 1 | 0% | 2,023 | 5,937 | +193% | 0 | 0 | — |
case-16 | pass→pass | 17,648 | 10,166 | -42% | 1 | 1 | 0% | 2,296 | 5,741 | +150% | 0 | 0 | — |
case-17 | pass→pass | 21,484 | 29,871 | +39% | 1 | 1 | 0% | 3,534 | 8,127 | +130% | 0 | 0 | — |
case-18 | pass→pass | 6,478 | 11,785 | +82% | 1 | 1 | 0% | 1,057 | 5,130 | +385% | 0 | 0 | — |
case-20 | pass→pass | 20,699 | 44,443 | +115% | 1 | 1 | 0% | 3,210 | 10,352 | +222% | 0 | 0 | — |
case-21 | pass→pass | 17,224 | 11,899 | -31% | 1 | 1 | 0% | 2,074 | 6,073 | +193% | 0 | 0 | — |
case-22 | pass→pass | 20,559 | 20,370 | -1% | 1 | 1 | 0% | 2,732 | 6,858 | +151% | 0 | 0 | — |
case-23 | fail→pass | 21,321 | 8,088 | -62% | 1 | 1 | 0% | 2,612 | 4,521 | +73% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted, and 21 counted toward the lift figure. The other 2 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of 0 percentage points is the difference between those two pass rates over the 21 comparable cases. 2 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.