bug-fixlisted
Install: claude install-skill eugenelim/agent-ready-repo
# Skill: bug-fix
Fix a defect in the smallest, most root-causing way. The discipline is
universal: reproduce before fixing, write the failing test first,
identify root vs symptom, minimum diff, commit body documents why.
## When to invoke
Even a one-line fix benefits from walking this discipline; it forces
the question "is this fixing the cause or hiding it?"
For multi-file changes that go beyond fixing one defect — refactors,
new features triggered by discovering the bug — stop and use
`new-spec` instead. This skill is for bug fixes, not opportunistic
restructuring.
## Procedure
1. **Reproduce first.** Don't write a fix until you have one of: a
failing test, documented manual reproduction steps that fail
reliably, or a captured error / stack trace / log signature. No
reproduction = no fix; you might be fixing the wrong thing.
2. **Write the failing test (red).** It should pin the *observable
contract being violated*, not the current implementation. Push
back on these failure modes:
- **Mock-shape assertion.** `expect(mock).toHaveBeenCalledWith(...)`
when the observable contract is a returned value or state
change. Test the contract, not the implementation. (See
`quality-engineer`'s "mock-shape assertions" check.)
- **Test passes for the wrong reason.** Run the test against the
unfixed code; confirm it fails *because of* the bug, not
because the setup is wrong.
3. **Identify root cause before writing the fix.** Write down