name: fix description: Structured bug fix workflow — find issue in tracker, root-cause, fix, test, verify, document argument-hint: "[ISS-NNN or bug description]"
Fix the bug: $ARGUMENTS
Workflow
0. Check Tracking + Memory
- Check auto-memory for prior lessons matching this bug type
- Read
ISSUES.md— find the relevant tracked issue by ID or description - If the issue isn't tracked yet, add it to
ISSUES.mdfirst (assign next ISS-NNN ID) - Update issue status to
IN PROGRESS
1. Verify the Issue Exists
- Read the code at the reported location
- Confirm the bug is real, not a false alarm
- If already fixed or no longer applies: update
ISSUES.mdstatus toFIXEDand stop
2. Root-Cause Analysis
- Read the code — understand what it does, not what you think it does
- Trace the data flow — for tool issues: schema → handler → endpoint → request → response
- Never stop at the first failure — ask "why did THIS fail?" and trace backward
- Check Known Patterns & Pitfalls in CLAUDE.md — is this a known pattern?
3. Implement the Fix
- Fix the root cause — not the symptom
- Minimal change — don't refactor surrounding code
- Follow the project's conventions (CLAUDE.md)
- If the fix changes tool behavior or params, note what docs need updating
4. Test
- Can an existing test be updated to cover the fix? Update it
- Does the fix change observable behavior no test covers? Add a regression test
- The test must fail before the fix and pass after — verify this mentally or actually
5. Verify
Run the quality gate immediately after the fix:
npm run typecheck && npm run lint && npm run test -- --passWithNoTests
All must pass. git diff — confirm only intentional changes.
6. Document
This step is not optional. The fix is incomplete until:
ISSUES.mdis updated with:- Status:
FIXEDwith date - Root cause (file:line — one sentence)
- Fix description
- Files changed
- Tests added/updated
- Status:
docs/TOOLS.mdupdated if the fix changes tool behaviorCLAUDE.mdKnown Patterns & Pitfalls updated if the pattern is generalizable- Auto-memory lesson written if anything went wrong during the fix process
Output
Issue: ISS-NNN — [title]
Severity: [level]
Root Cause: [file:line — one sentence]
Status: FIXED
Files changed: [list]
Tests: [added N / updated N / none needed]
Docs updated: [list or "none"]
Rules
- Always update
ISSUES.md— fixes without tracking are invisible - Fix the root cause, not the symptom
- Don't refactor surrounding code during a bug fix
- DO NOT commit automatically — wait for explicit user approval