Agent skill

Design Patterns Implementation

by tmcfarlane in tmcfarlane/oh-my-cursor

Apply appropriate design patterns (Singleton, Factory, Observer, Strategy, etc.) to solve architectural problems.

MITAuto-check passedDevelopment

Install Design Patterns Implementation

skills CLI
$ npx skills add tmcfarlane/oh-my-cursor --skill design-patterns-implementation -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install tmcfarlane/oh-my-cursor design-patterns-implementation --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/tmcfarlane/oh-my-cursor.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/design-patterns-implementation .claude/skills/design-patterns-implementation && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
design-patterns-implementation
GitHub stars
109
Token cost
~2.2k tokens
SKILL.md length
244 words
Files
1
Skills in repo
14
Repo updated
First seen
Licence
MIT

At a glance

Apply appropriate design patterns (Singleton, Factory, Observer, Strategy, etc.) to solve architectural problems.

  • Works in 7 steps: Singleton Pattern → Factory Pattern → Observer Pattern → …
  • Refactoring code architecture
  • SKILL.md covers Overview, When to Use, Common Design Patterns and Best Practices, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Design Patterns Implementation is an agent skill from tmcfarlane/oh-my-cursor. 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.

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Design patterns. The repository describes itself as: Like “oh-my-opencode”, but for Cursor IDE. Multi-agent orchestration, natively, using nothing but a few config files. The licence is MIT.

When your agent uses it

  • Refactoring code architecture
  • Implementing extensible systems
  • Following SOLID principles

Example prompts

  • “/design-patterns-implementation”

Requirements

  • Python 3

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. Singleton Pattern
  2. Factory Pattern
  3. Observer Pattern
  4. Strategy Pattern
  5. Decorator Pattern
  6. Repository Pattern
  7. Dependency Injection

What it can do on your machine

Read from SKILL.md and the folder at commit 5bad458. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript, python, javascript and java).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Design Patterns Implementation loads about 2.2k tokens when it runs. Until then it costs about 62 tokens; SKILL.md has 244 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~62
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from tmcfarlane/oh-my-cursor at commit 5bad458, republished under its MIT licence (© tmcfarlane). 244 words, ~2,161 tokens.

