/code-craft:diagnose-bugsfrom code-craft
Finds the root cause of a bug, flaky test, or regression: reproduce, read the evidence, one hypothesis at a time until the mechanism is proven. Use when the user says "why is this failing", "this test is flaky", "it works on my machine", or hands over a stack trace. Not for writing up a found cause (postmortem), what could fail (failure-mode-analysis), or diff security (security-diff-review).
Ships in code-craft. 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.
Read when SKILL.md points to them.
Find the causal mechanism and, when a fix is requested, demonstrate that the fix removes it. Separate observed facts, hypotheses, and unverified claims.
Read the actual error, surrounding logs, relevant code, and recent changes. Record the invocation, inputs, environment, and expected versus observed result. Try the smallest reproduction that preserves the failure. For intermittent failures, hold the command and iteration count fixed and measure the rate; inspect seeds, ordering, concurrency, timing, and environment differences.
A missing reproduction is a limit on confidence, not a reason to stop reading available evidence. Form hypotheses that help obtain one. If the necessary state is inaccessible, name the missing evidence and the cheapest way to capture it; continue independent checks without inventing a root cause.
For each experiment, choose one mechanism, predict an observable result, and change one relevant variable. Prefer the cheapest check that distinguishes the leading explanations. Bisect commits for regressions, shrink inputs for data-dependent failures, and inspect boundaries to locate where a value first becomes wrong. Discard a hypothesis when the observation contradicts it.
Example: if a failure disappears when requests run serially, investigate shared state and ordering; increasing the timeout alone does not establish the cause.
Use temporary instrumentation when observation requires it. Avoid recording credentials or sensitive payloads. Remove debugging changes after use, or keep an intentional diagnostic with a clear operational purpose. If investigation stalls, use references/stuck-protocol.md.
Change the causal step with the smallest sufficient patch. Pin the original failure through an observable interface: see the regression test fail on the old behavior and pass with the fix. The tdd discipline supplies that loop. Run affected tests and the repository's required checks; widen testing when the changed dependency or unresolved evidence justifies it.
Report the mechanism, fix, evidence, and remaining limits. Distinguish a verified fix from a plausible mitigation. Keep unrelated hardening separate; do not skip failing tests to create a green result. Use postmortem for a requested durable incident account and security-diff-review for vulnerabilities.
The evidence connects input → causal step → symptom, and verification addresses the reported failure. If it cannot, report the unresolved mechanism and next useful experiment, without claiming the task is fixed.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub smithdak/skillsmith --plugin code-craft6 skills in this plugin
/codebase-surveyMaps an unfamiliar repository fast: inventory scripts plus parallel subagent scans, synthesized into a path-anchored survey document. Use when the user says "survey this codebase", "help me get oriented in this repo", "map out this project", or has inherited a codebase. Not for judging its structure (architecture-review), a new design (architecture-spec), one bug (diagnose-bugs), or one function./postmortemWrites an incident or bug post-mortem once the root cause is known: evidence-anchored timeline, mechanism, why every safety net missed it, guardrails. Use when the user says "write a post-mortem for this outage", "do an RCA on this bug", or wants a found root cause documented. Not for finding the cause (diagnose-bugs), what could fail (failure-mode-analysis), or tickets (define-work-items)./