Build a deterministic feedback loop that reproduces the user's exact symptom before forming a diagnosis, then minimize the reproduction and test falsifiable hypotheses. Add a regression test at the right interface before applying the smallest fix, and verify the original failure and broader checks afterward. The guidance also covers redacting sensitive data, removing temporary artifacts, and reporting blockers.
Use this workflow for bugs, flaky failures, and performance regressions. The central rule is simple: do not start with a theory. First build a feedback loop that can go red on the user's actual symptom.
Use when:
Do not claim a diagnosis from code inspection alone when the symptom has not been reproduced or captured.
Redact secrets from commands, logs, screenshots, traces, and environment output before showing or storing them. Read the relevant project instructions, glossary, ADRs, issue, and recent changes. Record the exact user-visible symptom, not a nearby error.
Prefer the smallest unattended command that exercises the real path and asserts the symptom:
Tighten the loop: cache setup, narrow assertions to the exact symptom, pin time and randomness, isolate the filesystem, and remove unnecessary network work. A slow or flaky loop is not a sufficient feedback loop until it is made deterministic or its reproduction rate is high enough to debug.
If no red-capable loop can be built, stop and report what was tried. Ask for a redacted trace, log, HAR, core dump, screen recording with timestamps, or access to the reproducing environment rather than guessing.
Run the loop and confirm it fails for the reported reason. For intermittent bugs, repeat or stress the trigger until its reproduction rate is useful. Minimize one input, caller, configuration, or step at a time; keep only elements that are load-bearing for the failure.
Completion condition: removing any remaining element makes the loop pass.
Write 3–5 ranked hypotheses. Each must predict an observable result:
If
<cause>is responsible, changing<variable>should make the symptom disappear or become worse.
Show the ranked list to the user before testing so they can supply domain evidence or identify hypotheses already ruled out. This is not an approval gate: proceed with the ranking while the user is unavailable.
Probe one prediction at a time. Prefer a debugger or REPL, then targeted logs at boundaries that distinguish hypotheses. Tag temporary logs with a unique prefix such as [DEBUG-1234] so cleanup is mechanical. For performance issues, measure a baseline and use a profiler or timing harness instead of logging everything.
If two attempted fixes share an assumption and fail the same check, pause before a third variation. State the shared assumption in one sentence and test it against the reproduction. For state or resource imbalances, trace which actors create, own, update, and release the resource. Change ownership only when the evidence supports it; a guard that merely hides the crash is not a root-cause fix. Update the ranked hypotheses from the result.
When a correct seam exists:
Do not add a shallow test that cannot reproduce the call chain or interaction that caused the bug. If no correct seam exists, document that architectural gap and make it a follow-up improvement rather than claiming strong regression coverage.
Before declaring the bug fixed:
grep the debug prefix).The repeated-fix checkpoint is adapted from Robert C. Martin's
ub-mode — Attack the Premise and Fix Root Causes.
jellydn/my-ai-tools
1524f4a
grepcurlAlso appears in
since Nov 30, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.