一键导入
debugging
Use when existing production code has a failure — bug report, monitoring alert, or user-reported issue in previously working functionality
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when existing production code has a failure — bug report, monitoring alert, or user-reported issue in previously working functionality
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when entering a new project for the first time, or when the codebase has changed significantly — generates a yin-side codebase map with structural analysis and silent failure surface assessment
Use when the user describes a small, low-risk change — bug fix with known cause, config change, dependency update, or small refactor under 100 lines
Use when a plan with tasks exists and you need to execute implementation — requires index.yaml and tasks/ directory
Use when implement is complete and feature-level scar items need review — aggregates remaining scars across tasks, triages cross-task patterns, and fixes system-level rot before validate-and-ship
Use when research/kickoff is complete and you need to create an implementation plan with specs, tasks, and acceptance criteria
Use when research output is complete and planning would otherwise need to assume design, task-shape, structural boundaries, or evaluation details before implementation planning
| name | debugging |
| description | Use when existing production code has a failure — bug report, monitoring alert, or user-reported issue in previously working functionality |
Systematic debugging for production failures in existing code. Not for implementation issues — those are part of the TDD cycle.
Bug = 既有 codebase 在 production 環境中產生的 failure。
This skill applies ONLY when:
If the failure is in code you're currently writing → that's implementation (use samsara:implement).
If the spec doesn't match reality → that's spec drift (use samsara:validate-and-ship).
If the failure comes from a recently delivered feature with changes/<feature>/pre-thinking.md, read its Evaluation Contract. The Primary evaluator is the canonical feedback source and its Feedback loop is the first repair path unless production evidence disproves it.
digraph debugging {
node [shape=box];
start [label="Production failure 被觀測到\n(bug report / alert / 使用者回報)" shape=doublecircle];
interrogate [label="Phase 1: Interrogate the Failure\n- 失敗分類(等級1-4)\n- 靜默腐爛 vs 顯性崩潰?\n- 影響範圍有多大?\n- 它裝了多久正常?"];
root_cause [label="Phase 2: Root Cause Tracing\n- 重現失敗\n- 追蹤腐爛路徑\n- 問:為什麼它能藏這麼久?\n- 問:哪一層在幫它演戲?"];
hypothesis [label="Phase 3: Hypothesis & Death Test\n- 形成假設\n- 寫 death test 重現 bug\n- 驗證 death test 確實 fail\n- 一次只改一個變數"];
fix [label="Phase 4: Fix + Scar Report\n- 實作最小修復\n- Death test 通過\n- 回答:這個 fix 在什麼條件下再次靜默失敗?"];
choose [label="Fix 規模?" shape=diamond];
fast [label="小 fix → inline 完成\n寫 fix-summary.yaml"];
full [label="大 fix → invoke\nsamsara:implement"];
done [label="完成" shape=doublecircle];
start -> interrogate;
interrogate -> root_cause;
root_cause -> hypothesis;
hypothesis -> fix;
fix -> choose;
choose -> fast [label="< 100 行\n根因明確"];
choose -> full [label="> 100 行\n或影響範圍大"];
fast -> done;
full -> done;
}
Do NOT jump to root cause. First, interrogate the failure itself.
If an Evaluation Contract exists, answer:
Level 1 - Visible crash (least dangerous)
System throws error, stops. It will be found, it will be fixed.
Level 2 - Degradation disguise (dangerous)
Fallback activates but doesn't mark degraded state.
Looks like it's working. Actually running on backup data.
Level 3 - False success (very dangerous)
Operation appears complete. Key side effects didn't happen.
Returns 200, but database didn't write, email didn't send.
Level 4 - Silent rot (most dangerous)
No errors, no warnings, no anomalies.
System keeps running, corruption keeps spreading.
Nobody knows. The system doesn't know either.
Must answer:
Output: bug-report.yaml
Not just "what broke" — ask "why did the system let it hide for so long?"
See support file root-cause-tracing.md for detailed techniques.
Output: root-cause.yaml
Scientific method — one variable at a time:
samsara:implementOutput: fix-summary.yaml
All output in bugfix/ directory (parallel to changes/):
bugfix/
└── YYYY-MM-DD_<bug-description>/
├── bug-report.yaml # Phase 1
├── root-cause.yaml # Phase 2
└── fix-summary.yaml # Phase 4