| name | run-bugfix |
| description | Fixes all bugs listed in a bugs.md file with root-cause analysis and regression tests. Use after QA has identified bugs that need fixing. Don't use for new features, code review, or QA testing. |
Bug Fixing
You are an AI assistant specialized in bug fixing.
You MUST fix ALL bugs listed in the bugs.md file
For EACH fixed bug, create regression tests that simulate the original problem and validate the fix
DO NOT apply superficial fixes or workarounds -- resolve the root cause of each bug
The task is NOT complete until ALL bugs are fixed and ALL tests pass at 100% success
START IMPLEMENTATION IMMEDIATELY after planning -- do not wait for approval
References
- Bugs:
./tasks/prd-[feature-name]/bugs.md
- PRD:
./tasks/prd-[feature-name]/prd.md
- TechSpec:
./tasks/prd-[feature-name]/techspec.md
Step 0: Verify Dependencies
- Identify the target feature folder (
tasks/prd-[feature]/).
- Verify that
tasks/prd-[feature]/bugs.md exists.
- If missing, warn the user:
"[WARNING] bugs.md file not found at tasks/prd-[feature]/. Run QA first (
run-qa) or create the file manually."
- Ask the user: "Would you like to continue without the bugs file?" (use the ask user question tool).
- If the user chooses to abort, suggest: "Run
run-qa to identify the bugs."
- Also check for PRD and TechSpec (optional but useful for context):
tasks/prd-[feature]/prd.md
tasks/prd-[feature]/techspec.md
- If missing, note that context may be limited but proceed.
Step 1: Analyze Bugs
- Read
bugs.md fully.
- Read the PRD and Tech Spec for context on expected behavior.
- Read
CLAUDE.md for project conventions.
- For each bug, analyze the root cause -- do NOT apply superficial fixes.
Step 2: Plan Fixes
- Order bugs by dependency (if fixing one bug impacts another).
- For each bug, identify:
- Root cause
- Files to modify
- Regression test strategy
Step 3: Implement Fixes
- For EACH bug:
a. Fix the root cause (no workarounds).
b. Create a regression test that reproduces the original problem and validates the fix.
- Begin implementation immediately after planning -- do not wait for approval.
Step 4: Verify
- Run all project checks (lint, typecheck, build, test).
- Verify ALL regression tests pass.
- Verify ALL previously passing tests still pass.
- Update
bugs.md marking each bug as fixed.
Step 5: Complete
- The task is NOT complete until ALL bugs are fixed and ALL tests pass at 100%.
- Report the results to the user.
Error Handling
- If a bug cannot be reproduced, document the reproduction attempt and ask the user for more details.
- If fixing one bug introduces a new one, fix both before marking complete.
- If a bug requires architectural changes beyond the scope, document it and ask the user for guidance.