typescript-design-patternslisted
The 22 classic Gang of Four design patterns catalogued for TypeScript as ready-to-apply playbooks: intent, problem solved, participants, conceptual OOP example, and idiomatic TypeScript rewrites (discriminated unions, HOFs, generators, Record lookups). Includes trade-offs, how to recognize each pattern, and when NOT to apply them. Use when structuring new features, reviewing architecture, refactoring bloated classes/conditionals, designing extension points, or choosing between class hierarchies and union types. Triggers on: design pattern, GoF, Gang of Four, factory, abstract factory, builder, prototype, singleton, adapter, bridge, composite, decorator, facade, flyweight, proxy, chain of responsibility, command, iterator, mediator, memento, observer, state machine, strategy, template method, visitor, double dispatch, undo/redo, middleware pipeline, event emitter, anti-corruption layer, which pattern should I use.
fugisakimatheus/typescript-skills · ★ 1 · Web & Frontend · score 75
Install: claude install-skill fugisakimatheus/typescript-skills
# TypeScript Design Patterns
The classic **Gang of Four** catalog, written for TypeScript. Each pattern has a dedicated
file in [`references/`](./references/) containing the theory, the canonical TypeScript
example, a modern TypeScript rewrite, and the trade-offs.
## How to use this skill
1. **Start from the symptom, not the pattern name.** Open
[`references/choosing-a-pattern.md`](./references/choosing-a-pattern.md) and find the
problem you actually have.
2. **Load exactly one reference file.** They're self-contained and 200–400 lines; loading
several wastes context for no gain.
3. **Check the TypeScript shortcut before committing to the classic form.** Several GoF
patterns exist to work around limitations TypeScript doesn't have.
4. **Name it in the code.** A pattern is also communication — `ShippingStrategy` tells the
next reader which problem was being solved.
Two cross-cutting files:
- [`choosing-a-pattern.md`](./references/choosing-a-pattern.md) — routing by symptom, the
TypeScript-shortcut table, and the cost checklist.
- [`pattern-relations.md`](./references/pattern-relations.md) — telling confusable patterns
apart (Strategy vs. State vs. Bridge, Proxy vs. Decorator vs. Adapter, Mediator vs.
Observer, …).
## Catalog
Ratings for complexity (Cx) and popularity (Pop) are out of three stars:
### Creational — how objects get made
| Pattern | Intent | Cx | Pop |
|---|---|---|---|
| [factory-method](./references/factory-method.md) | Creation thr