agentleFS
pierrebelinpierrebelin/claude-code-toolkit/skills/fix-bug/SKILL.md

fix-bug

Skill7 starsChanged 8 days agoMITView on GitHub

Use when the user brings a bug (ticket, failing behaviour) to fix: checks it is not already fixed, diagnoses the cause in a read-only subagent, settles with the user whether it is a bug or a spec gap, writes a one-batch fix plan, then launches the run-fix workflow (RED, GREEN, diff audit, knowledge base updated).

50 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use improvement, build-feature and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • kiminmonacoSkill

    improvement

    Guide for making improvements to existing ClaudeBar functionality using TDD. Use this skill when: (1) Enhancing existing features (not adding new ones) (2) Improving UX, performance, or code quality (3) User asks "improve X", "make Y better", or "enhance Z" (4) Small enhancements that don't require full architecture design For NEW features, use implement-feature skill instead.

    Also in 4 projects that use this

  • sirakinbSkill

    build-feature

    Autonomous task loop that picks ready tasks, implements them, updates progress.txt, commits, and repeats. Use when asked to 'build feature', 'run the loop', or 'implement these tasks'.

    Also in 7 projects that use this

  • kiminmonacoSkill

    implement-feature

    Guide for implementing features in ClaudeBar following architecture-first design, TDD, rich domain models, and Swift 6.2 patterns. Use this skill when: (1) Adding new functionality to the app (2) Creating domain models that follow user's mental model (3) Building SwiftUI views that consume domain models directly (4) User asks "how do I implement X" or "add feature Y" (5) Implementing any feature that spans Domain, Infrastructure, and App layers

    Also in 10 projects that use this

  • SentrySkill

    write-tests

    Write tests following project conventions. Use when adding new tests or modifying existing ones.

    Also in 6 projects that use this

  • DockerSkill

    review-changes

    Review uncommitted or recently committed documentation changes for correctness, coherence, and style compliance. Use before creating a PR to catch issues. "review my changes", "review the diff", "check the fix before submitting", "does this look right".

    Also in 4 projects that use this

  • JasonPaffSkill

    implement-plan

    Execute implementation plan with structured tracking and validation using subagent architecture

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 48 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Never diagnose in the main context beyond reading the agent's path:line citations, bounded.

    line 29
  2. Very specific:

    Every business answer of §2 lands in the SPEC statement or a cycle observation, never only in chat.

    line 50

“Common” is measured: kept by at least 6 in 10 of the 48 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Fix a bug — cause, one decision, then the workflow

One stop only: the user validates the cause and the verdict (§2). Everything after it is the run-fix workflow (workflows/run-fix.js): no plan mode, no estimate turn, no full suite, no manual test writing.

$ARGUMENTS

Code: --code <code> when given, else the ticket id lowercased (fix-1234), else fix-<short-slug>. Folder todo/<code>/, <CODE> = the code uppercased.

0. Already fixed?

Before any diagnosis, one message: git log --oneline -15 -- <folders the ticket names> and git log -S '<distinctive literal or symbol of the ticket>' --oneline -10. A commit naming the behaviour → read its diff, run the existing test that covers it (narrowest filter). Green and covering the ticket's scenario → say so, stop: nothing to fix. Green but no test observes the scenario → write that regression test here, through the repo's test skill of its level (tests-unit-tests …), run it filtered, and stop: no plan, no workflow — a test green at its first run is no TDD cycle, run-lot would refuse it. The fixing commit's message names the ticket.

1. Diagnosis — delegated, read-only

One Agent, subagent_type: Explore, model: sonnet. Brief: the ticket verbatim; the suspected handler(s) when the ticket names them; ask for, under 40 lines:

  • Cause — root cause in two sentences, path:line of the faulty decision.
  • Handler — the use-case handler carrying it, and cctoolkit ask --handler <Name> output's rule ids that bind it (id + one-line statement).
  • Reproduction — the input and state that trigger it, observed result vs expected.
  • Test contract — level (UT unless the faulty line is in Infrastructure → IT, or in a WebAPI mapping → contract test), the existing test class and fixture paths for that handler (or (to create)), production files to change (at most 8).
  • Rule reading — does a documented rule already say the expected behaviour (code departs from it), say the opposite or nothing (the rule itself must change), or is the expected behaviour a new capability?

Never diagnose in the main context beyond reading the agent's path:line citations, bounded.

2. The decision — the one stop

Show the cause, path:line, the reproduction and the rule reading in ≤ 10 lines. Then one AskUserQuestion, up to four questions:

  1. Verdict — the options, the agent's reading first, marked Recommended:
    • Bug — a documented rule says the expected behaviour, the code departs from it. The base is right: no delta.
    • Rule to correct — an existing rule (id in the base) says the wrong thing or too little; the fix rewrites it. Delta kit:modified on that id.
    • Spec gap — the expected behaviour needs a new rule, use case or decision (no id to modify). Stop here: route to /cctoolkit:business-spec with the diagnosis as its input. The merge refuses a provisional id, and a new rule deserves its spec.
    • Not a bug — the code does what the base says and the base is what the business wants: stop, give the user the answer for the ticket.
  2. Up to three closed business questions the fix forces (what happens to existing data, which callers keep the old behaviour, an edge case the ticket leaves open), each with 2-4 options. None when the diagnosis leaves nothing open.

The answers are the intent the workflow carries: nothing is asked after this point.

3. Write the fix plan

From references/fix-template.md, three files under todo/<code>/, one Write each, in one message: SPEC-<code>.md, <CODE>-PLAN.md, <CODE>-PLAN-F1.md. Fill them from the diagnosis and the answers:

  • SPEC — verdict Bug: no delta heading (the merge prints nothing to merge). Rule to correct: one ### <ID> — <title> <!-- kit:modified --> per rule rewritten, its statement whole as corrected — the base text is replaced by it — and **Applies to** its use case. A decision the answers overturned: its <PFX>-D-nnn heading kit:modified too, stating the new decision and why.
  • ## Cycles — one cycle per observable behaviour the fix changes (usually one, at most three), fields per skills/implement-tdd/references/design.md; rmcu cites the rule id; methods named Should<Result>_When<Condition>; closing light.
  • Every business answer of §2 lands in the SPEC statement or a cycle observation, never only in chat.

Then, one message: cctoolkit sheet-cycles todo/<code>/<CODE>-PLAN-F1.md --index and cctoolkit plan-next-batch todo/<code>/<CODE>-PLAN.md --check. A failure → fix the file it names, rerun; never launch on a red check.

4. Launch

/effort medium (hooks/implement-tdd-guard.sh). Skill cctoolkit:run-fix, argument = todo/<code>/<CODE>-PLAN.md as text. Do not watch it: the notification brings the result.

5. Relay

From the result, ≤ 15 lines: status, audit verdict and minors, toReview entries (decisions the run took alone), knowledge base from merge (written with its files; absent = nothing to merge, the base already states the rule; otherwise its lines and next), and next. BLOCKED → its reason and report path; the plan stays under todo/<code>/, a new /cctoolkit:run-fix resumes from the saved cycles.

Then the commit message for the knowledge-base diff left in the tree, in the repo's commit language: subject docs(<context>): <rule> — <one line>, body = the cause and the decision taken in §2.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.