debugging
Use when facing ANY technical issue. Systematic debugging - root cause investigation BEFORE attempting fixes.
When & Why to Use This Skill
This Claude skill implements a rigorous, four-phase systematic debugging framework designed to eliminate guesswork in software development. By prioritizing root cause investigation over immediate fixes, it helps developers identify the source of technical issues, trace data flows, and verify hypotheses, significantly reducing the time spent on trial-and-error troubleshooting and preventing the introduction of new bugs.
Use Cases
- Case 1: Resolving persistent test failures by tracing data flow upstream to find the original source of corruption rather than patching symptoms.
- Case 2: Investigating critical production bugs under time pressure using a structured hypothesis-testing protocol to ensure the first fix is the correct one.
- Case 3: Debugging complex integration issues between microservices by comparing working vs. broken code patterns and analyzing dependency changes.
- Case 4: Identifying the root cause of unexpected behavior in legacy codebases by performing systematic pattern analysis and reviewing recent git history.
- Case 5: Troubleshooting performance bottlenecks or build failures by following a mandatory investigation phase before modifying configuration files.
| name | debugging |
|---|---|
| description | Use when facing ANY technical issue. Systematic debugging - root cause investigation BEFORE attempting fixes. |
Systematic Debugging
Core Principle: "NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST."
Random fixes create new bugs and waste time. Understand before you fix.
When to Apply
Use for ANY technical issue:
- Test failures
- Production bugs
- Unexpected behavior
- Performance problems
- Build failures
- Integration issues
Especially critical when:
- Under time pressure
- "Obvious quick fix" tempts you
- Multiple fix attempts have failed
The Four Mandatory Phases
Phase 1: Root Cause Investigation
BEFORE attempting ANY fix:
Analyze error messages carefully
- Don't skip warnings
- Note line numbers, error codes
- Error often contains the solution
Reproduce consistently
- Document exact steps
- Confirm it fails reliably
Review recent changes
git log --oneline -10 git diff HEAD~5Trace data flow backward
- Follow bad values upstream
- Find the SOURCE, not the symptom
Phase 2: Pattern Analysis
- Find similar working code in codebase
- Compare working vs broken versions
- List every difference
- Understand all dependencies
Phase 3: Hypothesis Testing
Form ONE specific hypothesis:
"I believe X causes this because Y"
Test with smallest possible change
Verify result before proceeding
If unsuccessful → new hypothesis (don't compound fixes!)
Phase 4: Implementation
- Create failing test that reproduces bug
- Implement ONE fix addressing root cause
- Verify solution completely
- CRITICAL: If 3+ fixes failed → question the architecture
Red Flags (Restart from Phase 1)
Stop immediately if you're thinking:
- "Quick fix for now, investigate later"
- "Let me try this AND this AND this"
- "One more attempt..."
- Planning to skip test creation
Partner signals to heed:
- "Stop guessing"
- "We're stuck?"
- "What's the root cause?"
Output Format
**Debugging Report:**
**Symptom:** [What's failing]
**Root Cause Investigation:**
- Error message: [exact error]
- Recent changes: [relevant commits]
- Data trace: [where bad value originates]
**Hypothesis:** [specific theory]
**Test:** [minimal change to verify]
**Result:** [confirmed/rejected]
**Fix:** [single targeted change]
**Verification:** [test output proving fix]
Impact
| Approach | Time | Success Rate |
|---|---|---|
| Systematic investigation | 15-30 min | 95% |
| Random guessing | 2-3 hours | 40% |
Investigation beats guessing. Every time.