agentsclimarketplace

Design patterns

Skill cookieMonsterDev/agents-skills/architecture-skills/design-patterns

Agent Skills for coding agents

Install
npx -y skills add cookieMonsterDev/agents-skills --skill design-patterns

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 5 stars5 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Explains and applies the 23 Gang of Four (GoF) design patterns with idiomatic code examples in Python, C, C++, Java, C#, JavaScript, Rust, Go, PHP, and Swift. Use when users ask about design patterns (singleton, factory, builder, observer, strategy, decorator, adapter, etc.), when they need help choosing a pattern for a design problem, when refactoring code toward a pattern, or when they want a pattern example in a specific language.

SKILL.md

9.4 KB, as published. Nobody here has run it

Design Patterns

Ground design-pattern answers in the reference files bundled with this skill instead of improvising definitions. Each pattern has a reference file explaining it and a folder of runnable examples in popular languages.

When to Use

  • The user names a pattern directly ("show me the builder pattern in Rust")
  • The user describes a design problem that maps to a pattern ("I need to create objects without specifying their concrete class")
  • The user asks to compare patterns ("strategy vs state?")
  • The user wants existing code refactored toward a pattern

Workflow

  1. Identify the pattern(s) from the user's question using the catalog below.
  2. Read the reference file at references/<pattern>.md for the explanation, applicability, trade-offs, and related patterns.
  3. Read the language example at examples/<pattern>/<pattern>.<ext> when the user works in (or asks for) a specific language. Adapt it to their domain rather than pasting the generic example verbatim.
  4. Answer with: what the pattern does, when to use it (and when not to), and code adapted to the user's context.

If the user's problem does not match any pattern cleanly, say so — do not force a pattern where a plain function or data structure is simpler.

Pattern Catalog

Creational

Patterns that abstract the instantiation process.

PatternIntentReference
Abstract FactoryCreate families of related objects without specifying concrete classesreferences/abstract-factory.md
BuilderConstruct complex objects step by step, separating construction from representationreferences/builder.md
Factory MethodLet subclasses decide which class to instantiatereferences/factory-method.md
PrototypeCreate objects by cloning an existing instancereferences/prototype.md
SingletonEnsure a class has one instance with a global access pointreferences/singleton.md

Structural

Patterns that compose classes and objects into larger structures.

PatternIntentReference
AdapterConvert one interface into another that clients expectreferences/adapter.md
BridgeDecouple an abstraction from its implementation so both can varyreferences/bridge.md
CompositeTreat individual objects and compositions uniformly in tree structuresreferences/composite.md
DecoratorAttach responsibilities to objects dynamically without subclassingreferences/decorator.md
FacadeProvide a simple unified interface to a complex subsystemreferences/facade.md
FlyweightShare fine-grained objects to support large numbers efficientlyreferences/flyweight.md
ProxyProvide a surrogate that controls access to another objectreferences/proxy.md

Behavioral

Patterns that assign responsibilities and manage communication between objects.

PatternIntentReference
Chain of ResponsibilityPass a request along a chain of handlers until one handles itreferences/chain-of-responsibility.md
CommandEncapsulate a request as an object, enabling queues and undoreferences/command.md
InterpreterDefine a grammar and an interpreter for a small languagereferences/interpreter.md
IteratorAccess elements of a collection sequentially without exposing its internalsreferences/iterator.md
MediatorCentralize complex communication between objects in one mediatorreferences/mediator.md
MementoCapture and restore an object's internal state without breaking encapsulationreferences/memento.md
ObserverNotify dependents automatically when an object's state changesreferences/observer.md
StateLet an object change its behavior when its internal state changesreferences/state.md
StrategyDefine interchangeable algorithms behind a common interfacereferences/strategy.md
Template MethodDefine an algorithm's skeleton, deferring some steps to subclassesreferences/template-method.md
VisitorAdd operations to an object structure without modifying its classesreferences/visitor.md

Examples

Each pattern has a folder examples/<pattern>/ with self-contained, runnable examples named <pattern>.<ext>:

LanguageFileNotes
Python<pattern>.py
C<pattern>.cEmulated with structs and function pointers where the pattern relies on OOP
C++<pattern>.cpp
Java<pattern>.java
C#<pattern>.cs
JavaScript<pattern>.js
Rust<pattern>.rsUses traits and enums; no inheritance-based variants
Go<pattern>.goUses interfaces and composition; no inheritance-based variants
PHP<pattern>.php
Swift<pattern>.swift

Design patterns are expressed idiomatically per language — not as literal Java-style class hierarchies. C emulates with structs and function pointers; Go and Rust use interfaces, traits, and composition instead of inheritance. That is why those languages appear here but are omitted from the object-oriented-programming-paradigm skill, which requires first-class classes.

A language file may be absent when a pattern does not translate meaningfully to that language or is already built in (iterators in Python, module-scope singletons in JavaScript, sync.Once idioms in Go). The pattern's reference file notes such gaps and the idiomatic alternative.

Answering Guidelines

  • Prefer the language's idiomatic form over a literal GoF class diagram (e.g. closures for Strategy in JavaScript, enums for State in Rust, sync.Once for Singleton in Go).
  • Mention trade-offs and simpler alternatives, not just the mechanics.
  • When comparing patterns, read both reference files and contrast intent, not structure.
  • Do not recommend Singleton, or any pattern, as a default; patterns are solutions to specific forces, not style goals.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.