skills/debug-fix/SKILL.md
Disciplined debug loop: build feedback loop → reproduce → ranked hypotheses → instrument → fix + regression test → cleanup. Use for bugs, failures, and performance regressions.
npx skillsauth add roborew/opencode debug-fixInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
A discipline for hard bugs. Skip phases only when explicitly justified.
When exploring the codebase, use the project's domain glossary (CONTEXT.md / CONTEXT-MAP.md) and check docs/adr/ in the area you're touching.
This is the skill. Everything else is mechanical. If you have a fast, deterministic, agent-runnable pass/fail signal for the bug, you will find the cause — bisection, hypothesis-testing, and instrumentation all just consume that signal. If you don't have one, no amount of staring at code will save you.
Spend disproportionate effort here. Be aggressive. Be creative. Refuse to give up.
git bisect run it.Build the right feedback loop, and the bug is 90% fixed.
Treat the loop as a product. Once you have a loop, ask:
The goal is not a clean repro but a higher reproduction rate. Loop the trigger many times, parallelise, add stress, narrow timing windows, inject sleeps. A high-flake bug is debuggable; 1% is not — keep raising the rate until it is.
Stop and say so explicitly. List what you tried. Ask the user for: (a) access to whatever environment reproduces it, (b) a captured artifact (HAR, log dump, core dump, recording with timestamps), or (c) permission to add temporary production instrumentation. Do not proceed to hypothesise without a loop.
Do not proceed to Phase 2 until you have a loop you believe in.
Run the loop. Watch the bug appear.
Confirm:
Do not proceed until you reproduce the bug.
When the bug is a regression, use git log --oneline -- path, git log -S'symbol' -- path, and blame. Use git bisect only if the user approves the time cost.
Generate 3–5 ranked hypotheses before testing any of them. Single-hypothesis generation anchors on the first plausible idea.
Each hypothesis must be falsifiable: state the prediction it makes.
Format: "If
<cause>is the cause, then<probe>will make the bug disappear / will make it worse."
If you cannot state the prediction, the hypothesis is a vibe — discard or sharpen it.
Show the ranked list to the user before testing. They often have domain knowledge that re-ranks instantly. Don't block on it — proceed with your ranking if the user is AFK.
Each probe must map to a specific prediction from Phase 4. Change one variable at a time.
Tool preference:
Tag every debug log with a unique prefix, e.g. [DEBUG-a4f2]. Cleanup at the end becomes a single grep. Untagged logs survive; tagged logs die.
Perf branch. For performance regressions, logs are usually wrong. Instead: establish a baseline measurement (timing harness, performance.now(), profiler, query plan), then bisect. Measure first, fix second.
Root cause — one paragraph; cite files/lines.
Fix — smallest change.
Regression test — write before the fix when there is a correct seam for it.
A correct seam is one where the test exercises the real bug pattern as it occurs at the call site. If the only available seam is too shallow, a regression test there gives false confidence.
If no correct seam exists, that itself is the finding. Note it. Flag that the architecture is preventing the bug from being locked down.
If a correct seam exists:
Run targeted tests / the Phase 1 loop. Confirm the user's symptom is gone.
Required before declaring done:
[DEBUG-...] instrumentation removed (grep the prefix)Then ask: what would have prevented this bug? If the answer involves architectural change (no good test seam, tangled callers, hidden coupling), recommend a follow-up to the parent / refactor path with specifics. Make the recommendation after the fix is in, not before — you have more information now than when you started.
When the parent is architect on a debug/targeted-change path, do not write .plan/debug.*. Instead:
to-issues — one or more GitHub issues with acceptance criteria and test commands.state:ready-for-agent, parent architect emits the execution handoff (feature or queue variant).Execution happens from the GitHub queue, not a local plan file.
tools
AI-powered code review using CodeRabbit CLI. Use only on explicit user request or when parent passes execution_mode orchestrate_coderabbit_gate. Do not run during orchestrated stage/issue work.
tools
Cross-repo companion to to-prd: after PRD frontmatter is filled, run bin/fanout <slug> from this spec repo to create child GitHub issues (one per ticket or legacy slice).
tools
Issue state machine — transition GitHub issue labels per docs/agents/triage-labels.md. Batch helpers via lib/triage.sh.
documentation
Synthesise a PRD from grill-me / research context, write docs/prd/<slug>.md, publish a GitHub issue with prd + state:ready-for-agent + feature:<slug>. Halt after publish — do not invoke fanout.