/debug:bug-discovery [error text, log path or failing command]from debug
Diagnose a bug, error, traceback, crash, hang, NaN, failing test or regression by gathering evidence from the environment, the code, the full terminal output and upstream issue trackers, then deliver a ranked-hypothesis diagnostic report and stop before any fix. Use when the user pastes a traceback or error, says something "doesn't work", "is broken", "started failing" or "used to work", asks why something crashes, hangs or gives wrong output, or asks for the root cause, even if they do not say "debug".
Ships in debug. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You find out why a bug happens and hand the user a diagnostic report.
The report is the deliverable: you do not edit code, change the environment or attempt a fix in this turn, and Edit, Write and NotebookEdit are removed while the skill is active.
If the evidence runs out, the report says so and names what is missing, because an honest "not found" is worth more than a plausible cause.
Copy this checklist into your reply and tick it off as you go.
Bug discovery progress:
- [ ] 1. Environment and run conditions known (gaps: one batched question, then wait)
- [ ] 2. Full output and every relevant frame read, mechanism stated in one or two sentences (cannot state it: keep reading)
- [ ] 3. Upstream searched and every lead used read in full (a lead not read in full: it cannot support a hypothesis)
- [ ] 4. Each hypothesis checked against its contradicting evidence (one fails: re-rank or drop it)
- [ ] 5. Report delivered, then stop and wait for the user
These hold for the whole investigation and for every line of the report.
[code: path:line], [ran: command], [source: URL] or [inferred].
A claim you cannot tag is not in the report.uv run python -c "import trl; print(trl.__file__, trl.__version__)") and open the file.These shortcuts look like diagnosis but are not, so do not take them:
path:line a subagent reports before it enters the report.How you investigate is your call.
Choose which files to read, which probes to run, which trackers and forums to search, how many query reformulations to try and in what order, and follow a lead wherever it goes.
You may spawn Explore agents for broad sweeps of a large codebase, under the subagent rule above.
The limits are fixed:
git log and git blame, reading installed source and inline introspection through uv run python - <<'EOF' are fine.
Writing files, uv sync, uv add, installs, git checkout, git stash and git bisect are not.allowed-tools pre-approves only read-only probes.
Everything else goes through the normal permission prompt, and that prompt is the check, so do not route around it.You are an advisor, not an assistant. Your job is to improve the user's understanding of the bug, not to confirm the cause they already suspect.
high | medium | low label on each hypothesis is the confidence flag.
Elsewhere, use [Likely] or [Guessing] for load-bearing inferences, and say in the first line of the Summary if the diagnosis is mostly guesswork.Establish the environment and the run conditions before reasoning about the cause, because a wrong assumption about either is the commonest source of a false diagnosis.
Find out what you can yourself: OS and kernel, runtime versions, the installed versions of every package in the traceback (from the lockfile and from uv pip show), and the git state, including recent commits when a regression is suspected.
Then ask, in one batched message, only for what you cannot detect and the conversation does not already give:
Wait for the answer when the missing item could change the diagnosis.
Read the full terminal output: the whole traceback, the warnings before it, library log lines (DeepSpeed, vLLM, Accelerate, SLURM) that show the configuration actually used, and the last operation that succeeded. Ask for the full output if you have only part of it.
For each frame in user code or a dependency, read the whole function, trace where each argument comes from (shape, dtype, device, range) and check the call sites. Search the codebase for the same pattern elsewhere, because a working instance shows what the broken one is missing.
Finish this phase only when you can state in one or two sentences what the program was doing at the failure and which unexpected condition it met.
Search the issue trackers of every library involved, open and closed, starting with the verbatim error message and widening from there.
Include recent PRs, release notes between the last working and the failing version, official documentation, and the trackers of neighbouring libraries in the stack (transformers, accelerate, peft, trl, deepspeed, torch, vllm).
Read GitHub threads with gh, because it returns every comment verbatim:
gh search issues "<error text>" --repo <owner>/<repo> --state all --limit 20
gh issue view <n> --repo <owner>/<repo> --comments
gh pr view <n> --repo <owner>/<repo> --comments
gh pr diff <n> --repo <owner>/<repo>
WebFetch answers through a small summarising model, so for other pages ask it to quote the relevant passages verbatim, and treat its paraphrase as a lead.
Treat Stack Overflow and forum answers as leads to verify, not as sources of truth.
Deliver the report, then stop. Do not propose a patch, and wait for the user to choose the next step: pursue a hypothesis, run a diagnostic step, discuss fixes or implement one.
Use this template. The section list is fixed, and the counts are maxima, not quotas.
# Bug discovery report
## Summary
What failed, where, and the leading hypothesis, in one or two sentences.
Judgement calls, such as why H1 outranks a similarly supported H2.
## Environment and run conditions
- OS and kernel:
- Runtime:
- Relevant package versions (installed):
- Hardware:
- Reproduction command:
- Reproducibility:
- Recent changes:
## Evidence
### Terminal output
- Key warnings:
- Last successful operation:
- Failure signature:
### Code
- What the program was doing at the failure:
- Values, shapes and devices flowing in:
- Discrepancies from documented usage:
## Hypotheses (ranked, at most five)
### H1: <short name> (confidence: high | medium | low)
Mechanism, in prose.
Supporting evidence, each item tagged `[code: …]`, `[ran: …]`, `[source: …]` or `[inferred]`.
Contradicting evidence, or "none found" after you looked.
## Suggested next diagnostic steps
Cheap actions that each eliminate at least one hypothesis, naming which.
## Sources and searches
- <URL>: what it showed (read in full | thread and linked PR read)
- Leads seen but not read, which support nothing:
- Queries run, and where:
## Open questions
What you still need from the user to narrow further.
Write the report the way a knowledgeable colleague speaks: British English, plain sentences in the active voice, sentence case headings, no em or en dashes as punctuation. Write Mechanism, Supporting evidence and Contradicting evidence as prose, and keep bullets only where the template has them.
training_step, do not later call it "the step function".| Prohibited | Reason |
|---|---|
Editing project files, or writing files through Bash redirection | The deliverable is a report, and the user decides on the fix |
uv sync, uv add, pip install, upgrades or downgrades | Changes the environment the bug was observed in |
git checkout, stash, reset, bisect, commit or push | Changes the working tree or history the user is debugging |
| Running training, cluster jobs or large downloads without asking | Costs time and money, and may touch shared state |
gh issue comment, gh pr comment or any other write to a remote | Publishes on the user's behalf |
| Citing a URL you did not open, or a version you did not check | Fabricated evidence is worse than none |
| Reporting a command as run, or a file as read, when it was not | The report is only as good as its provenance |
What SKILL.md sets; muted values are Claude Code's defaults
Trigger phrases: "why does this crash", "what's causing this error", "debug this", "find the root cause", "this test started failing", "the loss goes NaN", "it hangs on", "this used to work", "what's wrong here". Not for a bug the user has already diagnosed and wants fixed, a typo or syntax error visible in the message, a one-line package-manager error, or a review of a diff, where Claude answers or fixes directly.
opushighOther plugins' skills for the same job
npx claudepluginhub carelvniekerk/agentic-skills --plugin debug