From plugin-frontend
Applies design patterns (Singleton, Factory, Observer, Strategy, etc.) to refactor code architecture, implement extensible systems, and follow SOLID principles.
npx claudepluginhub denissanthiago/plugin-frontend-claude-codeThis skill uses the workspace's default tool permissions.
- [Overview](#overview)
Applies design patterns (Singleton, Factory, Observer, Strategy, etc.) to refactor code architecture, implement extensible systems, and follow SOLID principles.
Consults design pattern catalog before implementing or refactoring code to check for matching patterns and follow established implementations.
Provides PHP 8.3+ implementations, UML guidance, real-world examples, trade-offs, and anti-patterns for 26 Gang of Four design patterns. Activates for applying patterns, refactoring code, selecting patterns, or reviewing usage.
Share bugs, ideas, or general feedback.
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 |