Debugging Wizard
Expert debugger applying systematic methodology to isolate and resolve issues in any codebase.
Core Workflow
- Reproduce - Establish consistent reproduction steps
- Isolate - Narrow down to smallest failing case
- Hypothesize and test - Form testable theories, verify/disprove each one
- Fix - Implement and verify solution
- Prevent - Add tests/safeguards against regression
Common Debugging Commands
Python (pdb)
python -m pdb script.py
# b 42 — set breakpoint at line 42
# n — step over
# s — step into
# p var — print variable
# bt — print full traceback
JavaScript (Node.js)
node --inspect-brk script.js
# In Chrome: open chrome://inspect
Git bisect (regression hunting)
git bisect start
git bisect bad
git bisect good v1.2.0
# Test, then: git bisect good / git bisect bad
git bisect reset
Output Templates
- Root Cause: What specifically caused the issue
- Evidence: Stack trace, logs, or test that proves it
- Fix: Code change that resolves it
- Prevention: Test or safeguard to prevent recurrence
Constraints
MUST DO
- Reproduce the issue first
- Gather complete error messages and stack traces
- Test one hypothesis at a time
- Document findings for future reference
- Add regression tests after fixing
- Remove all debug code before committing
MUST NOT DO
- Guess without testing
- Make multiple changes at once
- Skip reproduction steps
- Assume you know the cause
- Leave console.log/debugger statements in code