一键导入
debugging
Use when encountering any bug, test failure, error, or unexpected behavior - before proposing fixes. Requires root cause investigation first.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when encountering any bug, test failure, error, or unexpected behavior - before proposing fixes. Requires root cause investigation first.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Complete the current milestone and prepare next work by following the canonical complete command doc.
Execute the current plan (from STATE.md -> PLAN.md) by following the canonical execute command doc. Make code changes + run necessary checks.
Initialize project with CLAUDE.md, STATE.md, and ROADMAP.md by following the canonical init command doc.
Create executable plan for the current phase (3-5 tasks). Reads the canonical plan command doc and produces/updates the current PLAN.md referenced from STATE.md. No implementation.
Review code changes and capture learnings for CLAUDE.md by following the canonical review command doc.
Check project progress and suggest the next action by following the canonical status command doc.
| name | debugging |
| description | Use when encountering any bug, test failure, error, or unexpected behavior - before proposing fixes. Requires root cause investigation first. |
Diagnose and fix errors using scientific method with disciplined root cause analysis.
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
If you haven't completed Phase 1, you cannot propose fixes. Symptom fixes are failure.
Use for ANY technical issue:
Use ESPECIALLY when:
Don't skip when:
Complete each phase before proceeding to the next.
BEFORE attempting ANY fix:
git diff, recent commitsWhen error is deep in call stack:
See root-cause-tracing.md for the complete backward tracing technique.
When system has multiple components (API → service → database):
For EACH component boundary:
- Log what data enters component
- Log what data exits component
- Verify environment/config propagation
Run once to gather evidence showing WHERE it breaks
THEN analyze evidence to identify failing component
THEN investigate that specific component
Find the pattern before fixing:
Scientific method:
Fix the root cause, not the symptom:
If you catch yourself thinking:
ALL of these mean: 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. |
| "Multiple fixes at once saves time" | Can't isolate what worked. Causes new bugs. |
| "I see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. |
| Phase | Key Activities | Success Criteria |
|---|---|---|
| 1. Root Cause | Read errors, reproduce, check changes, trace data | 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 |
# Git bisect for regressions
git bisect start
git bisect bad HEAD
git bisect good <last-known-good-commit>
# Find recent changes to a file
git log --oneline -10 path/to/file
# Search for error message
grep -r "error message" --include="*.ts"
| Error Pattern | Likely Root Cause | Investigation |
|---|---|---|
Cannot read property 'x' of undefined | Missing data, async timing | Trace where null originates |
Module not found | Path issues, missing export | Check exact path, case sensitivity |
CORS error | Backend config | Check Network tab, test with curl |
Timeout | Slow operation, connection issue | Profile, check network |
| Works locally, fails in CI | Environment diff | Compare env vars, versions, permissions |
| Intermittent failures | Race conditions, timing | Look for shared state, async issues |
From debugging sessions: