$npx -y skills add Jeffallan/claude-skills --skill debugging-wizardParses error messages, traces execution flow through stack traces, correlates log entries to identify failure points, and applies systematic hypothesis-driven methodology to isolate and resolve bugs. Use when investigating errors, analyzing stack traces, finding root causes of un
| 1 | # Debugging Wizard |
| 2 | |
| 3 | Expert debugger applying systematic methodology to isolate and resolve issues in any codebase. |
| 4 | |
| 5 | ## Core Workflow |
| 6 | |
| 7 | 1. **Reproduce** - Establish consistent reproduction steps |
| 8 | 2. **Isolate** - Narrow down to smallest failing case |
| 9 | 3. **Hypothesize and test** - Form testable theories, verify/disprove each one |
| 10 | 4. **Fix** - Implement and verify solution |
| 11 | 5. **Prevent** - Add tests/safeguards against regression |
| 12 | |
| 13 | ## Reference Guide |
| 14 | |
| 15 | Load detailed guidance based on context: |
| 16 | |
| 17 | <!-- Systematic Debugging row adapted from obra/superpowers by Jesse Vincent (@obra), MIT License --> |
| 18 | |
| 19 | | Topic | Reference | Load When | |
| 20 | |-------|-----------|-----------| |
| 21 | | Debugging Tools | `references/debugging-tools.md` | Setting up debuggers by language | |
| 22 | | Common Patterns | `references/common-patterns.md` | Recognizing bug patterns | |
| 23 | | Strategies | `references/strategies.md` | Binary search, git bisect, time travel | |
| 24 | | Quick Fixes | `references/quick-fixes.md` | Common error solutions | |
| 25 | | Systematic Debugging | `references/systematic-debugging.md` | Complex bugs, multiple failed fixes, root cause analysis | |
| 26 | |
| 27 | ## Constraints |
| 28 | |
| 29 | ### MUST DO |
| 30 | - Reproduce the issue first |
| 31 | - Gather complete error messages and stack traces |
| 32 | - Test one hypothesis at a time |
| 33 | - Document findings for future reference |
| 34 | - Add regression tests after fixing |
| 35 | - Remove all debug code before committing |
| 36 | |
| 37 | ### MUST NOT DO |
| 38 | - Guess without testing |
| 39 | - Make multiple changes at once |
| 40 | - Skip reproduction steps |
| 41 | - Assume you know the cause |
| 42 | - Debug in production without safeguards |
| 43 | - Leave console.log/debugger statements in code |
| 44 | |
| 45 | ## Common Debugging Commands |
| 46 | |
| 47 | **Python (pdb)** |
| 48 | ```bash |
| 49 | python -m pdb script.py # launch debugger |
| 50 | # inside pdb: |
| 51 | # b 42 — set breakpoint at line 42 |
| 52 | # n — step over |
| 53 | # s — step into |
| 54 | # p some_var — print variable |
| 55 | # bt — print full traceback |
| 56 | ``` |
| 57 | |
| 58 | **JavaScript (Node.js)** |
| 59 | ```bash |
| 60 | node --inspect-brk script.js # pause at first line, attach Chrome DevTools |
| 61 | # In Chrome: open chrome://inspect → click "inspect" |
| 62 | # Sources panel: add breakpoints, watch expressions, step through |
| 63 | ``` |
| 64 | |
| 65 | **Git bisect (regression hunting)** |
| 66 | ```bash |
| 67 | git bisect start |
| 68 | git bisect bad # current commit is broken |
| 69 | git bisect good v1.2.0 # last known good tag/commit |
| 70 | # Git checks out midpoint — test, then: |
| 71 | git bisect good # or: git bisect bad |
| 72 | # Repeat until git identifies the first bad commit |
| 73 | git bisect reset |
| 74 | ``` |
| 75 | |
| 76 | **Go (delve)** |
| 77 | ```bash |
| 78 | dlv debug ./cmd/server # build & attach |
| 79 | # (dlv) break main.go:55 |
| 80 | # (dlv) continue |
| 81 | # (dlv) print myVar |
| 82 | ``` |
| 83 | |
| 84 | ## Output Templates |
| 85 | |
| 86 | When debugging, provide: |
| 87 | 1. **Root Cause**: What specifically caused the issue |
| 88 | 2. **Evidence**: Stack trace, logs, or test that proves it |
| 89 | 3. **Fix**: Code change that resolves it |
| 90 | 4. **Prevention**: Test or safeguard to prevent recurrence |
| 91 | |
| 92 | [Documentation](https://jeffallan.github.io/claude-skills/skills/quality/debugging-wizard/) |