Individual skill
implementation-design-patterns
Implementation guide for the 22 Gang of Four design patterns in TypeScript, distilled from refactoring.guru. Use this skill when writing, refactoring, or reviewing TypeScript that exhibits a pattern-shaped problem — class-explosion from inheritance, conditionals switching on type, tight coupling to concrete classes, tree-shaped models, runtime algorithm selection, undo/redo, snapshot-and-restore, state-dependent behavior, subscriber notification, or hiding subsystem complexity. Each pattern entry includes intent, problem, solution, applicability (when to use AND when NOT to use), a runnable TypeScript example, implementation steps, pros/cons, and relations to sibling patterns. Trigger even when no pattern is named — cues like "class getting unwieldy," "giant switch," "swap implementations at runtime," "combinatorial subclasses," "need undo," or "traverse a tree" are pattern-shaped. Covers all 5 Creational, 7 Structural, and 10 Behavioral GoF patterns.
skills/.curated/implementation-design-patterns/SKILL.md
Source commit cf93c57cac89d6fc3e4194686000411567f5caf3
What was checked
- Matches the observed repository HEAD
- Yes
- Scanner rules are current
- No
- Repository scan complete
- No
- Skill scan complete
- No
- Observed behavior
- Not checked yet
- Last checked
- Nov 5, 2026
These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.
Install this skill
Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.
An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.
Repository context
- Repository stars (not skill ratings)
- 222
- Repository last updated
- Aug 15, 2026
- License
- MIT
Observed agent integration: codex
Files and excerpt
File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.
Browse files
AGENTS.mddoc · 10,285 bytesSKILL.mdcore · 11,738 bytesSKILL.mdcore · 11,738 bytesgotchas.mddoc · 1,962 bytesmetadata.jsonasset · 1,590 bytesreferences/_sections.mddoc · 1,769 bytesreferences/behavioral-chain-of-responsibility.mddoc · 7,148 bytesreferences/behavioral-command.mddoc · 7,285 bytesreferences/behavioral-iterator.mddoc · 6,935 bytesreferences/behavioral-mediator.mddoc · 6,627 bytesreferences/behavioral-memento.mddoc · 9,168 bytesreferences/behavioral-observer.mddoc · 7,632 bytesreferences/behavioral-state.mddoc · 6,691 bytesreferences/behavioral-strategy.mddoc · 6,919 bytesreferences/behavioral-template-method.mddoc · 8,251 bytesreferences/behavioral-visitor.mddoc · 7,933 bytesreferences/creational-abstract-factory.mddoc · 8,019 bytesreferences/creational-builder.mddoc · 7,307 bytesreferences/creational-factory-method.mddoc · 7,113 bytesreferences/creational-prototype.mddoc · 6,634 bytesreferences/creational-singleton.mddoc · 5,582 bytesreferences/structural-adapter.mddoc · 6,096 bytesreferences/structural-bridge.mddoc · 6,808 bytesreferences/structural-composite.mddoc · 7,467 bytesreferences/structural-decorator.mddoc · 6,344 bytesreferences/structural-facade.mddoc · 6,279 bytesreferences/structural-flyweight.mddoc · 7,358 bytesreferences/structural-proxy.mddoc · 7,022 bytes
Read excerpt
# TypeScript Design Patterns Best Practices (Refactoring Guru)
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.
## When to Apply
- Refactoring a class that has grown unwieldy via inheritance — combinatorial subclasses, conditional branching on type, or a "god class" with many responsibilities
- Designing a new module whose collaborators are not yet fixed — you want to keep the interface stable while implementations vary
- Integrating an incompatible third-party API, library, or legacy class into existing code
- Modeling a tree-shaped domain (file systems, organization charts, expression ASTs, UI component trees) where leaves and branches must be treated uniformly
- Adding cross-cutting behavior at runtime — logging, caching, access control, decoration — without subclassing
- Selecting an algorithm or behavior variant at runtime based on configuration, user input, or environmental conditions