Download SKILL.mdSave it as .claude/skills/design-patterns-implementation/SKILL.md (or your agent's skills folder).
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

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

Common Design Patterns

1. Singleton Pattern

Ensure a class has only one instance with global access.

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();
// db1 === db2 (same instance)
2. Factory Pattern

Create objects without specifying exact classes.

python
from abc import ABC, abstractmethod

class PaymentProcessor(ABC):
    @abstractmethod
    def process_payment(self, amount: float) -> bool:
        pass

class StripeProcessor(PaymentProcessor):
    def process_payment(self, amount: float) -> bool:
        # Stripe-specific logic
        return True

class PayPalProcessor(PaymentProcessor):
    def process_payment(self, amount: float) -> bool:
        # PayPal-specific logic
        return True

class PaymentProcessorFactory:
    @staticmethod
    def create_processor(processor_type: str) -> PaymentProcessor:
        if processor_type == 'stripe':
            return StripeProcessor()
        elif processor_type == 'paypal':
            return PayPalProcessor()
        else:
            raise ValueError(f'Unknown processor: {processor_type}')

# Usage
processor = PaymentProcessorFactory.create_processor('stripe')
processor.process_payment(100.00)
3. Observer Pattern

Define one-to-many dependency for event notification.

javascript
class Subject {
  constructor() {
    this.observers = [];
  }

  attach(observer) {
    this.observers.push(observer);
  }

  detach(observer) {
    this.observers = this.observers.filter(obs => obs !== observer);
  }

  notify(data) {
    this.observers.forEach(observer => observer.update(data));
  }
}

class Observer {
  update(data) {
    console.log('Received update:', data);
  }
}

// Usage
const subject = new Subject();
const observer1 = new Observer();
const observer2 = new Observer();

subject.attach(observer1);
subject.attach(observer2);
subject.notify({ event: 'data_changed' });
4. Strategy Pattern

Define family of algorithms and make them interchangeable.

java
interface CompressionStrategy {
    byte[] compress(byte[] data);
}

class ZipCompression implements CompressionStrategy {
    public byte[] compress(byte[] data) {
        // ZIP compression logic
        return data;
    }
}

class GzipCompression implements CompressionStrategy {
    public byte[] compress(byte[] data) {
        // GZIP compression logic
        return data;
    }
}

class FileCompressor {
    private CompressionStrategy strategy;

    public FileCompressor(CompressionStrategy strategy) {
        this.strategy = strategy;
    }

    public void setStrategy(CompressionStrategy strategy) {
        this.strategy = strategy;
    }

    public byte[] compressFile(byte[] data) {
        return strategy.compress(data);
    }
}

// Usage
FileCompressor compressor = new FileCompressor(new ZipCompression());
compressor.compressFile(fileData);

// Change strategy at runtime
compressor.setStrategy(new GzipCompression());
compressor.compressFile(fileData);
5. Decorator Pattern

Add responsibilities to objects dynamically.

typescript
interface Coffee {
  cost(): number;
  description(): string;
}

class SimpleCoffee implements Coffee {
  cost(): number {
    return 5;
  }

  description(): string {
    return 'Simple coffee';
  }
}

class MilkDecorator implements Coffee {
  constructor(private coffee: Coffee) {}

  cost(): number {
    return this.coffee.cost() + 2;
  }

  description(): string {
    return this.coffee.description() + ', milk';
  }
}

class SugarDecorator implements Coffee {
  constructor(private coffee: Coffee) {}

  cost(): number {
    return this.coffee.cost() + 1;
  }

  description(): string {
    return this.coffee.description() + ', sugar';
  }
}

// Usage
let coffee: Coffee = new SimpleCoffee();
console.log(coffee.cost()); // 5

coffee = new MilkDecorator(coffee);
console.log(coffee.cost()); // 7

coffee = new SugarDecorator(coffee);
console.log(coffee.cost()); // 8
console.log(coffee.description()); // "Simple coffee, milk, sugar"
6. Repository Pattern

Abstract data access logic.

python
from abc import ABC, abstractmethod
from typing import List, Optional

class UserRepository(ABC):
    @abstractmethod
    def find_by_id(self, user_id: int) -> Optional[User]:
        pass

    @abstractmethod
    def find_all(self) -> List[User]:
        pass

    @abstractmethod
    def save(self, user: User) -> User:
        pass

    @abstractmethod
    def delete(self, user_id: int) -> bool:
        pass

class DatabaseUserRepository(UserRepository):
    def __init__(self, db_connection):
        self.db = db_connection

    def find_by_id(self, user_id: int) -> Optional[User]:
        result = self.db.query('SELECT * FROM users WHERE id = ?', user_id)
        return User.from_dict(result) if result else None

    def find_all(self) -> List[User]:
        results = self.db.query('SELECT * FROM users')
        return [User.from_dict(r) for r in results]

    def save(self, user: User) -> User:
        self.db.execute('INSERT INTO users (...) VALUES (...)', user.to_dict())
        return user

    def delete(self, user_id: int) -> bool:
        return self.db.execute('DELETE FROM users WHERE id = ?', user_id)
7. Dependency Injection

Invert control by injecting dependencies.

typescript
// Bad: Hard-coded dependencies
class OrderService {
  private db = new MySQLDatabase(); // Tightly coupled
  private email = new GmailService(); // Tightly coupled

  createOrder(order: Order) {
    this.db.save(order);
    this.email.send(order.customer_email, 'Order created');
  }
}

// Good: Dependency injection
interface Database {
  save(entity: any): void;
}

interface EmailService {
  send(to: string, subject: string): void;
}

class OrderService {
  constructor(
    private db: Database,
    private email: EmailService
  ) {}

  createOrder(order: Order) {
    this.db.save(order);
    this.email.send(order.customer_email, 'Order created');
  }
}

// Usage - easy to test with mocks
const service = new OrderService(
  new MySQLDatabase(),
  new GmailService()
);

// Test with mocks
const testService = new OrderService(
  new MockDatabase(),
  new MockEmailService()
);

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

When to Use Each Pattern

PatternUse Case
SingletonDatabase connections, configuration managers
FactoryCreating objects based on runtime conditions
ObserverEvent systems, pub/sub, reactive programming
StrategyAlgorithms that can be swapped at runtime
DecoratorAdding features dynamically without inheritance
RepositoryAbstracting data access from business logic
AdapterMaking incompatible interfaces work together
FacadeSimplifying complex subsystems
CommandUndo/redo, task queuing, macro recording

Resources

  • "Design Patterns" by Gang of Four
  • "Head First Design Patterns" by Freeman & Freeman
  • refactoring.guru/design-patterns

© tmcfarlane, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/design-patterns-implementation of tmcfarlane/oh-my-cursor.

Open the folder on GitHubat commit 5bad458

Compare with similar skills

Design Patterns Implementation next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Design Patterns Implementation compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Design Patterns Implementation this skilltmcfarlane/oh-my-cursor109—~2.2kAutomated safety check: PassMIT
Swiftui View RefactorDimillian/Skills4k5 repos~2kAutomated safety check: PassMIT
RTK Rust Design Patternsrtk-ai/rtk83k—~1.9kAutomated safety check: PassApache-2.0
Effect Client WrapperUsefulSoftwareCo/executor4.1k1 repos~1.4kAutomated safety check: PassMIT
Architecture PatternsKartikLabhshetwar/better-shot2.4k2 repos~1.4kAutomated safety check: PassCustom licence
GitVersion .NET DevelopmentGitTools/GitVersion3.1k—~1.7kAutomated safety check: PassMIT

Similar skills

  • Swiftui View Refactor

    Dimillian/Skills

    Refactor and review SwiftUI view files with strong defaults for small dedicated subviews, MV-over-MVVM data flow, stable view trees, explicit dependency injection, and correct Observation usage.

    4k GitHub starsUsed in 5 repos~2k tokens
    DevelopmentAuto-check passed
  • Describes seven Rust design patterns for the RTK CLI filter modules, with when to use each, RTK examples, and notes on when a pattern is overkill.

    83k GitHub stars~1.9k tokensUpdated today
    DevelopmentAuto-check passed
  • Effect Client Wrapper

    UsefulSoftwareCo/executor

    Pattern for wrapping third-party SDK clients (Stripe, Resend, AWS, etc.) with Effect.

    4.1k GitHub starsUsed in 1 repo~1.4k tokens
    DevelopmentAuto-check passed
  • Architecture Patterns

    KartikLabhshetwar/better-shot

    Deep dive into software architecture for macOS. An agent skill from KartikLabhshetwar/better-shot.

    2.4k GitHub starsUsed in 2 repos~1.4k tokens
    DevelopmentAuto-check passed
  • GitVersion .NET Development

    GitTools/GitVersion

    Gives repository-specific .NET guidance for GitVersion: build and test commands, central package management, project layout and coding conventions.

    3.1k GitHub stars~1.7k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Official

    Replaces a plain TypeScript union plus switch statements with frozen subclasses and a visitor interface when several places dispatch on the same variants.

    48k GitHub stars~830 tokensUpdated yesterday
    DevelopmentAuto-check passed

More from tmcfarlane/oh-my-cursor

All 14 skills in this repo
  • Docs Write

    tmcfarlane/oh-my-cursor

    Write documentation following Metabase's conversational, clear, and user-focused style.

    109 GitHub starsUsed in 3 repos~716 tokens
    Auto-check: notes
  • Debugging

    tmcfarlane/oh-my-cursor

    Systematic 4-phase debugging with root cause investigation. An agent skill from tmcfarlane/oh-my-cursor.

    109 GitHub stars~4.4k tokensUpdated 3 mo ago
    Auto-check passed
  • Documentation Engineer

    tmcfarlane/oh-my-cursor

    Technical documentation expert for creating clear, comprehensive documentation.

    109 GitHub stars~881 tokensUpdated 3 mo ago
    Auto-check passed
  • Planning

    tmcfarlane/oh-my-cursor

    Technical implementation planning and architecture design. An agent skill from tmcfarlane/oh-my-cursor.

    109 GitHub stars~815 tokensUpdated 3 mo ago
    Auto-check passed
  • Codebase Search

    tmcfarlane/oh-my-cursor

    Search and navigate large codebases efficiently. An agent skill from tmcfarlane/oh-my-cursor.

    109 GitHub starsUsed in 1 repo~2.8k tokens
    Auto-check: notes
  • Cursor Image Generation

    tmcfarlane/oh-my-cursor

    Generate and iterate images in Cursor using the built-in image model and strong prompts.

    109 GitHub stars~1.8k tokensUpdated 3 mo ago
    Auto-check passed

Categories

Questions about Design Patterns Implementation

What does Design Patterns Implementation do?

Apply appropriate design patterns (Singleton, Factory, Observer, Strategy, etc.) to solve architectural problems. Design Patterns Implementation is an agent skill from tmcfarlane/oh-my-cursor.) to solve architectural problems.

