Guides implementation of all 22 GoF design patterns in TypeScript with intent, examples, and applicability. Helps refactor code with pattern-shaped problems like class explosion, giant switches, or runtime algorithm selection.
How this skill is triggered — by the user, by Claude, or both
Slash command
/pproenca-dot-skills-1:implementation-design-patternsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Implementation reference for the 22 Gang of Four design patterns in TypeScript, distilled from refactoring.guru. Each of the **22 pattern files across 3 categories** captures intent, problem, solution, applicability, a runnable TypeScript example, implementation steps, pros/cons, and relations to sibling patterns.
Implementation reference for the 22 Gang of Four design patterns in TypeScript, distilled from refactoring.guru. Each of the 22 pattern files across 3 categories captures intent, problem, solution, applicability, a runnable TypeScript example, implementation steps, pros/cons, and relations to sibling patterns.
The patterns are a vocabulary for structural decisions, not a prescription. Reach for a pattern only when its applicability criteria match the problem at hand — every pattern entry includes a When NOT to Use section to guard against over-engineering.
kind, parallel class hierarchies, identical algorithm skeletons across siblings) — make it explicit| # | Category | Impact | Patterns | When to reach for this group |
|---|---|---|---|---|
| 1 | Creational | HIGH | 5 | Object construction is non-trivial, varies by configuration, or risks tight coupling to concrete classes |
| 2 | Structural | HIGH | 7 | Composing classes/objects into larger structures while keeping parts substitutable |
| 3 | Behavioral | HIGH | 10 | Distributing responsibility and defining how objects collaborate at runtime |
references/{category}-{pattern}.md. Confirm intent, then read Applicability and When NOT to Use before adopting.ConcreteStrategyA, Receiver). Rename to domain terms before merging.creational-factory-method — Subclasses decide which concrete product to create. "I need to add new product types without touching the creator code." — HIGHcreational-abstract-factory — Produce families of related objects together. "My code must work with multiple matching variants (chair+sofa+table) and shouldn't mix families." — MEDIUM-HIGHcreational-builder — Construct complex objects step by step. "My constructor has 10+ parameters or I have a telescoping-constructor smell." — HIGHcreational-prototype — Clone objects through their own clone() method. "I need to copy objects without depending on their concrete class." — MEDIUMcreational-singleton — Guarantee a single shared instance with a global access point. "I need exactly one instance of this class — config, registry, pool." — MEDIUMstructural-adapter — Translate one interface to another. "I need to use a library whose API doesn't match what my code expects." — HIGHstructural-bridge — Split abstraction from implementation so they can vary independently. "I have two orthogonal dimensions and the subclass count is exploding." — MEDIUMstructural-composite — Treat individual objects and compositions uniformly. "I have a tree (folders/files, groups/items, components/children) and want one interface for leaves and branches." — HIGHstructural-decorator — Wrap an object to add behavior without subclassing. "I want to layer behaviors (logging + caching + auth) on the same interface at runtime." — HIGHstructural-facade — Expose a simple interface over a complex subsystem. "My client code is tangled in initialization and orchestration of a third-party library." — HIGHstructural-flyweight — Share common state across many objects to save memory. "I'm spawning millions of similar objects and running out of RAM." — LOW-MEDIUMstructural-proxy — Substitute for another object to control access. "I need lazy loading, access control, caching, or logging without touching the real subject." — MEDIUM-HIGHbehavioral-chain-of-responsibility — Pass a request along a chain of handlers. "I have a pipeline of validation / auth / parsing checks and want to add or reorder them dynamically." — MEDIUM-HIGHbehavioral-command — Turn a request into a stand-alone object. "I need undo/redo, queueing, scheduling, macro recording, or to decouple invoker from receiver." — HIGHbehavioral-iterator — Traverse a collection without exposing its representation. "I want clients to walk a structure without knowing if it's a list, tree, or graph." — HIGHbehavioral-mediator — Centralize communication among components in a single hub. "My form fields all reference each other directly and the coupling is unmanageable." — MEDIUMbehavioral-memento — Capture and restore an object's state without breaking encapsulation. "I need snapshots for undo/redo or transactional rollback." — LOW-MEDIUMbehavioral-observer — Notify dependent objects when state changes. "Many objects need to react when one object changes — events, reactive UI, pub/sub." — CRITICALbehavioral-state — Alter behavior when internal state changes. "My class is a state machine with massive conditionals branching on a status field." — MEDIUM-HIGHbehavioral-strategy — Make algorithms interchangeable at runtime. "I have multiple algorithms (sort, route, pay, compress) and want to pick one without conditionals." — HIGHbehavioral-template-method — Fix an algorithm's skeleton in a base class; subclasses override steps. "Several classes share the same algorithm structure with minor step differences." — MEDIUMbehavioral-visitor — Add operations to an object structure without modifying the classes. "I'd need to add 5 unrelated operations across an AST but I can't touch the node classes." — LOW-MEDIUMSeveral patterns share a structural shape but solve different problems. Read each pattern's Related Patterns section, then apply these distinctions:
implementation-functional-patterns — TypeScript's functional answer (HOFs, lambdas, pipelines, streams, composition) for problems where this catalog reaches for a class. Most Strategy / Iterator / Command / Chain-of-Responsibility / Decorator / Template-Method shapes have a lighter functional form in idiomatic TS; consult it before introducing a new class hierarchy.npx claudepluginhub joshuarweaver/cascade-code-general-misc-1 --plugin pproenca-dot-skills-1Covers 26 Gang of Four design patterns with PHP 8.3+ implementations, UML diagrams, and practical use cases.
Maps code smells like switch-on-type dispatch, subclass explosion, or tangled construction to matching Gang of Four design patterns, then loads the structural recipe from reference files.
Gang of Four patterns (Creational, Structural, Behavioral) and when to apply them.