writing-skills
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
fix-rootEnd-to-end bug fix workflow, root cause first. Asks whether the behavior ever worked — if so it is a regression and git bisect finds the culprit commit instead of a hypothesis contest. Otherwise triages into a short track or a full track (competing hypotheses as an anchoring-bias gate, graph evidence, a caller baseline re-verified after). Every track keeps …
Independent GitHub snapshot · Automated classification · Original documentation governs
Diagnose (don't anchor on the first guess), fix (minimal, root cause only), verify (prove the change did what the plan said). Each part gates the next.
This file is the whole short track. Read a reference only when its condition holds — loading all four on a one-file bug is the waste this skill exists to avoid.
| Read | When |
|---|---|
references/regression.md | The behavior worked before — a tag, a release, a green CI run |
references/full-track.md | The full track was triggered by the triage below |
references/graph-tools.md | codebase-memory-mcp is available and you are about to call it |
references/test-first.md | The red→green check misbehaves, or its script is missing |
MCP names are bare, not callable as written. Prefix cbm_ under pi,
mcp__codebase-memory-mcp__ under Claude Code. Under pi, trace_path,
query_graph, detect_changes, get_architecture and get_graph_schema
need one cbm_search_tools call first.
Is this a regression? Did the behavior ever work — a release, a tag, a
commit, "it worked before the deploy", a test that used to pass? If yes,
history holds the answer: read references/regression.md, which replaces
steps 2-3 and nothing else. If nobody can name a moment when it worked, it
is not a regression — don't bisect a bug that was always there.
Short or full track? Short is the default. The full sequence is an escalation, not the entry point: running it on a bug that didn't need it burns the budget on ritual instead of on reading the faulty code, and forces fabricated hypotheses — the very anchoring risk the gate exists to prevent.
Short track — cause visible in the trace/diff/failing test, blast radius ≤2 files, no concurrency, no service boundary crossed. Steps 1, 4, 7, 8, 10, 12 below. Nothing else.
Full track — escalate on any one of these, and only these:
State the track in one line before the first tool call. Escalating short → full mid-flight is expected, not a failure. The reverse never happens: finishing early because it now looks simple is how a fix ships unverified.
Steps marked (full) are skipped entirely on the short track.
references/regression.md replaces this step.references/full-track.md.file:line or a qualified name for every
claim — nothing is accepted or rejected without a cited source. Short
track: one hypothesis and one citation, not zero. An uncited cause is a
guess.Map the pre-fix baseline. (full) Every caller and callee of the
code about to change, plus the same faulty pattern elsewhere in the
repo. This baseline is what step 9 verifies against, and it decides the
edge cases the fix must cover. See references/full-track.md.
Write the failing test first. Reproduce the bug as a test, show it red, before touching the fix.
Apply the minimal fix, root cause only. No renames, no reshaping, no drive-by cleanup — note the temptation as a follow-up, not part of this diff. Then prove red→green mechanically rather than by self-report:
<skill-dir>/scripts/verify-test-first.sh "<test-cmd>" -- <fix-file> [...]
<skill-dir> is wherever this SKILL.md sits — resolve it from this
file's own path, don't assume a repo layout. Exit 0 only on a confirmed
red→green. Script missing, or a build cache making the replay lie:
references/test-first.md.
references/full-track.md.references/full-track.md.file:line — either track. "Probably
not that" is not a rejection.