Skip to content
Development
Skill

/diagnose

Turn a bug symptom into a fix with a regression test that locks it down. If the user opens vague ("there's a bug", "/diagnose"), interview them one question at a time until you have enough to attempt a reproduction; if you still cannot reproduce, say so explicitly. Then drive

From plugin
sdd-pipeline
156 skills1 hook

Claude Code

$ npx -y skills add eduwxyz/my-awesome-skills --skill diagnose --agent claude-code

SKILL.md

diagnose.SKILL.md
name: diagnose
description: Turn a bug symptom into a fix with a regression test that locks it down. If the user opens vague ("there's a bug", "/diagnose"), interview them one question at a time until you have enough to attempt a reproduction; if you still cannot reproduce, say so explicitly. Then drive the work through five phases — build a deterministic feedback loop, reproduce, hypothesise, probe, write a spec — and hand off to TDD for the regression test. Trigger when the user reports something broken, slow, wrong, or regressed: "X is failing", "this throws", "something regressed", "diagnose this", "debug this", "investigate why...".

Diagnose

Symptom in, fix-with-regression-test out. An interview if the user opens vague, then five phases, two cardinal rules.

Skip diagnose for

One-line obvious fixes (typo, missing import, off-by-one in a test you just wrote). "Bugs" that are actually missing functionality — that's a feature, use `interview-to-spec`. Flaky tests caused by infrastructure (CI, network) rather than code under test.

Two rules that keep diagnosis honest

1. **No loop, no Phase 2+.** If you cannot reproduce the bug deterministically, you cannot hypothesise — you'll just guess. 2. **One variable at a time during probing.** Changing two things at once tells you nothing about either.

If either slips, back up.

Phase 0 — Understand the bug

Before building a loop, you need to know what you're trying to reproduce. **If the user opened with detail covering the points below, skip this phase.** If they opened vague ("there's a bug", "X is broken", or just `/diagnose`), interview them.

Ask **one question at a time**. Stop the moment you have enough to attempt Phase 1 — do not gather more than you need.

The minimum set you're trying to fill:

  • **Expected vs. actual.** What should have happened? What actually happened?
  • **Trigger.** What were they doing when it happened? Can they make it happen again on demand, or is it intermittent?
  • **Recency.** Did this used to work? When did it start failing? What changed recently (deploy, dependency, data, config)?
  • **Environment.** Where? (prod / staging / local; specific browser, OS, account, dataset.)
  • **Evidence.** Any error message, stack trace, log line, screenshot, or HAR they can paste?

If the answer to a question is in the codebase rather than in the user's head, **read the code instead of asking**.

When the answers converge, propose a short slug for the bug (e.g. `token-expiry-not-rejected`). This is the filename for the spec written in Phase 5. Then move to Phase 1.

If after the interview the user still cannot give you enough to reproduce, that is itself a Phase 1 outcome — go to Phase 1 and follow **When you genuinely cannot build a loop**.

Phase 1 — Build the feedback loop

**This is the skill.** Everything downstream is mechanical once you have a fast, deterministic, agent-runnable pass/fail signal for the bug. Without one, no amount of staring at code finds the cause.

Spend disproportionate effort here. Be aggressive. Refuse to give up.

Ways to build one — try in roughly this order

1. **Failing test** at whatever seam reaches the bug — unit, integration, e2e. 2. **Curl / HTTP script** against a running dev server. 3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot. 4. **Headless browser** (Playwright / Puppeteer) — drives the UI, asserts on DOM/console/network. 5. **Replay a captured trace.** Save a real request/payload/event log to disk; replay it through the code path in isolation. 6. **Throwaway harness.** A minimal subset of the system that exercises the bug code path with one function call. 7. **Property / fuzz loop.** For "sometimes wrong output", run 1000 random inputs and look for the failure mode. 8. **Bisection harness.** If the bug appeared between two known states (commit, dataset, version), automate "boot at state X, check, repeat" so `git bisect run` works. 9. **Differential loop.** Run the same input through old vs new (or two configs) and diff outputs. 10. **HITL bash script.** Last resort. If a human must click, drive them with a structured loop and capture output back to you.

Iterate on the loop itself

Treat the loop as a product. Once you have *a* loop, ask:

  • **Faster?** Cache setup, skip unrelated init, narrow scope.
  • **Sharper signal?** Assert on the specific symptom, not "didn't crash".
  • **More deterministic?** Pin time, seed RNG, isolate filesystem, freeze network.

A 30-second flaky loop is barely a loop. A 2-second deterministic loop is a debugging superpower.

Non-deterministic bugs

Goal isn't a clean repro — it's a *higher reproduction rate*. Loop the trigger 100×, parallelise, narrow timing windows, inject sleeps. A 50%-flake bug is debuggable; 1% is not — keep raising the rate until it is.

When you genuinely cannot build a loop

Stop and say so explicitly. List what you tried. Ask the user for one of:

  • Access to an environment that reproduces it.
  • A captured artifact (HAR file, log dump, core dump, screen recording with timestamps).
  • Permission to add temporary production instrumentation.

Do **not** proceed to Phase 3 without a loop.

Phase 2 — Reproduce

Run the loop. Watch the bug appear. Confirm:

  • The loop produces the failure mode the **user** described — not a different failure that happens to be nearby. Wrong bug = wrong fix.
  • The failure is reproducible across multiple runs (or, for non-deterministic bugs, at a high enough rate to debug against).
  • You captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix addresses it.

Do not proceed until you reproduce the bug.

Phase 3 — Hypothesise

Generate **3–5 ranked hypotheses** before testing any. Single-hypothesis generation anchors on the first plausible idea.

Each hypothesis must be **falsifiable** — state the prediction it makes:

> If `<X>` is the cause, then changing `<Y>` will mak

Read more
@eduwxyz
Ships withsdd-pipeline

A spec-driven development pipeline for Claude Code and Codex CLI. Refine the spec before you code, let TDD enforce it, verify nothing slipped, then review.

Stars on GitHub

Momentum

stars in total
15
Star history of eduwxyz/my-awesome-skills on GitHub, a chart by star-history.com

Other skills on sdd-pipeline.

feature

feature

Kick off the full feature workflow — interview-to-spec, optional spec-approach, tdd, verify, then review — when starting a new…

interview-to-spec

interview-to-spec

Conduct a focused interview to draft a spec.md for an upcoming task (the input step of SDD — spec-driven development). Walks…

spec-approach

spec-approach

Add a refined `## Approach` section to an existing feature spec.md before TDD executes it. Reads the spec, explores the codebase…

tdd

tdd

Drives feature work and bug fixes through a tight failing-test-first loop. Trigger when implementing, fixing, or refactoring…

verify

verify

Verify that a spec.md's Acceptance criteria are observably covered by green tests before opening a PR. Reads the spec, finds the…

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills12d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react3d252k
@facebook@facebookInstall Skill

Questions about diagnose.

Which coding agents can use diagnose?
diagnose installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.