When should I use Design Patterns Implementation?

Design Patterns Implementation fits situations like: refactoring code architecture; implementing extensible systems; following SOLID principles.

How do I install Design Patterns Implementation in Claude Code?

Run `npx skills add tmcfarlane/oh-my-cursor --skill design-patterns-implementation -a claude-code`. Or copy the skill folder (skills/design-patterns-implementation in tmcfarlane/oh-my-cursor) into .claude/skills/design-patterns-implementation in your project. Claude Code loads it when a task matches its description.

How do I install Design Patterns Implementation in Codex?

Run `npx skills add tmcfarlane/oh-my-cursor --skill design-patterns-implementation -a codex`. Or copy the skill folder (skills/design-patterns-implementation in tmcfarlane/oh-my-cursor) into .agents/skills/design-patterns-implementation in your project. Codex loads it when a task matches its description.

Can I use Design Patterns Implementation in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add tmcfarlane/oh-my-cursor --skill design-patterns-implementation -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/design-patterns-implementation, .gemini/skills/design-patterns-implementation, .github/skills/design-patterns-implementation and .opencode/skills/design-patterns-implementation in your project.

What does Design Patterns Implementation need to run?

SKILL.md names no scripts, command-line tools or credentials: Design Patterns Implementation is instructions for the agent only. Our summary lists: Python 3.

Does Design Patterns Implementation access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Design Patterns Implementation safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Design Patterns Implementation use?

Design Patterns Implementation is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Design Patterns Implementation use?

About 2.2k tokens (SKILL.md is roughly 8.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Design Patterns Implementation?

Skills that share tags, products or a category with Design Patterns Implementation: Swiftui View Refactor (Dimillian/Skills, 4k stars), RTK Rust Design Patterns (rtk-ai/rtk, 83k stars), Effect Client Wrapper (UsefulSoftwareCo/executor, 4.1k stars) and Architecture Patterns (KartikLabhshetwar/better-shot, 2.4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Design Patterns Implementation?

tmcfarlane (a GitHub user) maintains it in tmcfarlane/oh-my-cursor, which has 109 GitHub stars. The repository holds 14 skills in this directory. The repository was last updated on July 2, 2026.

Source: tmcfarlane/oh-my-cursor on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.