Fix a Bug
Systematic approach to diagnosing and fixing bugs
CLAUDE.md
When asked to fix a bug:
- Reproduce the bug. Read the error message, stack trace, or description carefully.
- Write a failing test that captures the buggy behavior.
- Trace the code path to find the root cause — don’t guess.
- Fix the root cause, not the symptom.
- Verify the failing test now passes.
- Run the full test suite to check for regressions.
- If the fix touches multiple files, review each change for unintended side effects.
Copy this workflow into your CLAUDE.md or agent config file so your agent follows this process automatically.