Install
openclaw skills install @dennisrongo/diagnoseDisciplined diagnosis loop for hard bugs and performance regressions. Reproduce → minimise → hypothesise → instrument → fix → regression-test. On non-trivial cases, Phase 3 spawns parallel Explore sub-agents — each defending a distinct hypothesis with falsifiable predictions and file:line evidence — then a cross-examination round drops the ones whose defender couldn't find support, breaking the single-chain anchoring trap. Trivial bugs skip the council. Use this skill whenever the user says "diagnose this", "debug this", "/diagnose", reports a bug, says something is broken / throwing / failing / flaky / hanging / leaking, or describes a performance regression — even if they don't explicitly ask for a "diagnose skill".
openclaw skills install @dennisrongo/diagnoseA discipline for hard bugs. Skip phases only when explicitly justified.
When exploring the codebase, use the project's domain glossary to get a clear mental model of the relevant modules, and check ADRs in the area you're touching.
/diagnose or types "diagnose this" / "debug this".Do not use this skill for: tiny known-cause one-line fixes, typos, or questions about how code works when nothing is actually wrong.
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:
A 30-second flaky loop is barely better than no loop. A 2-second deterministic loop is a debugging superpower.
The goal is not a clean repro but a higher reproduction rate. Loop the trigger 100×, parallelise, add stress, narrow timing windows, inject sleeps. A 50%-flake bug is debuggable; 1% is not — keep raising the rate until it's debuggable.
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 file, log dump, core dump, screen 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:
Quote error text verbatim — never paraphrase. The load-bearing token is usually the exact column name, status code, or line number, and paraphrase loses it. The difference between what the error says and what you remember it saying is where diagnosis dies.
NullReferenceException at BillingService.cs:84 in HandleSubscriptionEvent — the :84 is what distinguishes hypothesis 2 from hypothesis 4.Do not proceed until you reproduce the bug.
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 is the cause, then will make the bug disappear / will make it worse."
If you cannot state the prediction, the hypothesis is a vibe — discard or sharpen it.
Evidence gate. A claim about code you haven't opened this session is a hypothesis, not evidence. Cite file:line only for lines you actually read; "X is never called" only after you grepped for callers. Label everything else as unverified.
Exotic hypotheses (framework bug, compiler bug, race condition) are almost always wrong. Before ranking any of them above a boring cause, eliminate the boring ones — each is a 30-second check:
git branch, the connection string, the env vars actually loaded.git diff).When the behavior makes no sense, you are looking at the wrong code, the wrong process, or the wrong environment — not at an exotic bug.
Compare against a working sibling. Before theorising, find the nearest thing that works — a sibling endpoint, the same pattern in another module, the reference implementation of the library call — and list every difference between it and the broken path, however small. Read the working example completely, don't skim it; the difference you dismissed as "can't matter" is the usual culprit. Each difference is a ready-made hypothesis with a built-in falsification (make the broken path match → does the bug vanish?).
The user's diagnosis is hypothesis #1, not the conclusion. If the user says "it's probably the cache layer" or "should be a quick fix", rank it, state its falsifiable prediction, and test it like the others. Never skip falsification because the user sounded sure — confident framing is not evidence.
Agent calls (one per seed) using subagent_type=Explore. Each defender gets:
file:line for every piece of supporting evidence. If you cannot find supporting evidence in the code, say so explicitly — do not invent. Report in ≤300 words."file:line evidence + sharp predictions.The point isn't "vote by sub-agent." It's that forcing each angle to be developed independently against the real code prevents the chain-of-thought from anchoring on the first plausible idea.
Show the ranked list to the user before testing. They often have domain knowledge that re-ranks instantly ("we just deployed a change to #3"), or know hypotheses they've already ruled out. Cheap checkpoint, big time saver. Don't block on it — proceed with your ranking if the user is AFK.
Include, per hypothesis: the falsifiable prediction, 1–2 lines of evidence with file:line, and the falsifying check Phase 4 will run.
Each probe must map to a specific prediction from Phase 3. 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.
Library-API bugs — check current docs before guessing. If the hypothesis points at a third-party library's behaviour (a framework method, an ORM call, an SDK), look up the library's current docs before instrumenting around assumed behaviour. Use context7 (or any docs-MCP server available in the environment): context7__resolve-library-id → context7__query-docs for the specific symbol. Training-data API knowledge can be a version behind; the bug may be a known issue or already-fixed-upstream. Skip for refactoring own code, general programming concepts, or library behaviour you've already confirmed in this session.
Multi-component systems — bisect by boundary first. When the path crosses layers (CI → build → signing; client → API → service → DB; workflow → env → script), don't hypothesise about the logic inside any one layer until you know which layer breaks. Log what enters and exits each boundary (payload shape, env/config values as SET/UNSET, state) in one run, then read the trail to find the first boundary where reality diverges from expectation. That layer gets the hypotheses; the others are exonerated by evidence, not by assumption.
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.
When a probe command fails: read the full error output — don't skim it. Change exactly one thing based on what it says, retry once. Two failures on the same probe = stop and report; never retry verbatim, never proceed as if it ran, never report an observation you didn't see.
Stop-digging rule. After ~3 probe cycles that neither confirm nor falsify the leading hypothesis, stop probing it. Go back to Phase 3 with the evidence gathered so far and re-rank — probes that keep coming back ambiguous usually mean the hypothesis is wrong, not that it needs one more probe. Tunneling on hypothesis #1 is the failure mode this rule breaks.
The accepted hypothesis must explain EVERY observed symptom. A hypothesis that explains 2 of 3 symptoms is a different bug or an incomplete cause. Before writing the fix, walk the symptom list from Phase 2 and check each one off against the hypothesis — an unexplained symptom means back to Phase 3, not "probably unrelated".
One fix, scoped to the cause. Address the root cause identified — one change, no bundled refactoring, no "while I'm here" improvements (those go in the post-mortem as follow-ups). If the fix doesn't hold: count. Under three attempts → back to Phase 3 with the new evidence, never a fourth fix stacked on the first three. Three failed fixes is not a failed hypothesis — it's a wrong architecture. Each fix revealing new coupling in a different place, or needing a "massive refactor" to land, means the pattern itself is unsound: stop, say so, and raise it with the user (or hand off to improve-codebase-architecture) before attempting fix #4.
Minimal comments. Default to no comments in the fix or the regression test. Add one only when the why is non-obvious — a workaround for a specific upstream bug (with a link), a subtle invariant the code relies on, a domain rule that isn't visible from the names. Never write block headers, never restate what the next line does, never leave // TODO without an issue link. One short line max — no multi-line comment blocks. Names carry the what; comments earn their place only when they carry why.
Write the regression test before the fix — but only if 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 (single-caller test when the bug needs multiple callers, unit test that can't replicate the chain that triggered the bug), a regression test there gives false confidence.
If no correct seam exists, that itself is the finding. Note it. The codebase architecture is preventing the bug from being locked down. Flag this for the next phase.
If a correct seam exists:
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), surface it as a follow-up recommendation with specifics. Two cheap hardening moves worth naming when they apply: defense in depth — once the root cause is known, add validation at the boundary where the bad value entered, not only where it crashed, so the next bad input fails loudly and early; and condition-based waiting — if the bug involved timing, replace any arbitrary sleep/timeout with polling for the actual condition (event fired, file exists, state reached), which removes the flake class rather than widening the window. Make the recommendation after the fix is in, not before — you have more information now than when you started.
file:line for code never opened this session, or asserting "never called" without grepping.diagnose skill — same six-phase discipline (reproduce → minimise → hypothesise → instrument → fix → regression-test). Architectural findings hand off to improve-codebase-architecture.