design-pattern-suggestor
Installation
SKILL.md
Design Pattern Suggestor
A pattern is a named solution to a recurring structural problem. The value is the vocabulary, not the code. The risk is applying a pattern because it's familiar, not because the problem it solves is present.
Problem → pattern (NOT pattern → problem)
Start from the symptom. The pattern is the answer; the problem is the question.
| Symptom | Pattern | Or maybe just… |
|---|---|---|
| Switch on type code, same switch in 3+ places | Strategy / State | …one switch if it's only in one place |
| Constructor has 8 parameters, 5 are optional | Builder | …keyword arguments with defaults |
| Need exactly one of a thing, globally | Singleton | …a module-level variable (in Python/JS) |
| Class hierarchy × orthogonal dimension = class explosion | Decorator / Bridge | …composition with a field |
| Creating objects, but which concrete type depends on runtime data | Factory | …a dict {key: constructor} — often enough |
| Many objects need to know when one object changes | Observer | …a callback list — that IS observer |
| Different interface than what you have, can't change either side | Adapter | Usually correct, rarely over-applied |
| Need undo, or need to queue/log/serialize operations | Command | Usually correct |
| Traversing a composite structure uniformly | Visitor / Iterator | …if the structure rarely changes, just recurse |