Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add aj-geddes/useful-ai-prompts --skill design-patterns-implementation -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/design-patterns-implementation/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/design-patterns-implementation/

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

Similar skills

All skills for Code review and refactoring →

From the same set143

performance-testing A skill that walks your agent through designing load tests and benchmarks: response times, throughput, resource use. CX Codex +1 603installs competitor-analysis A skill that walks the agent through competitor research: direct and indirect players, a comparison matrix, SWOT, and a findings report. Useful before pricing or positioning calls. CX Codex +1 603installs security-testing Flags security flaws in code and dependencies, tests against OWASP Top 10 risks, and guides DAST scanning via OWASP ZAP. CX Codex +1 601installs frontend-accessibility This skill adds WCAG guidelines to your coding workflow. It instructs agents to write semantic HTML, configure ARIA attributes, and support keyboard navigation. CX Codex +1 599installs unit-testing-framework A skill that gives the agent rules for writing unit tests: Arrange-Act-Assert structure, mocks, edge cases. Useful when a function or class needs coverage. CX Codex +1 593installs database-schema-design Designs relational database schemas with normalization, constraints, and table relationships. Built for modeling data in PostgreSQL and MySQL. CX Codex +1 591installs Data Cleaning Pipeline Generates structured Python data preprocessing routines to clean missing values, strip invalid text, handle outliers, and validate data quality. CX Codex +1 589installs database-query-optimization A skill that walks your agent through slow SQL: execution plans, indexes, and where the time actually goes. Useful when the database drags. CX Codex +1 586installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor