Bug Investigate and Fix
End-to-end workflow from bug description to verified fix. Do not skip reproduction or hypothesis testing to jump straight to a patch.
Inputs
- Required: Bug description (symptoms, expected vs actual, where it appears, when it started if known).
- Infer from repo: How to run the app (Agents.md,
package.json, README, existing dev scripts).
If reproduction is blocked (missing env, credentials, steps), state blockers and ask only what unblocks repro — do not fabricate a fix plan.
Workflow
Copy this checklist and update as you go:
- [ ] 1. Reproduce
- [ ] 2. Hypotheses (1–4)
- [ ] 3. Test hypotheses
- [ ] 4. Fix plan (thermo-nuclear-plan, short)
- [ ] 5. Implement fix
- [ ] 6. Verify repro is gone
1. Reproduce
Goal: Observe the bug in a running environment, not only by reading code.
- Start or use the local dev server (or the project’s documented local run command).
- Reproduce using the same surface as the report when possible:
- Web/UI → browser (navigation, clicks, network tab, console)
- API →
curl/HTTP client against local base URL
- CLI → run the command with the reported flags/env
- Background job → trigger locally or via documented test hook
- Record minimal repro steps: prerequisites, exact actions, inputs, and observable failure (message, status code, screenshot-level description).
- If you cannot reproduce, document what you tried and what differs from the report before continuing.
Do not treat static code reading alone as reproduction.
2. Form hypotheses
Produce 1–4 ranked hypotheses (most likely first). Each hypothesis must be:
- Specific — names module, function, route, state, or data path
- Falsifiable — states what evidence would confirm or reject it
- Tied to symptoms — links expected observation if true
Use a short table:
| # |
Hypothesis |
If true, we'd see… |
Quick test |
| 1 |
… |
… |
… |
| 2 |
… |
… |
… |
Avoid vague hypotheses ("something wrong with auth"). Prefer one concrete mechanism per row.
3. Test hypotheses
Test in order of likelihood until one is confirmed or the set is exhausted.
- Prefer fast, discriminating checks: logs, breakpoints, targeted
grep, one-off script, unit/integration test, network payload inspection.
- For each test, record: ran → result → confirms / rejects / inconclusive.
- Stop when a hypothesis is confirmed with evidence from repro environment or a direct code path trace.
- If all are rejected, add 1–2 new hypotheses from new evidence and repeat (one small loop only — do not spiral).
Do not implement a fix before a hypothesis is confirmed or strongly supported.
4. Fix plan (thermo-nuclear-plan, short)
Read and apply the thermo-nuclear-plan skill (/thermo-nuclear-plan), but compress output for a single bug fix.
If thermo-nuclear-plan is not available (not installed or not attached), plan from this summary instead: strict pre-coding planning that favors code judo — the simplest fix that still meets the goal, with fewer files, phases, and special cases rather than scheduling around incidental complexity. Prefer concrete outcomes per step, canonical modules over new wrappers, and explicit out-of-scope. Then use the compressed format below (do not produce a full mega-plan).
- Goal — one sentence: bug gone, behavior restored, no regressions named by user.
- Simplest viable approach — the code-judo fix (fewest files, no new abstractions unless necessary).
- Plan — at most 3 phases or one PR slice, each with ≤5 concrete steps (outcome per step, no "refactor as needed").
- Out of scope — explicit nice-to-haves to skip.
- Verification — how you'll prove repro steps fail after the fix.
If root cause is still unclear, output open questions and a labeled provisional plan — do not implement yet.
5. Implement fix
- Implement only what the short plan requires; minimize diff scope.
- Match existing project conventions (types, error handling, tests only if the repo expects them for this area).
- Do not expand scope (drive-by refactors, unrelated cleanup).
6. Verify repro is gone
- Re-run the same minimal repro steps from step 1 on the local dev server / browser / CLI.
- Confirm expected behavior and absence of the original failure.
- If the bug was environmental, note what changed (env var, seed data, cache).
- Report: repro steps before → after, hypothesis confirmed, files touched, residual risk.
If verification fails, return to step 2 with new evidence — do not claim the bug is fixed.
Output shape (for the user)
Keep the final summary compact:
- Repro — steps + what you observed
- Root cause — confirmed hypothesis in plain language
- Fix — what changed and why
- Verification — repro re-run result
1---2name: bug-investigate-fix3description: Systematically reproduces, hypothesizes, tests, plans, fixes, and verifies bugs from a user bug description. Use when the user reports a bug, regression, unexpected behavior, crash, or asks to debug, reproduce, root-cause, or fix an issue. Prefer local dev server and browser verification over code-only guesses.4---56# Bug Investigate and Fix78End-to-end workflow from bug description to verified fix. Do not skip reproduction or hypothesis testing to jump straight to a patch.910## Inputs1112- **Required**: Bug description (symptoms, expected vs actual, where it appears, when it started if known).13- **Infer from repo**: How to run the app (Agents.md, `package.json`, README, existing dev scripts).1415If reproduction is blocked (missing env, credentials, steps), state blockers and ask only what unblocks repro — do not fabricate a fix plan.1617## Workflow1819Copy this checklist and update as you go:2021```22- [ ] 1. Reproduce23- [ ] 2. Hypotheses (1–4)24- [ ] 3. Test hypotheses25- [ ] 4. Fix plan (thermo-nuclear-plan, short)26- [ ] 5. Implement fix27- [ ] 6. Verify repro is gone28```2930---3132### 1. Reproduce3334**Goal**: Observe the bug in a running environment, not only by reading code.35361. Start or use the **local dev server** (or the project’s documented local run command).372. Reproduce using the **same surface** as the report when possible:38 - Web/UI → browser (navigation, clicks, network tab, console)39 - API → `curl`/HTTP client against local base URL40 - CLI → run the command with the reported flags/env41 - Background job → trigger locally or via documented test hook423. Record **minimal repro steps**: prerequisites, exact actions, inputs, and observable failure (message, status code, screenshot-level description).434. If you cannot reproduce, document what you tried and what differs from the report before continuing.4445**Do not** treat static code reading alone as reproduction.4647---4849### 2. Form hypotheses5051Produce **1–4 ranked hypotheses** (most likely first). Each hypothesis must be:5253- **Specific** — names module, function, route, state, or data path54- **Falsifiable** — states what evidence would confirm or reject it55- **Tied to symptoms** — links expected observation if true5657Use a short table:5859| # | Hypothesis | If true, we'd see… | Quick test |60|---|------------|-------------------|------------|61| 1 | … | … | … |62| 2 | … | … | … |6364Avoid vague hypotheses ("something wrong with auth"). Prefer one concrete mechanism per row.6566---6768### 3. Test hypotheses6970Test **in order of likelihood** until one is confirmed or the set is exhausted.7172- Prefer **fast, discriminating checks**: logs, breakpoints, targeted `grep`, one-off script, unit/integration test, network payload inspection.73- For each test, record: **ran → result → confirms / rejects / inconclusive**.74- Stop when a hypothesis is **confirmed** with evidence from repro environment or a direct code path trace.75- If all are rejected, add 1–2 new hypotheses from new evidence and repeat (one small loop only — do not spiral).7677**Do not** implement a fix before a hypothesis is confirmed or strongly supported.7879---8081### 4. Fix plan (thermo-nuclear-plan, short)8283Read and apply the **thermo-nuclear-plan** skill (`/thermo-nuclear-plan`), but **compress output for a single bug fix**.8485**If thermo-nuclear-plan is not available** (not installed or not attached), plan from this summary instead: strict pre-coding planning that favors **code judo** — the simplest fix that still meets the goal, with fewer files, phases, and special cases rather than scheduling around incidental complexity. Prefer concrete outcomes per step, canonical modules over new wrappers, and explicit out-of-scope. Then use the compressed format below (do not produce a full mega-plan).86871. **Goal** — one sentence: bug gone, behavior restored, no regressions named by user.882. **Simplest viable approach** — the code-judo fix (fewest files, no new abstractions unless necessary).893. **Plan** — at most **3 phases** or **one PR slice**, each with **≤5 concrete steps** (outcome per step, no "refactor as needed").904. **Out of scope** — explicit nice-to-haves to skip.915. **Verification** — how you'll prove repro steps fail after the fix.9293If root cause is still unclear, output **open questions** and a **labeled provisional plan** — do not implement yet.9495---9697### 5. Implement fix9899- Implement only what the short plan requires; minimize diff scope.100- Match existing project conventions (types, error handling, tests only if the repo expects them for this area).101- Do not expand scope (drive-by refactors, unrelated cleanup).102103---104105### 6. Verify repro is gone1061071. Re-run the **same minimal repro steps** from step 1 on the local dev server / browser / CLI.1082. Confirm **expected behavior** and absence of the original failure.1093. If the bug was environmental, note what changed (env var, seed data, cache).1104. Report: repro steps before → after, hypothesis confirmed, files touched, residual risk.111112If verification fails, return to step 2 with new evidence — do not claim the bug is fixed.113114---115116## Output shape (for the user)117118Keep the final summary compact:1191201. **Repro** — steps + what you observed1212. **Root cause** — confirmed hypothesis in plain language1223. **Fix** — what changed and why1234. **Verification** — repro re-run result124