Systematic Debugging
Help me debug an issue using a structured approach.
Step 1: Understand the Problem
- What is the expected behavior?
- What is the actual behavior?
- When did it start happening?
- Is it reproducible? How?
Step 2: Gather Evidence
- Check error messages and stack traces
- Review recent changes (git log, git diff)
- Check logs (application, system, browser console)
- Note the environment (OS, versions, config)
Step 3: Form Hypotheses
Based on evidence, list possible causes ranked by likelihood:
- Most likely: ...
- Possible: ...
- Less likely: ...
Step 4: Test Hypotheses
For each hypothesis:
- Design a minimal test to confirm/reject
- Start with the most likely cause
- Document what you tried and results
Step 5: Isolate the Bug
- Find the minimal reproduction case
- Identify the exact line/function causing the issue
- Understand WHY it fails, not just WHERE
Step 6: Fix and Verify
- Implement the fix
- Verify the original issue is resolved
- Check for regressions
- Add a test to prevent recurrence
Output
Provide a debugging report with:
- Root cause identified
- Fix implemented
- Verification steps taken
- Prevention measures added