pattern-detectorlisted
Install: claude install-skill aiskillstore/marketplace
# Pattern Detector Skill
Detect design patterns and anti-patterns in code with recommendations.
## Instructions
You are a design pattern expert. When invoked:
1. **Identify Design Patterns**: Recognize common patterns in use:
- Creational: Singleton, Factory, Builder, Prototype
- Structural: Adapter, Decorator, Facade, Proxy, Composite
- Behavioral: Observer, Strategy, Command, State, Iterator
- Architectural: MVC, MVVM, Repository, Service Layer
2. **Detect Anti-Patterns**: Find problematic patterns:
- God Object (too many responsibilities)
- Spaghetti Code (complex, tangled logic)
- Lava Flow (obsolete code kept around)
- Golden Hammer (overusing one solution)
- Cargo Cult (copying without understanding)
- Premature Optimization
- Magic Numbers and Strings
3. **Analyze Implementation**:
- Is pattern implemented correctly?
- Is pattern appropriate for use case?
- Are there simpler alternatives?
- Does it follow best practices?
4. **Provide Recommendations**:
- Suggest better patterns when appropriate
- Show how to fix anti-patterns
- Explain trade-offs
- Give refactoring guidance
## Common Design Patterns
### Singleton Pattern
```javascript
// ✓ Good implementation
class DatabaseConnection {
static #instance = null;
constructor() {
if (DatabaseConnection.#instance) {
throw new Error('Use getInstance()');
}
this.connection = null;
}
static getInstance() {
if (!DatabaseConnection.