$npx -y skills add eduwxyz/my-awesome-skills --skill diagnoseTurn 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
| 1 | # Diagnose |
| 2 | |
| 3 | Symptom in, fix-with-regression-test out. An interview if the user opens vague, then five phases, two cardinal rules. |
| 4 | |
| 5 | ## Skip diagnose for |
| 6 | |
| 7 | 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. |
| 8 | |
| 9 | ## Two rules that keep diagnosis honest |
| 10 | |
| 11 | 1. **No loop, no Phase 2+.** If you cannot reproduce the bug deterministically, you cannot hypothesise — you'll just guess. |
| 12 | 2. **One variable at a time during probing.** Changing two things at once tells you nothing about either. |
| 13 | |
| 14 | If either slips, back up. |
| 15 | |
| 16 | ## Phase 0 — Understand the bug |
| 17 | |
| 18 | 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. |
| 19 | |
| 20 | Ask **one question at a time**. Stop the moment you have enough to attempt Phase 1 — do not gather more than you need. |
| 21 | |
| 22 | The minimum set you're trying to fill: |
| 23 | |
| 24 | - **Expected vs. actual.** What should have happened? What actually happened? |
| 25 | - **Trigger.** What were they doing when it happened? Can they make it happen again on demand, or is it intermittent? |
| 26 | - **Recency.** Did this used to work? When did it start failing? What changed recently (deploy, dependency, data, config)? |
| 27 | - **Environment.** Where? (prod / staging / local; specific browser, OS, account, dataset.) |
| 28 | - **Evidence.** Any error message, stack trace, log line, screenshot, or HAR they can paste? |
| 29 | |
| 30 | If the answer to a question is in the codebase rather than in the user's head, **read the code instead of asking**. |
| 31 | |
| 32 | 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. |
| 33 | |
| 34 | 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**. |
| 35 | |
| 36 | ## Phase 1 — Build the feedback loop |
| 37 | |
| 38 | **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. |
| 39 | |
| 40 | Spend disproportionate effort here. Be aggressive. Refuse to give up. |
| 41 | |
| 42 | ### Ways to build one — try in roughly this order |
| 43 | |
| 44 | 1. **Failing test** at whatever seam reaches the bug — unit, integration, e2e. |
| 45 | 2. **Curl / HTTP script** against a running dev server. |
| 46 | 3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot. |
| 47 | 4. **Headless browser** (Playwright / Puppeteer) — drives the UI, asserts on DOM/console/network. |
| 48 | 5. **Replay a captured trace.** Save a real request/payload/event log to disk; replay it through the code path in isolation. |
| 49 | 6. **Throwaway harness.** A minimal subset of the system that exercises the bug code path with one function call. |
| 50 | 7. **Property / fuzz loop.** For "sometimes wrong output", run 1000 random inputs and look for the failure mode. |
| 51 | 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. |
| 52 | 9. **Differential loop.** Run the same input through old vs new (or two configs) and diff outputs. |
| 53 | 10. **HITL bash script.** Last resort. If a human must click, drive them with a structured loop and capture output back to you. |
| 54 | |
| 55 | ### Iterate on the loop itself |
| 56 | |
| 57 | Treat the loop as a product. Once you have *a* loop, ask: |
| 58 | |
| 59 | - **Faster?** Cache setup, skip unrelated init, narrow scope. |
| 60 | - **Sharper signal?** Assert on the specific symptom, not "didn't crash". |
| 61 | - **More deterministic?** Pin time, seed RNG, isolate filesystem, freeze network. |
| 62 | |
| 63 | A 30-second flaky loop is barely a loop. A 2-second deterministic loop is a debugging superpower. |
| 64 | |
| 65 | ### Non-deterministic bugs |
| 66 | |
| 67 | 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. |
| 68 | |
| 69 | ### When you genuinely cannot build a loop |
| 70 | |
| 71 | Stop and say so explicitly. List what you tried. Ask the user for one of: |
| 72 | |
| 73 | - Access to an envi |