Debug Helper
Systematic debugging workflow.
Error Analysis
- Read the error: full stack trace and error message
- Locate: find the source file and line
# Search for the error origin grep -rn "ErrorClass\|error_function" src/ - Context: read surrounding code (±30 lines)
- Reproduce: identify minimal reproduction steps
- Root cause: trace the data flow to find where it goes wrong
- Fix: minimal change that addresses the root cause
- Verify: run the failing case to confirm the fix
Log Analysis
- Read the log file or output
- Identify patterns: timestamps, error levels, request IDs
- Correlate events across log lines
- Summarize: what happened, when, and why
Performance Profiling
- Measure: get baseline numbers first
time <command> - Profile: use language-appropriate tools:
- Node.js:
--prof,clinic.js - Python:
cProfile,py-spy - Go:
pprof
- Node.js:
- Identify: find the hotspot (usually 1-2 functions)
- Optimize: fix the bottleneck
- Verify: measure again, compare with baseline