Debugger Skill
Director Mode Lite - Debugging Specialist
5-Step Root-Cause Method
1. CAPTURE → Collect the full error, reproduce, define expected vs actual
2. ISOLATE → Narrow to the smallest failing case
3. HYPOTHESIZE → List and rank likely causes
4. INVESTIGATE → Test hypotheses, inspect state
5. FIX & VERIFY → Apply the minimal fix, confirm, prevent recurrence
Step 1: Capture
Step 2: Isolate
Step 3: Hypothesize
Step 4: Investigate
- Analyze error messages and logs carefully
- Add strategic debug logging; inspect variable state at key points
- Check for: null/undefined values, type mismatches, race conditions, resource exhaustion, external service failures
Common Bug Patterns
| Pattern |
Signs |
Common Fix |
| Null/Undefined |
Cannot read property of undefined |
Add null checks / optional chaining |
| Off-by-one |
Loop runs one too many/few times |
Check loop bounds |
| Race condition |
Intermittent failures |
Add synchronization |
| Type coercion |
"1" + 1 = "11" |
Explicit type conversion |
| Async issues |
Promise { <pending> } |
Await/handle promises |
By language and domain:
- JavaScript/TypeScript:
undefined is not a function (binding), Cannot read property of null (optional chaining), promise rejections (async/await handling), type errors (strict mode)
- Python:
AttributeError (init/typos), TypeError (type validation), ImportError (paths, circular imports), KeyError (dict defaults)
- Database: connection timeouts (pool exhaustion), constraint violations (validation, foreign keys), deadlocks (transaction ordering)
- API/Network: 4xx (request validation, auth), 5xx (server-side, resource limits), timeouts (network, long-running queries)
Investigation Tools
# Search for error message
grep -r "error message" src/
# Find recent changes
git log --oneline -20
git diff HEAD~5
# Check specific function
grep -r "functionName" src/
Step 5: Fix & Verify
Apply the solution:
- Make the minimal change; don't refactor while fixing; one fix per commit
Confirm the fix:
Output Format
## Debug Report
### Issue
[Description of the bug]
### Reproduction Steps
1. Step one
2. Step two
3. Observe error
### Root Cause
[Explanation of why this happens]
### Location
- **File**: `src/utils/parser.ts`
- **Line**: 45-52
- **Function**: `parseInput()`
### Fix Applied
[Description of the fix]
### Verification
- [x] Issue resolved
- [x] Tests pass
- [x] No regression
1---2name: debugger3description: Systematic debugging method: 5-step root-cause analysis (capture, isolate, hypothesize, investigate, fix & verify) plus common bug-pattern reference. Use when errors, exceptions, test failures, or unexpected behavior appear. Loaded automatically by the debugger agent.4---56# Debugger Skill78> **Director Mode Lite** - Debugging Specialist910---1112## 5-Step Root-Cause Method1314```151. CAPTURE → Collect the full error, reproduce, define expected vs actual162. ISOLATE → Narrow to the smallest failing case173. HYPOTHESIZE → List and rank likely causes184. INVESTIGATE → Test hypotheses, inspect state195. FIX & VERIFY → Apply the minimal fix, confirm, prevent recurrence20```2122## Step 1: Capture2324- [ ] Collect the complete error message and stack trace25- [ ] Can reproduce the issue with clear steps26- [ ] Identify the input that triggered the error27- [ ] Know expected vs actual behavior2829## Step 2: Isolate3031- [ ] Identify the failure location from the stack trace32- [ ] Which file(s) and function(s) are involved?33- [ ] When did it start? (`git bisect`, `git log`)34- [ ] Narrow down to the smallest reproducible case3536## Step 3: Hypothesize3738- [ ] List possible causes based on evidence39- [ ] Rank hypotheses by likelihood40- [ ] Design a test to confirm or eliminate each4142## Step 4: Investigate4344- Analyze error messages and logs carefully45- Add strategic debug logging; inspect variable state at key points46- Check for: null/undefined values, type mismatches, race conditions, resource exhaustion, external service failures4748### Common Bug Patterns4950| Pattern | Signs | Common Fix |51|---------|-------|------------|52| Null/Undefined | `Cannot read property of undefined` | Add null checks / optional chaining |53| Off-by-one | Loop runs one too many/few times | Check loop bounds |54| Race condition | Intermittent failures | Add synchronization |55| Type coercion | `"1" + 1 = "11"` | Explicit type conversion |56| Async issues | `Promise { <pending> }` | Await/handle promises |5758By language and domain:59- **JavaScript/TypeScript**: `undefined is not a function` (binding), `Cannot read property of null` (optional chaining), promise rejections (async/await handling), type errors (strict mode)60- **Python**: `AttributeError` (init/typos), `TypeError` (type validation), `ImportError` (paths, circular imports), `KeyError` (dict defaults)61- **Database**: connection timeouts (pool exhaustion), constraint violations (validation, foreign keys), deadlocks (transaction ordering)62- **API/Network**: 4xx (request validation, auth), 5xx (server-side, resource limits), timeouts (network, long-running queries)6364### Investigation Tools6566```bash67# Search for error message68grep -r "error message" src/6970# Find recent changes71git log --oneline -2072git diff HEAD~57374# Check specific function75grep -r "functionName" src/76```7778## Step 5: Fix & Verify7980Apply the solution:81- Make the minimal change; don't refactor while fixing; one fix per commit8283Confirm the fix:84- [ ] Original issue is resolved85- [ ] No new issues introduced86- [ ] Tests pass; add a test to prevent recurrence87- [ ] Manual verification done8889## Output Format9091```markdown92## Debug Report9394### Issue95[Description of the bug]9697### Reproduction Steps981. Step one992. Step two1003. Observe error101102### Root Cause103[Explanation of why this happens]104105### Location106- **File**: `src/utils/parser.ts`107- **Line**: 45-52108- **Function**: `parseInput()`109110### Fix Applied111[Description of the fix]112113### Verification114- [x] Issue resolved115- [x] Tests pass116- [x] No regression117```