Apply appropriate design patterns (Singleton, Factory, Observer, Strategy, etc.) to solve architectural problems. Use when refactoring code architecture, implementing extensible systems, or following SOLID principles.
Apply proven design patterns to create maintainable, extensible, and testable code architectures.
Minimal working example:
class DatabaseConnection {
private static instance: DatabaseConnection;
private connection: any;
private constructor() {
this.connection = this.createConnection();
}
public static getInstance(): DatabaseConnection {
if (!DatabaseConnection.instance) {
DatabaseConnection.instance = new DatabaseConnection();
}
return DatabaseConnection.instance;
}
private createConnection() {
return {
/* connection logic */
};
}
}
// Usage
const db1 = DatabaseConnection.getInstance();
const db2 = DatabaseConnection.getInstance();
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents | |---|---| | Singleton Pattern | Singleton Pattern | | Factory Pattern | Factory Pattern | | Observer Pattern | Observer Pattern | | Strategy Pattern | Strategy Pattern | | Decorator Pattern | Decorator Pattern | | Repository Pattern | Repository Pattern | | Dependency Injection | Dependency Injection |
Copy a source-pinned command for your client. You run it yourself.
Destination: .claude/skills/design-patterns-implementation · pinned to the source commit
git clone https://github.com/aj-geddes/useful-ai-prompts.git
cd useful-ai-prompts
git checkout 3f5182cfd739fc113f4af5244a1cf342ad7f7911
mkdir -p ".claude/skills/design-patterns-implementation"
cp -r "skills/design-patterns-implementation" ".claude/skills/design-patterns-implementation"Review the source before running. This copies files into your project; it is not a one-click install and does not verify runtime safety.
Scanner static-checks@0.1.0 · commit 3f5182cfd739. Static checks cannot prove runtime safety – review the source and the exact diff before installing. How checks work.
No static rules matched. This is not a safety guarantee.