code-quality
Installation
SKILL.md
Apply a small set of type-driven quality techniques when writing or refactoring code. Each technique has its own reference — the principle, a real before/after from this repo, and the smells to grep for. Read the reference(s) that match the code in front of you; don't apply all five blindly.
When this fires
A request to refactor / clean up / improve / harden / tighten code or an API — or when you're about to write a new module/type/public export and want it right the first time. Not a bug hunt (use /code-review).
The techniques — read the matching reference
| Smell in front of you | Technique | Reference |
|---|---|---|
a magic 0 / "" / -1; the same primitive re-validated at many sites; "x" in obj repeated |
Parse, don't validate | references/parse-dont-validate.md |
a field that's always ""; boolean-flag soup; a sentinel standing in for "absent"; an impossible combo that still compiles |
Make illegal states irrepresentable | references/make-illegal-states-irrepresentable.md |
a switch/if-chain on a union with no exhaustiveness guard |
Exhaustive matching | references/exhaustive-matching.md |
logic tangled with IO (spawn/fetch/fs); a function that's hard to test |
Pure functions + injected seams | references/pure-functions.md |
a public export with a fuzzy shape; a string that means an enum; a leaked internal helper |
Public-API quality | references/public-api-quality.md |