design-patterns
/design-patterns
Use when picking or implementing a named pattern: Strategy, Observer, Adapter, Decorator, Factory, Repository, Unit of Work, Dependency injection, Retry with backoff, Circuit Breaker, Idempotency key, Outbox, Result type. Not for whether to abstract at all (use engineering-principles), SOLID refactors (use solid-principles), aggregates (use domain-driven-design), CQRS, event sourcing, sagas, event-driven design, service boundaries or service-to-service communication (use code-architectures).
- Author
- joeblackwaslike ↗
- Repository
- agent-skills ↗
- Licence
- MIT
- Last repository change
- 13.11.2026
Assessment and security
- Files in this package
- 24
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 13.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use when picking or implementing a named pattern: Strategy, Observer, Adapter, Decorator, Factory, Repository, Unit of Work, Dependency injection, Retry with backoff, Circuit Breaker, Idempotency key, Outbox, Result type. Not for whether to abstract at all (use engineering-principles), SOLID refactors (use solid-principles), aggregates (use domain-driven-design), CQRS, event sourcing, sagas, event-driven design, service boundaries or service-to-service communication (use code-architectures).
Original author description
Use when picking or implementing a named pattern: Strategy, Observer, Adapter, Decorator, Factory, Repository, Unit of Work, Dependency injection, Retry with backoff, Circuit Breaker, Idempotency key, Outbox, Result type. Not for whether to abstract at all (use engineering-principles), SOLID refactors (use solid-principles), aggregates (use domain-driven-design), CQRS, event sourcing, sagas, event-driven design, service boundaries or service-to-service communication (use code-architectures).
How it works
- Default to no pattern
- What to load
- Related skills
SKILL.md preview
--- name: design-patterns description: >- Use when picking or implementing a named pattern: Strategy, Observer, Adapter, Decorator, Factory, Repository, Unit of Work, Dependency injection, Retry with backoff, Circuit Breaker, Idempotency key, Outbox, Result type. Not for whether to abstract at all (use engineering-principles), SOLID refactors (use solid-principles), aggregates (use domain-driven-design), CQRS, event sourcing, sagas, event-driven design, service boundaries or service-to-service communication (use code-architectures). metadata: last_updated: "2026-11-11" --- # Design Patterns A catalog of the patterns that show up in production code, with one reference per pattern in Python and TypeScript. Most are a function, a closure or a `Protocol` in these languages, not a class hierarchy. Python examples assume 3.12 or later. ## Default to no pattern Start with a plain function, a dict of functions, or an `if`. A second CSV export format is a function argument. Reach for a pattern when the plain version has already hurt: the third `elif` on a provider name, a notification call copied into four callers, a module that cannot be tested without the database. If the request names a variant-selection pattern (Strategy, Factory, State, Command, Chain of Responsibility), count the real variants or callers, including any this change adds. With fewer than three, write the plain version and say so in one line. Resilience and data-access patterns (Retry, Circuit Breaker, Idempotency key, Outbox, Unit of Work) are triggered by a failure mode, not a count: one call site that can double-charge or lose an event already needs them. Observer is triggered by a coupling boundary, not a count: subscribers the publisher should not import. Every reference has an early "Do you need this?" section that names the plain alternative and the signal that tips you over. If you cannot point at that signal, skip the pattern. ## What to load Open only the file the task needs. [catalog.md](references/catalog.md) lists every pattern with a one-line summary and how common it is. | You are... | Read | |---|---| | Choosing a pattern, or refreshing what one is | [catalog.md](references/catalog.md) | | Choosing an implementation once, by name or config, at construction (payment provider, exporter) | [factory.md](references/creational/factory.md) | | Constructing an object with many optional parts | [builder.md](references/creational/builder.md) | | Passing collaborators in instead of creating them inside, so tests can swap them | [dependency-injection.md](references/creational/dependency-injection.md) | | Tempted by a global instance | [singleton.md](references/creational/singleton.md) | | Making a third-party API or legacy module fit your interface, or putting one simple front (Facade) on a messy subsystem | [adapter.md](references/structural/adapter.md) | | Wrapping one call with logging, caching, auth or timing without editing it | [decorator.md](references/structural/decorator.md) | | Standing in for an object with the same interface to control access: lazy load, remote stand-in, permission gate | [proxy.md](references/structural/proxy.md) | | Choosing an algorithm per call at runtime (pricing, routing, sorting) | [strategy.md](references/behavioral/strategy.md) | | Notifying other modules when something happens | [observer.md](references/behavioral/observer.md) | | Queuing, undoing or replaying an action as data | [command.md](references/behavioral/command.md) | | Sending one request through an ordered list of handlers, each able to stop it (middleware, validation) | [chain-of-responsibility.md](references/behavioral/chain-of-responsibility.md) | | Behavior that depends on a lifecycle status (order or payment states) | [state.md](references/behavioral/state.md) | | Fixed skeleton with steps that vary | [template-method.md](references/behavioral/template-method.md) | | Walking a collection lazily or in pages | [iterator.md](references/behavioral/iterator.md) | | Hiding persistence behind a domain-shaped interface (a repository inside an aggregate belongs to `domain-driven-design`) | [repository.md](references/data-access/repository.md) | | Several writes that must commit or roll back together | [unit-of-work.md](references/data-access/unit-of-work.md) | | Separating wire or database shapes from domain objects | [dto-mapper.md](references/data-access/dto-mapper.md) | | Calling something flaky | [retry-backoff.md](references/resilience/retry-backoff.md) | | Stopping calls to a dependency that is down | [circuit-breaker.md](references/resilience/circuit-breaker.md) | | Making a retried request safe to repeat | [idempotency-key.md](references/resilience/idempotency-key.md) | | Writing to the database and publishing an event atomically | [outbox.md](references/resilience/outbox.md) | | Returning errors or absence without exceptions or null checks, or substituting a do-nothing default object (Null Object) | [result-option.md](references/value-modeling/result-option.md) | Facade is described inside the adapter file and Null Object inside the result-option file. Abstract Factory, Prototype, Bridge, Composite, Flyweight, Memento, Mediator, Visitor and Interpreter are catalog-only; the catalog says what to use instead. ## Related skills - `engineering-principles`: whether to abstract at all, and how much. Read it first if you are unsure a pattern is warranted. - `solid-principles`: the SRP/OCP/LSP/ISP/DIP treatment that most patterns apply, plus the anti-patterns for needless indirection. - `domain-driven-design`: aggregates and repositories inside aggregates. - `code-architectures`: layering, CQRS, event sourcing and service boundaries. Architecture-level material lives there, not here.
Files in this package (24)
- SKILL.md 6 KB
- references/catalog.md 5 KB
- references/behavioral/chain-of-responsibility.md 6 KB
- references/behavioral/command.md 5 KB
- references/behavioral/iterator.md 5 KB
- references/behavioral/observer.md 6 KB
- references/behavioral/state.md 6 KB
- references/behavioral/strategy.md 6 KB
- references/behavioral/template-method.md 5 KB
- references/creational/builder.md 7 KB
- references/creational/dependency-injection.md 6 KB
- references/creational/factory.md 5 KB
- references/creational/singleton.md 7 KB
- references/data-access/dto-mapper.md 7 KB
- references/data-access/repository.md 7 KB
- references/data-access/unit-of-work.md 7 KB
- references/resilience/circuit-breaker.md 10 KB
- references/resilience/idempotency-key.md 11 KB
- references/resilience/outbox.md 13 KB
- references/resilience/retry-backoff.md 13 KB
- references/structural/adapter.md 10 KB
- references/structural/decorator.md 9 KB
- references/structural/proxy.md 7 KB
- references/value-modeling/result-option.md 9 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · joeblackwaslike/agent-skills | 100 | MIT |
| spencerbeggs/effected | 100 | MIT |
| spencerbeggs/effected | 100 | MIT |
| krzysztofsurdy/code-virtuoso | 100 | MIT |
| nimadorostkar/Claude-Skills-collection | 100 | MIT |
| andreibesleaga/gabbe | 100 | CC-BY-4.0 |
| pantheon-org/tekhne | 100 | MIT |
| itzcull/software-skills | 100 | MIT |
| guilhermevozniak/refactor-pilot-framework | 100 | MIT |
Database snapshot: 13.11.2026 · package version 94ffc93d9556 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 2 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100code-architectures
Use when choosing or structuring how a system is built: hexagonal layering, CQRS, event sourcing, event-driven design, sagas, microservices vs monolith, strangler-fig migration, service timeouts and contracts, CAP and eventual consistency. Not for aggregates or bounded contexts… - 100engineering-principles
Use when writing, designing, refactoring or extending code: where logic belongs, how much abstraction is enough, module and interface structure, error handling, validation at boundaries, naming, what a test should prove. Triggers on "how should I structure this", "is this too… - 100design-patterns-implementation
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. - 100software-patterns
Compare tradeoffs and recommend architectural patterns — dependency injection, service-oriented architecture, repository, domain events, circuit breaker, and anti-corruption layer. Use when choosing between design patterns, planning microservices boundaries, evaluating system… - 100php-patterns
Apply PHP design patterns — Singleton, Factory, Strategy, Observer, Repository, Decorator, and Dependency Injection in PHP. Use when structuring WooCommerce extension code or implementing complex business logic. - 100microservices-patterns
Decompose systems into microservices and apply canonical distributed-systems patterns. Use this skill whenever the user wants to split a monolith into services, design service boundaries, choose between microservices and a modular monolith, implement sagas or the outbox pattern,…