A discipline for oracle reds. Phases run in order; skip one only with explicit justification. **Second failure of the same shape: stop** and re-read the spec plus `docs/10-failure-modes.md` before the next command (two-strike rule, R4).
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Diagnosing Bugs?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/climashscape-diagnosing-bugs)
<!-- Adapted from mattpocock/skills (MIT), path skills/engineering/diagnosing-bugs, retrieved 2026-10-09 -->
---
name: diagnosing-bugs
description: Diagnosis loop for parity failures — golden-master diffs, corpus misdecodes, pixel gate misses, budget regressions. Use when an oracle goes red, a cleanroom comparison fails, or the user says "diagnose" / "debug this" or reports something decoding/rendering/performing wrong.
---
# Diagnosing parity failures
A discipline for oracle reds. Phases run in order; skip one only with
explicit justification. **Second failure of the same shape: stop** and
re-read the spec plus `docs/10-failure-modes.md` before the next
command (two-strike rule, R4).
## Redact and screen
Show commands and outputs, but quote only the lines that carry the
signal. Never paste reference-owned artifacts (installers, binaries,
decompiled text) into logs or reports; describe observed behavior in
your own words (R1, failure #10).
## Phase 1: the oracle is the feedback loop
You usually already have the loop: the failing comparison. Your job is
to make it **tight** — one command that goes red on _this_ mismatch.
No red-capable command, no theorizing: reading code to build a
hypothesis first is the exact failure this skill prevents.
Completion criterion — you can name **one command you have already
run** (show the red output), and it is:
- [ ] **Red-capable**: drives the exact behavior and asserts the
recorded symptom (one golden case, one corpus file, one frame),
not "the suite failed".
- [ ] **Deterministic**: same verdict every run (pins via
`tools/corpus.py`; seed, locale, and time pinned).
- [ ] **Fast**: seconds — narrowed to the failing subset.
- [ ] **Agent-runnable**: e.g.
`python tools/golden_master.py compare --runner <impl runner> --recordings <dir>`.
## Phase 2: Reproduce + minimise
Confirm the red matches the recorded symptom, not a nearby failure.
Then shrink the input one element at a time — drop layers, fields,
frames — re-running the loop after each cut. Done when every remaining
element is load-bearing. The minimal repro becomes the regression
oracle in Phase 5.
## Phase 3: Hypothesise
Generate **3–5 ranked, falsifiable hypotheses** before testing any:
"If X is the cause, changing Y makes the diff disappear." A hypothesis
without a stated prediction is a vibe; discard it. Show the ranked
list to the user before probing; proceed with your ranking if they are
away.
## Phase 4: Instrument
One variable at a time, each probe tied to one prediction. Prefer diff
artifacts over logs: byte diff of golden vs output, first divergent
offset in a hex dump, `tools/pixel_diff.py a.png b.png --diff-out
diff.png`. Performance regressions: measure first with
`tools/ratchet.py` budgets (baseline, then bisect); never log-and-guess.
## Phase 5: Fix + raise the floor
Pin the minimal repro as a corpus case or golden **before** fixing;
never edit an existing golden to pass (oracle erosion, failure #4).
Then: watch it red → fix from the spec → watch it green → re-run the
full corpus and all goldens (the un-minimised scenario). On pass, lock
the gain: `python tools/inventory_parity.py floor ...`.
## Phase 6: Cleanup
- [ ] Full oracle suite green; floor raised, not just restored
- [ ] Debug instrumentation and throwaway harnesses removed
- [ ] Devlog entry: symptom, confirmed hypothesis, numbers, still open
- [ ] Confirmed hypothesis stated in the commit message
- [ ] No golden or budget edits without a recorded spec decision
## References
- Oracle table and ratchet semantics: `docs/05-verification.md`
- Failure catalogue rows 3, 4, 14: `docs/10-failure-modes.md`
- Tool usage: `tools/README.md`
- Gates G3/G4 and override rules:
[integrations/skills/cleanroom-reimplementation](../cleanroom-reimplementation/SKILL.md)