debug-runtime
Use if chasing a reproducible runtime bug or repeated failed fixes with a 4-phase root-cause pass.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use if chasing a reproducible runtime bug or repeated failed fixes with a 4-phase root-cause pass.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use skill if you are exhaustively testing or release-gating martool CLI commands in a source checkout or deployed Coolify container over SSH, without local Docker or provider spend.
Use if driving agent-browser for Chrome/CDP automation, @ref snapshots, tabs, or verification.
Use if testing or debugging an iOS app via agent-device CLI — simulator flows, evidence, bug triage.
Use if supervising Jean agents through MCP and Computer Use for monitoring, recovery, or closure.
Use if auditing or designing a CLI for agent/LLM use — JSON output, exit codes, non-interactive.
Use if auditing or designing an MCP server for agent-readiness — framework, security, context.
| name | debug-runtime |
| description | Use if chasing a reproducible runtime bug or repeated failed fixes with a 4-phase root-cause pass. |
Language-agnostic systematic debugging. Four mandatory phases before any fix: Investigation → Pattern analysis → Hypothesis testing → Implementation. Works on any runtime, any language. Hands off to a structured user-driven reframe pause after three failed fixes.
Use when one of these is true:
Do NOT use this skill when:
audit-completionBoundary with a structured reframe pause: three failed fixes routes here to a structured user-driven reframe pause with the handoff template. After a structured reframe pause returns, re-enter debug-runtime at Phase 2 with the new framing — never Phase 1.
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.
An untested fix is a guess dressed as work. A guess that appears to succeed is the worst case — it masks the real mechanism, which returns later as a different symptom.
| Phase | Goal | Exit gate |
|---|---|---|
| 1 — Investigation | Define and reproduce the failure | Symptom card + 10/10 repro + copy-pasteable evidence |
| 2 — Pattern analysis | Identify candidate mechanisms | 1–3 ranked candidates with evidence per row |
| 3 — Hypothesis testing | Confirm one mechanism by falsification | One candidate confirmed by an experiment that could have failed |
| 4 — Implementation | Apply the narrowest fix and verify | Phase 1 repro passes 10/10 + regression guard committed |
Goal: state the failure precisely, reproduce it deterministically, capture evidence a stranger could read.
references/bisection-strategies.md for input-space bisection before continuing.Red flags → restart this phase: "it happens sometimes" (repro not 10/10); "some config mismatch" (no concrete values); "the code looks wrong" (guessing, not observing).
Goal: 1–3 candidate mechanisms, each evidence-backed.
references/root-cause-tracing.md — walk from the symptom frame to the earliest frame where state was still correct.Red flags → back to Phase 1: evidence gap appears (missing log/trace/value); only one candidate is possible (force a second — single-candidate is over-commitment).
Goal: prove or disprove one candidate with an experiment designed to fail if the hypothesis is wrong.
references/instrumentation.md, references/bisection-strategies.md.Red flags → back to Phase 2: the "confirmation" also fits a different mechanism (experiment was not falsifying); product code changed mid-experiment; partial confirmation accepted "because it kind of matched."
Goal: narrowest fix that restores the broken assumption, verified, with a regression guard.
references/defense-in-depth.md to pick the layer (entry / logic / env guard / instrumentation).sleep(n) patterns using references/condition-based-waiting.md.audit-completion — verify nothing else in scope was broken. See references/integration.md for the handoff format.Red flags → back to Phase 3: the repro still fails (hypothesis was wrong, not just the fix); the regression guard passes without the fix (guard does not test the mechanism); new symptoms appear (blast radius widened).
First-class routing table — consult when a phase goes sideways.
| Situation | Stay or route | Destination | Why |
|---|---|---|---|
| Phase 1: repro is not 10/10, need wider frame | Stay | references/bisection-strategies.md (input-space bisection) | Inline technique |
| Phase 2: only "it feels like X" as evidence | Route | a structured reframe pause (workflows/bug-tracing.md) | Stronger reasoning loop re-grounds the investigation |
| Phase 3: 2–3 candidates look equally plausible | Route | a structured reframe pause foundations / evidence-and-falsification | Stronger evidence framework before the experiment |
| Phase 3: "confirmation" also fits a different mechanism | Stay | Back to Phase 2; design the distinguishing test | Do not hand off |
| Fail #1 (first fix didn't stick) | Stay | Re-open Phase 2 inline | Pattern was wrong |
| Fail #2 (second fix didn't stick) | Stay | Re-open Phase 1 inline | Symptom or repro was incomplete |
| Fail #3 — stop fixing | Route | a structured user-driven reframe pause; template in references/integration.md | Architecture-shaped; re-enter Phase 2 after return |
| Phase 4: fix applied, verification passed | Route | audit-completion | Audit for related-but-forgotten scope |
| "Bug" is a design disagreement, not a bug | Don't start | a structured reframe pause | Not a runtime failure |
| No way to run code (env/repo missing) | Don't start | Ask user for a repro, or exit | Phase 1 cannot complete |
Full decision tree with edge cases: references/integration.md.
A "failed fix" = a hypothesis-driven change that did not make Phase 1's repro pass, OR made it pass but introduced a regression. Compilation errors unrelated to the hypothesis do not count.
references/escalation.md and references/integration.md. After a structured reframe pause returns, re-enter at Phase 2 with the new framing.The rule is load-bearing under pressure. Verbatim excuses agents generate to skip it: references/rationalizations.md.
Full set + pressure-scenario sidebars: references/rationalizations.md.
| Rationalization | Counter |
|---|---|
| "Just try this fix and see." | "See" = evidence. Write the falsification prediction before editing. |
| "The senior engineer already diagnosed it." | Their Phase 1 is not yours. Reproduce and read the evidence yourself. |
| "Sunk cost — 4 hours in, can't restart." | The 4 hours are evidence the current path is dead. Restart Phase 1. |
| "We don't have time for root cause — production is down." | Cost of a blind fix that regresses = cost of the outage × 2. |
| "The tests pass now, so it's fixed." | Passing tests without a regression guard prove nothing durable. Add the guard. |
| "I see the issue." (no mechanism stated) | Say the mechanism out loud, or the mechanism has not been seen. |
| "This is an emergency — rules off." | Rules are especially on under pressure. Emergencies multiply the cost of skipping. |
Full list: references/voice.md.
Forbidden phrases: "probably just a quick fix" / "let me just try" / "I know what this is" (without a named mechanism) / "this feels like last time".
Required forms: "Phase 1 symptom card: …" / "Phase 2 candidates: …" / "Phase 3 falsification prediction: …" / "Verification result: …".
| File | Read when |
|---|---|
scripts/find-polluter.md | Test-pollution bisection — documents scripts/find-polluter.sh usage, runner selectors, caveats, expected output |
| File | Read when |
|---|---|
references/workflow-deep.md | The phase block here is too thin — need long worked examples (Node test pollution, Python race, Rust lifetime) |
references/root-cause-tracing.md | Phase 2 — walk backward from symptom frame to earliest-correct-state frame |
references/condition-based-waiting.md | Replace sleep(n) with polling-with-timeout; routes to references/waiting/<lang>.md |
references/defense-in-depth.md | Phase 4 — choose which layer (entry / logic / env guard / instrumentation) the fix belongs at |
references/bisection-strategies.md | "Fails in CI only" / "worked last week" / "only with feature X" / intermittent without code change |
references/instrumentation.md | Phase 2–3 — print/log/stack-trace patterns per language |
references/escalation.md | Any failed fix — 3-fails protocol, pressure sidebars, handoff format |
references/integration.md | Unsure whether to stay in-skill or route to a structured reframe pause / audit-completion |
references/rationalizations.md | The urge to skip Phase 1 or Phase 3 — counter table + 5 pressure scenarios |
references/voice.md | Writing progress updates — forbidden phrases and required forms |
references/cross-runtime.md | Running on a non-Claude runtime — ask-user-tool lookup for the 3-fails handoff |
| File | Language / framework |
|---|---|
references/waiting/typescript.md | Jest / Vitest |
references/waiting/python.md | pytest + asyncio |
references/waiting/rust.md | tokio + cancellation tokens |
references/waiting/go.md | stdlib testing.T polling |
references/waiting/swift.md | XCTest + async/await |
references/waiting/ruby.md | RSpec + timeout gems |
references/waiting/java.md | JUnit 5 + awaitility |
| File | Scenario |
|---|---|
references/pressure-tests/academic.md | Calm baseline — method works without pressure |
references/pressure-tests/pressure-financial.md | $15k/min outage — time pressure vs. Iron Law |
references/pressure-tests/pressure-sunk-cost.md | 4 hours in — restart vs. one-more-try |
references/pressure-tests/pressure-authority.md | Senior engineer says X — verify independently or defer |
Before declaring a bug fixed, produce these artifacts in order. Do not batch them to the end — each must be visible in the session transcript.
Root cause: <frame / boundary / layer> — <violated assumption>
Mechanism: <X caused Y because Z>
Narrowest fix location: <file/function/layer>
audit-completion handoff, or "close and ship"| Do this | Not that |
|---|---|
| Reproduce 10/10 before theorizing | Form a hypothesis, then try to reproduce |
| Phases 1–3 are read-only on product code | Edit product code while "investigating" |
| Write the false-case prediction before running the experiment | Decide what "confirms" the hypothesis after running |
| Cite a trace/log/diff/test/config for every claim | "It seems like…" / "I think it's…" |
| Fail #1–#2 → re-open prior phases; Fail #3 → route to a structured reframe pause (Interactive) | Try fix #4, #5, #6 |
| Add a regression guard before declaring done | "The tests pass, shipping" |
| Treat the senior's diagnosis as a candidate, not a verdict | Skip Phase 1 because "they already figured it out" |
debug-runtime as the next step (no infinite regress). State which phase to re-enter.Recovery moves:
references/bisection-strategies.md); do not proceed with a flaky repro.references/integration.md; do not retry.Before declaring done, confirm:
audit-completion (or explicit "close and ship")