From superpowers
Enforces 4-phase root cause investigation for bugs, errors, test failures, unexpected behavior, and technical issues before proposing fixes.
npx claudepluginhub fradser/dotclaude --plugin superpowersThis skill uses the workspace's default tool permissions.
Random fixes waste time and create new bugs. Quick patches mask underlying issues.
Enforces systematic root cause investigation before proposing fixes for bugs, test failures, unexpected behavior, performance problems, build failures, or integrations.
Applies four-phase framework (root cause investigation, pattern analysis, hypothesis testing, implementation) to debug bugs, test failures, performance issues, and unexpected behavior before fixes.
Guides systematic debugging of bugs, test failures, unexpected behavior via four phases: root cause investigation, pattern analysis, hypothesis testing, implementation before fixes.
Share bugs, ideas, or general feedback.
Random fixes waste time and create new bugs. Quick patches mask underlying issues.
Core principle: Root cause investigation must precede any fix attempt. Symptom fixes represent process failure.
Violating the letter of this process is violating the spirit of debugging.
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
Fixes cannot be proposed without completing Phase 1.
Systematic debugging applies to ANY technical issue:
Especially valuable when:
Process should not be skipped even when:
Each phase must be completed before proceeding to the next.
Before attempting any fix:
Read Error Messages Carefully
Reproduce Consistently
Check Recent Changes
Gather Evidence in Multi-Component Systems
For systems with multiple components (CI -> build -> signing, API -> service -> database):
Diagnostic instrumentation should be added before proposing fixes:
For EACH component boundary:
- Log what data enters component
- Log what data exits component
- Verify environment/config propagation
- Check state at each layer
Run once to gather evidence showing WHERE it breaks
THEN analyze evidence to identify failing component
THEN investigate that specific component
Multi-layer system example:
# Layer 1: Workflow
echo "=== Secrets available in workflow: ==="
echo "IDENTITY: ${IDENTITY:+SET}${IDENTITY:-UNSET}"
# Layer 2: Build script
echo "=== Env vars in build script: ==="
env | grep IDENTITY || echo "IDENTITY not in environment"
# Layer 3: Signing script
echo "=== Keychain state: ==="
security list-keychains
security find-identity -v
# Layer 4: Actual signing
codesign --sign "$IDENTITY" --verbose=4 "$APP"
This reveals which layer fails.
Trace Data Flow
When error is deep in call stack:
See ./references/root-cause-tracing.md for the complete backward tracing technique.
Quick approach:
Pattern identification should precede any fix:
Find Working Examples
Compare Against References
Identify Differences
Understand Dependencies
Scientific method application:
Form Single Hypothesis
Test Minimally
Verify Before Continuing
When Understanding is Missing
Fix the root cause, not the symptom:
Create Failing Test Case
Implement Single Fix
Verify Fix
If Fix Doesn't Work
Architecture Questioning After 3+ Failed Fixes
Patterns indicating architectural problem:
Stop and question fundamentals:
Discuss with human partner before attempting more fixes
This is not a failed hypothesis - this is wrong architecture.
For complex bugs, planning must precede any code changes:
A bug requires EnterPlanMode before making changes when ANY of these apply:
Complete Phase 1 (Root Cause Investigation)
Use EnterPlanMode
Write implementation plan covering:
Wait for user approval
For simple bugs: Continue with Phase 2-4 directly without planning.
These mental patterns indicate process violation and require returning to Phase 1:
If 3+ fixes failed: Question the architecture.
Watch for these redirections:
When encountering these signals: Return to Phase 1.
| Excuse | Reality |
|---|---|
| "Issue is simple, don't need process" | Simple issues have root causes too. Process is fast for simple bugs. |
| "Emergency, no time for process" | Systematic debugging is FASTER than guess-and-check thrashing. |
| "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
| "I'll write test after confirming fix works" | Untested fixes don't stick. Test first proves it. |
| "Multiple fixes at once saves time" | Can't isolate what worked. Causes new bugs. |
| "Reference too long, I'll adapt the pattern" | Partial understanding guarantees bugs. Read it completely. |
| "I see the problem, let me fix it" | Seeing symptoms != understanding root cause. |
| "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem. Question pattern, don't fix again. |
| Phase | Key Activities | Success Criteria |
|---|---|---|
| 1. Root Cause | Read errors, reproduce, check changes, gather evidence | Understand WHAT and WHY |
| 2. Pattern | Find working examples, compare | Identify differences |
| 3. Hypothesis | Form theory, test minimally | Confirmed or new hypothesis |
| 4. Implementation | Create test, fix, verify | Bug resolved, tests pass |
If systematic investigation reveals issue is environmental, timing-dependent, or external:
Note: 95% of "no root cause" cases represent incomplete investigation.
These techniques are part of systematic debugging:
./references/root-cause-tracing.md - Trace bugs backward through call stack to find original trigger./references/defense-in-depth.md - Add validation at multiple layers after finding root cause./references/condition-based-waiting.md - Replace arbitrary timeouts with condition polling./references/condition-based-waiting-example.ts - Example implementation of condition-based waiting./find-polluter.sh - Bisect test suite to identify which test pollutes shared stateRelated skills:
From debugging sessions: