| name | debug |
| description | Systematic Debugging Workflow |
| lifecycle | experimental |
/debug - Systematic Debugging Workflow
Structured approach to debugging issues.
Usage
/debug <error message or description>
/debug --trace # Include stack trace analysis
/debug --bisect # Git bisect guidance
What This Skill Does
- Understand the Problem - Parse error, reproduce issue
- Form Hypotheses - Likely causes based on error type
- Systematic Investigation - Step-by-step debugging
- Identify Root Cause - Narrow down to exact issue
- Propose Fix - Solution with verification
Debugging Framework
# Debug Session: [Issue Description]
## 1. Problem Statement
**Error**: [Exact error message]
**When**: [When does it occur]
**Frequency**: [Always / Sometimes / Once]
## 2. Reproduction Steps
1. Step 1
2. Step 2
3. Error occurs
**Minimal Reproduction**:
```python
# Smallest code that reproduces the issue
3. Initial Hypotheses
| # | Hypothesis | Likelihood | Test |
|---|
| 1 | Null pointer | High | Add null check |
| 2 | Race condition | Medium | Add logging |
| 3 | Config issue | Low | Check config |
4. Investigation Log
Test 1: [Hypothesis being tested]
Action: What I did
Result: What happened
Conclusion: Confirmed / Ruled out
Test 2: ...
5. Root Cause
[Exact cause identified]
6. Fix
problematic_code()
fixed_code()
7. Verification
## Common Error Patterns
### Python
| Error | Common Causes |
|-------|---------------|
| `AttributeError` | None value, wrong type, typo |
| `KeyError` | Missing dict key, wrong key name |
| `ImportError` | Missing dep, circular import, wrong path |
| `TypeError` | Wrong arg type, wrong arg count |
| `ValueError` | Invalid value, parsing error |
### Rust
| Error | Common Causes |
|-------|---------------|
| `unwrap() panic` | None/Err not handled |
| `borrow checker` | Ownership, lifetime issues |
| `type mismatch` | Generic constraints, conversions |
## Debugging Commands
```bash
# Python with debugger
python -m pdb script.py
# Python with verbose imports
python -v script.py
# Rust with backtrace
RUST_BACKTRACE=1 cargo run
# Git bisect
git bisect start
git bisect bad HEAD
git bisect good v1.0.0
Instructions for Claude
When /debug is invoked:
- Parse the error - Extract error type, message, location
- Ask for context - Reproduction steps, when it started
- Form hypotheses - Rank by likelihood
- Test systematically - One variable at a time
- Log findings - Document each test and result
- Identify root cause - Narrow down definitively
- Propose fix - With before/after code
- Verify - Confirm fix works, no regression
- Prevent recurrence - Suggest test to add