Files
holocron/plugins/bin/skills/diagnose
Defame1297 af8b46cd57 chore(plugins): sync generated content mirrors
Regenerate plugins/*/skills/ from plugins/*/.apm/ after the previous
four commits, via scripts/sync-plugin-content.sh --all. The mirror is
generated output (ADR-0017) that check-plugin-content-sync's pre-push
hook diffs against .apm/; nothing here is hand-edited.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EeH8SCbcrCAQrtymkNuhKP
2026-09-07 20:43:51 +00:00
..

diagnose

A six-phase discipline for hard bugs and performance regressions: feedback loop → reproduce → hypothesise → instrument → fix with a regression test → clean up.

What it does

Imposes an order of operations on debugging so the agent cannot skip to guessing. The load-bearing phase is the first one: build a fast, deterministic, agent-runnable pass/fail signal for the bug. Everything downstream — bisection, hypothesis testing, instrumentation — just consumes that signal, so the skill refuses to advance to Phase 2 without one, and says so explicitly rather than hypothesising blind.

The remaining phases each carry a constraint worth knowing about: hypotheses are generated 3–5 at a time and must be falsifiable, so the first plausible idea cannot anchor the whole investigation; every debug log is tagged with a unique prefix ([DEBUG-a4f2]) so cleanup is a single grep; the regression test is written before the fix and only at a seam that exercises the real bug pattern; and the run closes by asking what would have prevented the bug, handing off to improve-codebase-architecture when the answer is architectural.

Performance regressions take a branch of their own inside Phase 4 — baseline measurement and bisection, not logs.

Conditional reading

Neither reference file is read on every run; SKILL.md names the condition for each.

  • references/feedback-loops.md is read when Phase 1 has no signal yet, or when the loop you have is slow or intermittent.
  • references/regression-seams.md is read when Phase 5 leaves you unsure whether the available seam is deep enough — or whether one exists at all.

Usage

/diagnose

Describe the bug or the regression. For filing and triaging a reported bug rather than diagnosing it, use triage; for test-first feature work, use tdd.

Files

File Purpose
SKILL.md The six phases and their gates — what must be true before each one ends
references/feedback-loops.md Loaded when Phase 1 has no loop or the loop is too weak: ten ways to construct one ordered by cost, how to sharpen an existing loop, handling intermittent bugs, and what to ask the user for when the bug resists reproduction
references/regression-seams.md Loaded when Phase 5 is unsure about the seam: what makes a seam correct, the four shapes of a too-shallow seam, and what to do when no correct seam exists
assets/hitl-loop.template.sh Copy-and-edit bash template for the last-resort human-in-the-loop feedback loop, cited by references/feedback-loops.md. Provides step and capture helpers and prints captured values as KEY=VALUE for the agent to parse