Debugging Workflow
PROSE constraints: Reduced Scope (narrow the problem systematically) + Progressive Disclosure (gather context incrementally).
Phase 1: Understand the Problem
- •Parse
$ARGUMENTSfor error messages, stack traces, or symptom descriptions - •Search the codebase for relevant code paths
- •Read related test files to understand expected behavior
Phase 2: Reproduce
- •Identify a minimal reproduction path
- •Run relevant tests to confirm the failure:
npm test -- [relevant-test] - •If no test exists, create one that demonstrates the bug
Phase 3: Isolate
- •Trace the execution path from symptom to root cause
- •Check recent changes:
git log --oneline -20 - •Narrow scope — identify the single function or condition causing the issue
- •State the root cause clearly before proceeding
Validation Gate
STOP: Present the root cause analysis and proposed fix. Wait for confirmation.
Phase 4: Fix
- •Make the minimal change that fixes the root cause
- •Don't refactor surrounding code — fix the bug only
- •Update or add a test that would have caught this bug
Phase 5: Verify
- •Run the failing test to confirm it passes:
npm test -- [test-file] - •Run the full test suite to check for regressions:
npm test - •Run the linter:
npm run lint
Output Summary
markdown
## Bug Fix: [title] ### Root Cause [What was wrong and why] ### Fix [What was changed] ### Files Modified - [file] — [change description] ### Verification - [test] — passes - Full suite — no regressions