debug-systematiclisted
Install: claude install-skill manastalukdar/ai-devstudio
# Systematic Debugging Workflow
I'll help you debug issues systematically using the scientific method - hypothesis formation, testing, and iterative refinement.
Arguments: `$ARGUMENTS` - error description, reproduction steps, or context
## Token Optimization
**Target:** 50% reduction (4,000-6,000 → 1,500-3,000 tokens)
### Core Optimization Strategies
**1. Hypothesis-Driven Debugging (Not Exhaustive Analysis)**
- ❌ **AVOID:** Reading entire codebase to find bugs
- ✅ **DO:** Form hypotheses about likely causes, test top 2-3 first
- **Token savings:** 90% (200 tokens vs 2,000+ tokens)
- **Pattern:** Prioritize recently changed files, common failure patterns
**2. Git Diff for Recently Changed Files (Likely Bug Source)**
- ❌ **AVOID:** `ls -R` then reading all files
- ✅ **DO:** `git diff --name-only HEAD~3..HEAD` to find changed files
- ✅ **DO:** `git log --oneline --since="3 days ago"` for recent commits
- **Token savings:** 85% (300 tokens vs 2,000+ tokens)
- **Pattern:** Bugs often introduced in recent changes
**3. Stack Trace Parsing with Grep**
- ❌ **AVOID:** Reading entire log files with Read tool
- ✅ **DO:** `grep -i "error\|exception\|fatal" logs/*.log | tail -20`
- ✅ **DO:** Parse stack traces to extract file paths and line numbers
- **Token savings:** 95% (100 tokens vs 2,000+ tokens for large logs)
- **Pattern:** Stack traces reveal exact failure locations
**4. Test Failure Analysis Caching**
- ✅ Cache test results in `debug/state.json`
- ✅ Cache hypothesis out