@tank/design-patterns
Installation
SKILL.md
Design Patterns
Structural solutions for recurring problems in JavaScript and TypeScript applications.
Core Philosophy
- Patterns are tools, not goals. Apply a pattern to solve a specific problem. If the problem does not exist, the pattern is overhead.
- Favor composition over inheritance. JS/TS excels at object composition, closures, and higher-order functions. Most GoF inheritance hierarchies collapse into simpler functional forms.
- Match the pattern to the language. A Java-style Singleton is an anti-pattern in JS modules. Adapt patterns to closures, first-class functions, Proxies, and ES module scope.
- Prefer the simplest pattern that solves the problem. If a function suffices, do not introduce a class hierarchy. Escalate complexity only when requirements demand it.
- Name the pattern in your code. When you use a pattern, name it explicitly (e.g.,
UserFactory,RetryStrategy). This communicates intent to future readers.