一键导入
superpowers-systematic-debugging
Any bug, failing or flaky test, or surprise behavior? Load BEFORE you investigate or guess.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Any bug, failing or flaky test, or surprise behavior? Load BEFORE you investigate or guess.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Got a spec or requirements for a multi-step task? Load first, before touching code.
Sync this port with upstream obra/superpowers or Reasonix main-v2: detect drift, re-port, bench-gate
Building a feature or starting from an idea? STOP. Load first for an approved design before code.
Executing a written plan step-by-step in this session, with checkpoints? Load this first.
Branch finished, tests green? Load first to merge, PR, or clean up.
Got review feedback? Load BEFORE changing anything — verify each point, push back if wrong.
| name | superpowers-systematic-debugging |
| description | Any bug, failing or flaky test, or surprise behavior? Load BEFORE you investigate or guess. |
Random fixes waste time, create new bugs. Quick patches mask real issue.
Core principle: ALWAYS find root cause before fixes. Symptom fixes = failure.
Break letter of process = break spirit of debugging.
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
Phase 1 not done? Cannot propose fixes.
ANY technical issue: test failures, production bugs, unexpected behavior, performance problems, build failures, integration issues.
ESPECIALLY when:
Don't skip when:
You MUST complete each phase before the next.
BEFORE attempting ANY fix:
Read Error Messages Carefully
Reproduce Consistently
Check Recent Changes
git diff, recent commits, new deps, config)Gather Evidence in Multi-Component Systems
WHEN system has multiple components (CI → build → signing, API → service → database), BEFORE proposing fixes, add diagnostic instrumentation at each boundary:
For EACH component boundary:
- Log what data enters the component
- Log what data exits the component
- Verify environment/config propagation
Run once to gather evidence showing WHERE it breaks
THEN investigate that specific component
Example (multi-layer system):
echo "=== Secrets available in workflow ==="
echo "IDENTITY: ${IDENTITY:+SET}${IDENTITY:-UNSET}"
echo "=== Env vars in build script ==="
env | grep IDENTITY || echo "IDENTITY not in environment"
echo "=== Keychain state ==="
security find-identity -v
This reveals which layer fails (secrets → workflow ✓, workflow → build ✗).
Trace Data Flow
WHEN error deep in call stack: see Root Cause Tracing reference (auto-included below) for complete backward-tracing technique.
Quick version: Where does bad value originate? What called this with bad value? Trace up until you find source. Fix at source, not symptom.
Fix root cause, not symptom:
Catch yourself thinking:
ALL of these mean: STOP. Return to Phase 1. 3+ fixes failed: question architecture (Phase 4.5).
Watch for these redirections from your human partner:
See these: STOP. 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 |
Systematic investigation shows issue is truly environmental, timing-dependent, or external? Process complete. Document what you investigated, implement appropriate handling (retry, timeout, error message), add monitoring/logging.
But: 95% of "no root cause" cases = incomplete investigation.
Related skills: superpowers-test-driven-development (Phase 4 failing test) · superpowers-verification-before-completion (confirm the fix).