$npx -y skills add avibebuilder/claude-prime --skill diagnoseInvestigate unexpected behavior and mysterious bugs. Use when the cause of a problem is unknown and the user needs to understand WHY something is happening — symptoms like: sudden unexplained changes in metrics or behavior, works locally but not in staging/production, inconsisten
| 1 | Think harder. |
| 2 | |
| 3 | ## Process |
| 4 | |
| 5 | Check conversation context and skip completed steps. |
| 6 | |
| 7 | ### 1. Understand the symptom |
| 8 | - Read the bug report, errors, logs, and surrounding code carefully |
| 9 | - Clarify reproduction steps, expected behavior, and environment when they are unclear |
| 10 | - **Separate confirmed facts from working assumptions.** List them explicitly: |
| 11 | - `Fact (confirmed):` the server returns 200 |
| 12 | - `Assumption (unconfirmed):` the client receives the full HTML body |
| 13 | Misidentifying an assumption as a fact is the most common source of wasted investigation. |
| 14 | |
| 15 | ### 2. Build hypotheses |
| 16 | - Form 2-4 plausible root-cause hypotheses that are **mechanistically distinct** — different failure layers (e.g., server render vs. client hydration vs. network layer), not variations of the same idea |
| 17 | - Rank them by likelihood |
| 18 | - For each hypothesis, state both sides: |
| 19 | - `Confirm if:` [what observation would prove this is the cause] |
| 20 | - `Eliminate if:` [what observation would rule this out] |
| 21 | |
| 22 | A hypothesis you can't falsify in both directions is too vague to test. |
| 23 | |
| 24 | ### 3. Choose the lightest evidence method |
| 25 | Start with the cheapest source of truth that can kill hypotheses: |
| 26 | - existing logs, traces, stack traces, metrics, and error output |
| 27 | - static code inspection around the suspected path |
| 28 | - config, environment, deploy, cache, queue, and permissions state that could explain the symptom |
| 29 | - targeted reproduction in the relevant environment |
| 30 | |
| 31 | Only add new instrumentation when existing evidence is insufficient. |
| 32 | - If you need runtime probes, read `diagnose/references/runtime-debugging.md` |
| 33 | - Use `#region agent log` / `#endregion` markers for any instrumentation you add |
| 34 | - Tag each log point with the relevant `hypothesisId` |
| 35 | - Log only the minimum fields needed to discriminate between hypotheses; never log secrets, tokens, passwords, cookies, or full sensitive payloads |
| 36 | - If runtime probes require starting the local debug server, ask the user before launching it |
| 37 | - For browser/UI bugs, combine with the `agent-browser` skill when reproduction or inspection needs it |
| 38 | |
| 39 | ### 4. Gather evidence and iterate |
| 40 | - Use existing logs, traces, failing tests, or artifacts before asking for a fresh reproduction |
| 41 | - When reproduction is needed, ask the user to trigger the bug — tie each request to the hypothesis it tests |
| 42 | - Correlate each finding with the hypothesis it supports or eliminates; narrow based on evidence, not confidence |
| 43 | - If ambiguity remains, refine hypotheses and add narrower probes — but stop and report when another round is unlikely to produce new discriminating evidence |
| 44 | |
| 45 | ### 5. Report the diagnosis |
| 46 | |
| 47 | Output structured diagnosis: |
| 48 | |
| 49 | ``` |
| 50 | ## Diagnosis: [Issue Title] |
| 51 | |
| 52 | ### Symptoms |
| 53 | - [What was observed] |
| 54 | |
| 55 | ### Evidence |
| 56 | - [Finding] — `file:line` or runtime source — hypothesis X |
| 57 | - ... |
| 58 | |
| 59 | ### Root Cause |
| 60 | [Confirmed or most likely cause, with evidence] |
| 61 | |
| 62 | ### Hypotheses Tested |
| 63 | | # | Hypothesis | Confirm if | Eliminate if | Result | |
| 64 | |---|-----------|-----------|-------------|--------| |
| 65 | | A | ... | [what observation would prove this] | [what observation would rule this out] | Confirmed/Eliminated/Inconclusive | |
| 66 | |
| 67 | ### Recommended Next Steps |
| 68 | - [What to do next — usually hand off to `/fix` with this diagnosis] |
| 69 | |
| 70 | ### Active Instrumentation |
| 71 | - [List files with `#region agent log` blocks still in place, or `None`] |
| 72 | ``` |
| 73 | |
| 74 | ## Constraints |
| 75 | |
| 76 | - NO fixing — investigation and diagnosis only. "Recommended Next Steps" hands off to `/fix` with the diagnosis; it does **not** prescribe specific parameter values, code snippets, or step-by-step implementation instructions. |
| 77 | - Evidence over assumptions — if the code looks wrong but runtime evidence says otherwise, trust the runtime |
| 78 | - If you add `#region agent log` blocks, leave them in place for `/fix` to verify the repair and call them out in the final report |
| 79 | |
| 80 | ## Bug |
| 81 | |
| 82 | <bug>$ARGUMENTS</bug> |