solid-principleslisted
Install: claude install-skill bostonaholic/team
# SOLID Principles
Apply when writing new code; check for violations when reviewing. Each
principle below carries the smells that betray it in a diff.
## S — Single Responsibility
**One reason to change** — one actor or stakeholder whose requirements could
change the code.
Smells: a unit with more than one clear purpose (`UserService` that validates,
persists, *and* sends email); `and` in a name (`validateAndSave()`); functions
past ~30 lines; multiple unrelated tests for one unit.
If you cannot name a function without "and", it has too many jobs.
## O — Open/Closed
**Open for extension, closed for modification.** Adding behavior should not
require changing existing tested code.
Smells: a `switch`/`if-else` chain on a type field that must be edited for
every new type; hardcoded variant lists; tests that break whenever a new
variant is added.
Fix by defining an interface for the varying behavior and adding
implementations rather than branches.
## L — Liskov Substitution
**Subtypes are substitutable for their base types** without the caller
knowing which it got.
Smells: an override that throws `NotImplementedError` or does nothing;
callers checking `instanceof` before calling; subclasses weakening
preconditions or strengthening postconditions; tests that cannot run against
both base and subtype.
Design hierarchies on behavior, not taxonomy. Prefer composition when "is-a"
does not hold behaviorally. A subtype may restrict behavior (`ReadOnlyList`)
but must fulfill e