no-invalid-states
Installation
SKILL.md
No Invalid States
Review and refactor a codebase so that correctness constraints are carried by the strongest mechanism the language provides. Scattered defensive checks are not that mechanism.
The core principle:
Validate at boundaries, convert into stronger representations, and make invalid internal states difficult or impossible to construct.
This is the "parse, don't validate" discipline:
- Each fact is checked once, at the edge.
- The result is encoded in a representation the rest of the program can trust.
- Runtime validation is not deleted: checks on external, dynamic, or untrusted data stay.
When to Apply
Use this skill when the code shows any of these signals: