| name | codifying-footguns |
| description | Turn a repeated mistake into an enforcement artifact: hook, lint rule, script, or doctrine line. |
codifying-footguns
A footgun you only write down repeats. The rule is: the same pass that hits it
produces the artifact that prevents it. Not the next session, not a follow-up
line in a report.
This skill exists because "I hit X again" was said several times in one session
about mistakes that already had notes written about them. A note is not
enforcement.
The memory side of this is docs/agents.md/fleet/memory-codification.md: a
memory stating an enforceable rule carries an enforcement: line naming the
artifact. That page says a lesson needs an enforcer; this one is how to build
one.
Measure before you write
The step people skip, and the one that decides whether the artifact is worth
having. Run the candidate pattern across the tree and read the hits.
grep -rEIho "<pattern>" --include='*.mts' . | wc -l
Then judge:
- Mostly true positives - write the rule, and fix every existing hit in the
same pass. A rule that ships with a backlog teaches everyone its findings are
normal.
- Mostly legitimate use - do NOT write it. Measured examples that were
rejected for exactly this: bare
used to <verb> is half passive-purpose
(Used to gate the bypass), in the past is always a date comparison,
historically reads as present-tense legacy state, and spawnSync without
stdioString is 292 of 334 callsites.
- Zero hits, high severity - a prophylactic rule is fine, but say so. It
carries no cleanup and proves nothing about the past.
Re-measure through the REAL entry point afterwards, not a reimplementation. An
audit script that loops per-item where the guard groups items over-reports; that
turned a real count of 5 into a chased 33.
Pick the artifact
| The footgun is | Use | Because |
|---|
| A command shape (bash, git, a CLI) | hook, PreToolUse | Only a hook sees a tool call before it runs |
| Something written into a file | oxlint rule | It is checkable from source, in CI, forever |
| Advice you handed the operator | hook, Stop/PostToolUse | Prose is not a tool call; the bash-side guard never sees it |
| A multi-step flow people re-derive | script (.mts) + a package.json entry | The script owns the argv nobody should retype |
| A judgement call with no single right answer | skill | A checklist beats a blocker when the answer is contextual |
| A fact about intent or preference | doctrine line in CLAUDE.md, or a memory | Nothing to detect, so nothing to enforce |
One artifact per pattern. Two patterns in one rule cannot be dropped
independently when one stops earning its keep.
Checklist: a new hook
Checklist: a new oxlint rule
Checklist: a new script
Checklist: doctrine only
Do not
- Do not report a footgun and move on. If it is worth naming, it is worth
codifying, and naming-then-deferring is the failure this skill replaces.
- Do not write the artifact without measuring. A rule that cries wolf gets
disabled, and then the real finding is invisible.
- Do not leave existing violations. Fix them in the same pass and re-measure to
zero.
- Do not widen a measured-narrow pattern later without re-measuring. Record the
rejected candidates and their numbers in the source so the next person does
not re-add them.