mcpField
D
design-patterns

design-patterns

github.com/krzysztofsurdyDevelopment3661 installsUpdated 1w ago
Repository

About design-patterns

A design-pattern reference skill for developers, organized by creational, structural, and behavioral intent. It covers implementations in several languages, UML guidance, practical use cases, and advice on selecting and applying patterns.

Key features

  1. 01Patterns grouped by intent
  2. 02Reference for 26 design patterns
  3. 03Implementations across languages
  4. 04UML guidance and practical uses
  5. 05Pattern selection and practice advice

Use cases

  1. 01Choosing a pattern for a design problem
  2. 02Comparing patterns by use case
  3. 03Consulting implementations and UML guidance
  4. 04Checking whether a pattern adds needless complexity

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/krzysztofsurdy/code-virtuoso --skill design-patterns

After installing, type/design-patternsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
abstract-factory.md
adapter.md
bridge.md
builder.md
chain-of-responsibility.md
command.md
composite.md
decorator.md
facade.md
factory-method.md
flyweight.md
interpreter.md
iterator.md
mediator.md
memento.md
null-object.md
object-pool.md
observer.md
private-class-data.md
prototype.md
proxy.md
singleton.md
state.md
strategy.md
template-method.md
visitor.md

Details

From the project README

Design Patterns

Reference for 26 design patterns organized by intent (creational, structural, behavioral), with implementations in PHP, Python, Java, C++ and others, UML guidance, and practical use cases.

Pattern Index

Creational Patterns
  • Abstract Factory - Produce families of related objects without specifying their concrete classes → reference
  • Builder - Assemble complex objects through a step-by-step process → reference
  • Factory Method - Declare an interface for object creation, letting subclasses determine the concrete type → reference
  • Prototype - Duplicate existing objects without coupling to their concrete classes → reference
  • Singleton - Guarantee that a class has exactly one instance → reference
  • Object Pool - Recycle expensive-to-create objects for repeated use → reference
Structural Patterns
  • Adapter - Translate one interface into another that clients expect → reference
  • Bridge - Separate an abstraction from its implementation so both can evolve independently → reference
  • Composite - Arrange objects into tree structures for uniform treatment → reference
  • Decorator - Layer new behaviors onto objects dynamically through wrapping → reference
  • Facade - Offer a simple interface to a complex subsystem → reference
  • Flyweight - Minimize memory usage by sharing common state across many objects → reference
  • Proxy - Manage access to an object through a surrogate → reference
  • Private Class Data - Limit access to class attributes → reference
Behavioral Patterns
  • Chain of Responsibility - Route requests through a chain of handlers → reference
  • Command - Represent requests as standalone objects → reference
  • Interpreter - Establish a grammar representation and an interpreter for it → reference
  • Iterator - Walk through elements without revealing the underlying structure → reference
  • Mediator - Untangle dependencies through a central coordinator → reference
  • Memento - Snapshot and restore object state without breaking encapsulation → reference
  • Null Object - Supply a do-nothing default to eliminate null checks → reference
  • Observer - Automatically inform dependents when state changes → reference
  • State - Change behavior when internal state transitions → reference
  • Strategy - Make algorithms interchangeable at runtime → reference
  • Template Method - Outline an algorithm skeleton and let subclasses fill in specific steps → reference
  • Visitor - Introduce operations to objects without altering their classes → reference

When to Use Which Pattern

ProblemPattern
Need to create families of related objectsAbstract Factory
Complex object construction with many optionsBuilder
Want to defer instantiation to subclassesFactory Method
Need copies of complex objectsPrototype
Need exactly one instance globallySingleton
Incompatible interfaces need to work togetherAdapter
Want to vary abstraction and implementation independentlyBridge
Tree structures with uniform treatmentComposite
Add responsibilities dynamically without subclassingDecorator
Simplify a complex subsystem interfaceFacade
Many similar objects consuming too much memoryFlyweight
Control access, add lazy loading, or log accessProxy
Multiple handlers for a request, unknown which handles itChain of Responsibility
Queue, log, or undo operationsCommand
Need to interpret a simple language/grammarInterpreter
Traverse a collection without exposing internalsIterator
Reduce coupling between many communicating objectsMediator
Need undo/snapshot capabilityMemento
One-to-many event notificationObserver
Object behavior depends on its stateState
Need to switch algorithms at runtimeStrategy
Algorithm skeleton with customizable stepsTemplate Method
Add operations to object structures without modificationVisitor

Best Practices

  • Favor composition over inheritance: reach for Decorator, Strategy, or Bridge before building deep class hierarchies
  • Apply patterns to real problems, not hypothetical ones
  • Use your language's modern features where they fit: enums for State, immutable value types for Value Objects, first-class functions for Strategy
  • Combine patterns when it makes sense (for example, Builder + Fluent Interface, Strategy + Factory Method)
  • Keep pattern implementations minimal. If the pattern adds more complexity than it removes, reconsider it

Comments

Markdown supported