florianbruniaux/claude-code-ultimate-guide/design-patterns
Claude Code and agent skill by florianbruniaux/claude-code-ultimate-guide
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Detect, suggest, and evaluate GoF design patterns in TypeScript/JavaScript codebases. Use when refactoring code, applying singleton/factory/observer/strategy patterns, reviewing pattern quality, or finding stack-native alternatives for React, Angular, NestJS, and Vue.
Install
npx vskill@latest install florianbruniaux/claude-code-ultimate-guide/design-patternsSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as florianbruniaux/claude-code-ultimate-guide/design-patterns.
Design patterns analyzer skill
Purpose: Detect, suggest, and evaluate Gang of Four (GoF) design patterns in TypeScript/JavaScript codebases with stack-aware adaptations.
This skill runs in a forked, read-only-by-intent subagent (context: fork, agent: general-purpose) that starts without the conversation history, so the task and path must come from the arguments. The reference files named below live under ${CLAUDE_SKILL_DIR}: read them from there, not from the working directory.
Core capabilities
- Stack Detection: Identify primary framework/library (React, Angular, NestJS, Vue, Express, RxJS, Redux, ORMs)
- Pattern Detection: Find existing implementations of 23 GoF patterns
- Smart Suggestions: Recommend patterns to fix code smells, using stack-native idioms when available
- Quality Evaluation: Assess pattern implementation quality against best practices
Operating modes
Mode 1: Detection
Trigger: User requests pattern detection or analysis Output: JSON report of patterns found with confidence scores and stack context
Workflow:
Example invocation:
Mode 2: Suggestion
Trigger: User requests pattern suggestions or refactoring advice Output: Markdown report with prioritized suggestions and stack-adapted examples
Workflow:
Example invocation:
Mode 3: Evaluation
Trigger: User requests pattern quality assessment Output: JSON report with scores per evaluation criterion
Workflow:
Example invocation:
Methodology
Phase 1: Stack detection
Sources (in priority order):
package.json-> Check dependencies and devDependencies- Framework-specific files ->
angular.json,next.config.*,nest-cli.json,vite.config.* tsconfig.json-> Check compilerOptions, paths, lib- File extensions ->
*.jsx,*.tsx,*.vuepresence
Detection Rules (from signatures/stack-patterns.yaml):
- React:
reactin deps +*.jsx/*.tsxfiles - Angular:
@angular/core+angular.json - NestJS:
@nestjs/core+nest-cli.json - Vue:
vuev3+ +*.vuefiles - Express:
expressin deps +app.usepatterns - RxJS:
rxjsin deps + Observable usage - Redux/Zustand:
redux/zustandin deps + store patterns - Prisma/TypeORM:
prisma/typeormin deps + schema files
Output:
Phase 2: Pattern detection
Search Strategy:
- Glob Phase: Find candidate files by naming convention
*Singleton*.ts,*Factory*.ts,*Strategy*.ts,*Observer*.ts, etc.*Manager*.ts,*Builder*.ts,*Adapter*.ts,*Proxy*.ts, etc.
- Grep Phase: Search for pattern signatures (from
signatures/detection-rules.yaml)
- Primary signals:
private constructor,static getInstance(),subscribe(),createXxx(), etc. - Secondary signals: Interface naming, delegation patterns, method signatures
- Read Phase: Validate pattern structure
- Parse class/interface definitions
- Verify relationships (inheritance, composition, delegation)
- Check for complete pattern implementation vs partial usage
Confidence Scoring:
- 0.9-1.0: All primary + secondary signals present, structure matches exactly
- 0.7-0.89: All primary signals + some secondary, minor deviations
- 0.5-0.69: Primary signals present, missing secondary validation
- 0.3-0.49: Naming convention matches, weak structural evidence
- 0.0-0.29: Insufficient evidence, likely false positive
Classification:
native: Pattern implemented using stack-native features (React Context, Angular Services, NestJS Guards, etc.)custom: Manual TypeScript implementationlibrary: Third-party library providing pattern (RxJS Subject, Redux Store, etc.)
Phase 3: Code smell detection
Target Smells (from signatures/code-smells.yaml):
- Switch on Type -> Strategy/Factory pattern
- Long Parameter List (>4) -> Builder pattern
- Global State Access -> Singleton (or preferably DI)
- Duplicated Conditionals on State -> State pattern
- Scattered Notification Logic -> Observer pattern
- Complex Object Creation -> Factory/Abstract Factory
- Tight Coupling to Concrete Classes -> Adapter/Bridge
- Repetitive Interface Conversions -> Adapter pattern
- Deep Nesting for Feature Addition -> Decorator pattern
- Large Class with Many Responsibilities -> Facade pattern
Detection Heuristics:
- Grep for
switch (.*type),switch (.*kind),switch (.*mode) - Count function parameters:
function \w+\([^)]{60,}\)(approximation for >4 params) - Search for global access:
window\.,global\.,process\.env\.\w+(not in config files) - Find state conditionals:
if.*state.*===.*&&.*if.*state.*=== - Find notification patterns:
forEach.*notify,map.*\.emit\(
Phase 4: Stack-Aware suggestions
Adaptation Logic (from signatures/stack-patterns.yaml):
Example Adaptations:
| Pattern | Stack | Native Alternative | Recommendation | |
|---|---|---|---|---|
| Singleton | React | Context API + Provider | Use createContext() instead of getInstance() | |
| Observer | Angular | RxJS Subject/BehaviorSubject | Use built-in Observables, not custom implementation | |
| Decorator | NestJS | @Injectable() decorators + Interceptors | Use framework interceptors | |
| Strategy | Vue 3 | Composition API composables | Use ref() + composables instead of classes | |
| Chain of Responsibility | Express | Middleware (app.use()) | Use Express middleware chain | |
| Command | Redux | Action creators + reducers | Use Redux actions, not custom command objects |
Phase 5: Quality evaluation
Criteria (from checklists/pattern-evaluation.md):
- Correctness (0-10): Does it match the canonical pattern structure?
- Testability (0-10): Can dependencies be mocked/stubbed easily?
- Single Responsibility (0-10): Does it do one thing only?
- Open/Closed Principle (0-10): Extensible without modification?
- Documentation (0-10): Clear intent, descriptive naming?
Scoring Guidelines:
- 9-10: Exemplary, reference-quality implementation
- 7-8: Good, minor improvements possible
- 5-6: Acceptable, notable issues to address
- 3-4: Problematic, significant refactoring needed
- 0-2: Incorrect or severely flawed
Issue Detection:
- Hard-coded dependencies (Singleton with new inside getInstance)
- God classes (too many responsibilities)
- Leaky abstractions (exposing internal structure)
- Missing error handling
- Poor naming (Strategy1, Strategy2 instead of descriptive names)
Output formats
Detection mode (JSON)
Suggestion mode (markdown)
switch (paymentType) { case 'credit': // 20 lines of credit card logic break; case 'paypal': // 15 lines of PayPal logic break; case 'crypto': // 18 lines of crypto logic break; case 'bank': // 12 lines of bank transfer logic break; }
// Define strategy interface interface PaymentStrategy { process: (amount: number) => Promise<PaymentResult>; }
// Custom hooks as strategies const useCreditPayment = (): PaymentStrategy => ({ process: async (amount) => { / credit logic / } });
const usePaypalPayment = (): PaymentStrategy => ({ process: async (amount) => { / PayPal logic / } });
// Strategy selection hook const usePaymentStrategy = (type: PaymentType): PaymentStrategy => { const strategies = { credit: useCreditPayment(), paypal: usePaypalPayment(), crypto: useCryptoPayment(), bank: useBankPayment(), }; return strategies[type]; };
// Usage in component const PaymentForm = ({ type }: Props) => { const strategy = usePaymentStrategy(type); const handlePay = () => strategy.process(amount); // ... };
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingexamples/skills/design-patterns/SKILL.md
Popularity
- Repository stars
- 5,719
- Repository forks
- 749
- 7-day trend score
- 43
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/florianbruniaux/claude-code-ultimate-guide/design-patterns)