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."4user-invocable: false5---67# Debugger Skill89> **Director Mode Lite** - Debugging Specialist1011---1213## 5-Step Root-Cause Method1415```161. CAPTURE → Collect the full error, reproduce, define expected vs actual172. ISOLATE → Narrow to the smallest failing case183. HYPOTHESIZE → List and rank likely causes194. INVESTIGATE → Test hypotheses, inspect state205. FIX & VERIFY → Apply the minimal fix, confirm, prevent recurrence21```2223## Step 1: Capture2425- [ ] Collect the complete error message and stack trace26- [ ] Can reproduce the issue with clear steps27- [ ] Identify the input that triggered the error28- [ ] Know expected vs actual behavior2930## Step 2: Isolate3132- [ ] Identify the failure location from the stack trace33- [ ] Which file(s) and function(s) are involved?34- [ ] When did it start? (`git bisect`, `git log`)35- [ ] Narrow down to the smallest reproducible case3637## Step 3: Hypothesize3839- [ ] List possible causes based on evidence40- [ ] Rank hypotheses by likelihood41- [ ] Design a test to confirm or eliminate each4243## Step 4: Investigate4445- Analyze error messages and logs carefully46- Add strategic debug logging; inspect variable state at key points47- Check for: null/undefined values, type mismatches, race conditions, resource exhaustion, external service failures4849### Common Bug Patterns5051| Pattern | Signs | Common Fix |52|---------|-------|------------|53| Null/Undefined | `Cannot read property of undefined` | Add null checks / optional chaining |54| Off-by-one | Loop runs one too many/few times | Check loop bounds |55| Race condition | Intermittent failures | Add synchronization |56| Type coercion | `"1" + 1 = "11"` | Explicit type conversion |57| Async issues | `Promise { <pending> }` | Await/handle promises |5859By language and domain:60- **JavaScript/TypeScript**: `undefined is not a function` (binding), `Cannot read property of null` (optional chaining), promise rejections (async/await handling), type errors (strict mode)61- **Python**: `AttributeError` (init/typos), `TypeError` (type validation), `ImportError` (paths, circular imports), `KeyError` (dict defaults)62- **Database**: connection timeouts (pool exhaustion), constraint violations (validation, foreign keys), deadlocks (transaction ordering)63- **API/Network**: 4xx (request validation, auth), 5xx (server-side, resource limits), timeouts (network, long-running queries)6465### Investigation Tools6667```bash68# Search for error message69grep -r "error message" src/7071# Find recent changes72git log --oneline -2073git diff HEAD~57475# Check specific function76grep -r "functionName" src/77```7879## Step 5: Fix & Verify8081Apply the solution:82- Make the minimal change; don't refactor while fixing; one fix per commit8384Confirm the fix:85- [ ] Original issue is resolved86- [ ] No new issues introduced87- [ ] Tests pass; add a test to prevent recurrence88- [ ] Manual verification done8990## Output Format9192```markdown93## Debug Report9495### Issue96[Description of the bug]9798### Reproduction Steps991. Step one1002. Step two1013. Observe error102103### Root Cause104[Explanation of why this happens]105106### Location107- **File**: `src/utils/parser.ts`108- **Line**: 45-52109- **Function**: `parseInput()`110111### Fix Applied112[Description of the fix]113114### Verification115- [x] Issue resolved116- [x] Tests pass117- [x] No regression118```