用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/andrem-sec/psc-comet --skill investigate命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | investigate |
| description | Systematic root-cause debugging — no fixes before root cause is confirmed |
| version | 0.1.0 |
| level | 3 |
| triggers | ["investigate","root cause","find out why","dig into this bug","/investigate"] |
| context_files | ["context/project.md","context/learnings.md"] |
| steps | [{"name":"Gather","description":"Read affected code, check recent git log, reproduce the bug deterministically, state the symptom precisely"},{"name":"Analyze","description":"Match against known bug patterns — race condition, nil propagation, state corruption, integration failure, config drift, stale cache"},{"name":"Hypothesize","description":"Rank by likelihood, confirm each with evidence; circuit-break after 3 failed hypotheses"},{"name":"Implement","description":"Fix only the confirmed root cause, minimize diff, write a regression test"},{"name":"Verify","description":"Reproduce original scenario, run full test suite, report with status verdict"}] |
A structured five-phase root-cause debugging protocol. No fix is applied until the root cause is confirmed with evidence. Think of it as a controlled demolition: you do not swing the wrecking ball until you know exactly which wall to hit.
Without a structured protocol, debugging becomes symptom-chasing. A timeout gets wrapped in a retry loop. A nil pointer gets a nil check. The behavior stops manifesting, but the cause is still there, waiting for the next context to trigger it.
The other failure mode is hypothesis overload: generating six possible causes, trying one, giving up, trying another, losing track of what was tested. Three failed hypotheses with no circuit breaker become ten, and ten become a refactor of the wrong system.
This skill enforces gather-before-hypothesize, evidence-before-fix, and a hard stop after three failures.
Before forming any hypothesis:
git log -10 --oneline to surface recent changes in the areaDo not move to Phase 2 until you can reproduce the bug or have a documented reason why reproduction is not possible.
Map the symptom against known bug pattern categories. List every candidate, do not filter yet:
| Pattern | What to look for |
|---|---|
| Race condition | Concurrent access to shared state, missing locks, async ordering assumptions |
| Nil/null propagation | Value expected to exist, flows through multiple layers before crash |
| State corruption | Object modified by multiple code paths, invariants violated |
| Integration failure | External service behavior changed, API contract drift, timeout assumptions |
| Configuration drift | Works in one environment, fails in another; env vars, feature flags |
| Stale cache | Cached value no longer valid, cache invalidation missing or incorrect |
Rank the candidates from Phase 2 by likelihood. For each, state what evidence would confirm or refute it: a failing test, a specific log line, a traced execution path.
Test them in order. For each:
Circuit breaker: If three hypotheses fail, stop. Do not continue guessing. The root cause is deeper than the initial analysis reached. Options at this point:
Before Phase 3, run:
git shortlog -sn --since="90 days ago" --no-merges HEAD | head -5
If the top author has 80% or more of commits: solo mode: investigate issues discovered outside the current task scope and offer to fix them.
If below 80%: collaborative mode: flag out-of-scope issues via AskUserQuestion and move on. Do not fix them unilaterally.
Only after the root cause is confirmed with evidence:
Report:
Symptom: [what the user observed]
Root cause: [file:line: what was actually wrong]
Fix: [what changed and why]
Regression test: [test name and result]
Status: DONE | DONE_WITH_CONCERNS | BLOCKED
DONE_WITH_CONCERNS: fix is applied but something warrants follow-up (e.g., related fragility found, test coverage gaps). BLOCKED: root cause not confirmed; three hypotheses exhausted; escalation required.
Do not form hypotheses before reproducing the bug. A hypothesis about an unreproducible bug is speculation, not investigation.
Do not fix the symptom. A nil check on a value that should never be nil masks the real failure. Find out why it is nil.
Do not continue past three failed hypotheses. More guessing from a bad prior compounds the error. Stop and reframe.
Do not expand the fix scope. Once the root cause is confirmed, the fix should be surgical. "While I'm in here" additions belong in a separate task.