design-patterns-implementation — Claude Code skill: design patterns
Guides the agent toward the right pattern for an architectural problem: Singleton, Factory, Observer, Strategy and more. Useful during refactoring or code review.
npx skills add aj-geddes/useful-ai-prompts --skill design-patterns-implementation -a claude-codeWhat design-patterns-implementation does
The skill plugs into your agent and points it at a fitting pattern for the code in front of it. It ships a short TypeScript Singleton example plus a set of reference files under references/: Singleton, Factory, Observer, Strategy, Decorator, Repository and Dependency Injection. Each pattern gets its own file with the implementation.
Reach for it when tests are painful to write, components are tangled together, or you need an extensible plugin layer. The skill lists its own triggers: architectural problems surfacing in review, following SOLID, decoupling components.
The best-practices section also warns against the usual failure mode. Don't apply a pattern you don't understand, don't over-engineer a simple fix, don't force a pattern where it doesn't fit. Worth checking whether your team already knows the pattern before it lands in the codebase.
What it helps with
- pick a pattern for a specific architectural problem
- decouple tangled components before refactoring
- make code testable without a rewrite
- design an extensible plugin system
- work through architecture comments in code review
Example prompts for the agent
- suggest a pattern for this module and show the implementation
- refactor this class toward SOLID and explain the pattern choice
- how do I decouple these two components with Observer?
How to install design-patterns-implementation
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill design-patterns-implementation -a claude-code2Manually: put the files in place
~/.claude/skills/design-patterns-implementation/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/design-patterns-implementation/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill design-patterns-implementation -a codex2Manually: put the files in place
.agents/skills/design-patterns-implementation/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill design-patterns-implementation -a cursor2Manually: put the files in place
.cursor/skills/design-patterns-implementation/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install aj-geddes/useful-ai-prompts design-patterns-implementation2Manually: put the files in place
.github/skills/design-patterns-implementation/SKILL.md1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill design-patterns-implementation -a gemini-cli2Platform CLI
gemini skills install https://github.com/aj-geddes/useful-ai-prompts --path skills/design-patterns-implementationManually: put the files in place
.devin/skills/design-patterns-implementation/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill design-patterns-implementation -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about design-patterns-implementation
How do I install design-patterns-implementation in Claude?
Run npx skills add aj-geddes/useful-ai-prompts --skill design-patterns-implementation -a claude-code. The skill file lands at ~/.claude/skills/design-patterns-implementation/SKILL.md.
What does design-patterns-implementation do?
It steers the agent toward a suitable design pattern for your task and hands back a working implementation. It draws on reference guides for Singleton, Factory, Observer, Strategy, Decorator, Repository and Dependency Injection.
Which patterns are covered?
Seven reference guides live in the references/ directory: Singleton, Factory, Observer, Strategy, Decorator, Repository and Dependency Injection. The main file carries a short TypeScript Singleton example.
Source text
SKILL.md · MIT
---
name: design-patterns-implementation
description: >
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.
---
# Design Patterns Implementation
## Table of Contents
- [Overview](#overview)
- [When to Use](#when-to-use)
- [Quick Start](#quick-start)
- [Reference Guides](#reference-guides)
- [Best Practices](#best-practices)
## Overview
Apply proven design patterns to create maintainable, extensible, and testable code architectures.
## When to Use
- Solving common architectural problems
- Making code more maintainable and testable
- Implementing extensible plugin systems
- Decoupling components
- Following SOLID principles
- Code reviews identifying architectural issues
## Quick Start
Minimal working example:
```typescript
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)
```
## Reference Guides
Detailed implementations in the `references/` directory:
| Guide | Contents |
|---|---|
| [Singleton Pattern](references/singleton-pattern.md) | Singleton Pattern |
| [Factory Pattern](references/factory-pattern.md) | Factory Pattern |
| [Observer Pattern](references/observer-pattern.md) | Observer Pattern |
| [Strategy Pattern](references/strategy-pattern.md) | Strategy Pattern |
| [Decorator Pattern](references/decorator-pattern.md) | Decorator Pattern |
| [Repository Pattern](references/repository-pattern.md) | Repository Pattern |
| [Dependency Injection](references/dependency-injection.md) | Dependency Injection |
## Best Practices
### ✅ DO
- Choose patterns that solve actual problems
- Keep patterns simple and understandable
- Document why patterns were chosen
- Consider testability
- Follow SOLID principles
- Use dependency injection
- Prefer composition over inheritance
### ❌ DON'T
- Apply patterns without understanding them
- Over-engineer simple solutions
- Force patterns where they don't fit
- Create unnecessary abstraction layers
- Ignore team familiarity with patterns
© aj-geddes · MIT · aj-geddes/useful-ai-prompts