fix-bug
Skill20 starsChanged 26 days agoUnlicenseView on GitHub
Diagnoses and fixes bugs using a test-first workflow (reproduce, diagnose, fix). Use this skill whenever the user reports a bug, describes unexpected behavior, or asks to investigate or fix a defect. Even if the user says "something's broken", "this isn't working", "fix this bug", or "why does X happen", load this skill to guide the full reproduce → diagnose → fix cycle.
40 other projects use a version of this.
Adopted by
Most recently taken up by
- Doist/todoist-aitheir own version, first seen Nov 9, 2026
- Doist/todoist-clitheir own version, first seen Nov 8, 2026
- danielvm-git/bigpowerstheir own version, first seen Nov 6, 2026
- tddworks/ClaudeBartheir own version, first seen Nov 3, 2026
- mthines/agent-skillstheir own version, first seen Oct 30, 2026
- aantoniadis/skillstheir own version, first seen Oct 20, 2026
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.
kiminmonacoSkillimprovement
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
sirakinbSkillbuild-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 5 projects that use this
kiminmonacoSkillimplement-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 7 projects that use this
SentrySkillwrite-tests
Write tests following project conventions. Use when adding new tests or modifying existing ones.
Also in 6 projects that use this
JetBrainsSkillcreate-plan
Research the codebase and create an implementation plan with architecture notes, design document, and track decomposition. Use when starting a new feature or large change.
Also in 4 projects that use this
JasonPaffSkillimplement-plan
Execute implementation plan with structured tracking and validation using subagent architecture
Also in 3 projects that use this
Other versions40 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 40
- remix-run/react-router★ 57ksame name
- ktorio/ktor★ 15ksame name
- JetBrains/Exposed★ 9.3ksame name
- bytebase/dbhub★ 3.8ksame name
- The-OpenROAD-Project/OpenROAD★ 3.3ksame name
- JamieMason/syncpack★ 2.1ksame name
- tddworks/ClaudeBar★ 1.6ksame name
- Harry-kp/vortix★ 757same name
- Doist/todoist-ai★ 563same name
- tddworks/asc-cli★ 393same name
30 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository9 other files it gives its agents.
- code-writing-guideSkill
- edit-sceneSkill
- plan-featureSkill
- refine-testsSkill
- resolve-diagnosticsSkill
- run-testsSkill
- test-designing-guideSkill
- test-writing-guideSkill
- unity-yaml-editing-guideSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. 0 are common, 13 are distinctive, and 10 are very specific to this project.
0
Common
Most of the 40 edited versions we read keep these.
13
Distinctive
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 46
When a step delegates to a subagent or another skill (test-designer in Step 2.
- Very specific: line 58
If any of the three cannot be determined from the prompt, use AskUserQuestion to ask the user before proceeding.
- Distinctive: line 75
Search the project's test code for existing tests closest to the bug scenario.
- Distinctive: line 81
Use Explore agents to locate relevant test files and test cases.
- Distinctive: line 104
If an existing test is testing the wrong behavior (i.e., the test itself is buggy), rewrite that test to correctly reproduce the bug rather …
- Very specific: line 109
Run tests using the /run-tests skill and verify that the reproduction test fails:
- Distinctive: line 111
If a test was added in Step 2: run that specific test.
- Very specific: line 114
If multiple tests fail and it is unclear which one corresponds to the reported bug, use AskUserQuestion to ask the user which test to focus …
- Distinctive: line 119
Delete the reproduction test
- Very specific: line 122
If reproduction has been attempted 3 times without success, return to Step 1 and use AskUserQuestion to re-clarify the bug report with the …
- Distinctive: line 130
Test failure message (actual output from the test run)
- Distinctive: line 133
Commit the reproduction test — if test code is modified in a later step, the integrity of Test First is compromised.
- Distinctive: line 146
Before applying the fix, check whether the affected area has adequate coverage for adjacent behavior:
- Very specific: line 148
Start from the regression test cases the test-designer agent produced in Step 2 (if Step 2 ran)
- Distinctive: line 149
Read the test files for the affected production code
- Very specific: line 151
If gaps exist, add regression tests (per test-writing-guide) and run them — they must pass (they test existing correct behavior, not the …
- Very specific: line 158
Run all affected tests using /run-tests
- Distinctive: line 161
All regression tests still pass
- Distinctive: line 162
Commit production code fix to git (includes regression tests from Step 6 and any unavoidable changes to the reproduction test)
- Very specific: line 167
Run the Claude Code built-in /simplify skill (Skill({skill: "simplify"}) — not a plugin skill) to apply quality improvements to the …
- Very specific: line 169
Run /resolve-diagnostics with the files added or modified in this iteration — compute the list after the test-deduplicator agent and …
- Distinctive: line 170
Commit all remaining changes to git
- Distinctive: line 176
Delete the temporary notes file if it exists
“Common” is measured: kept by at least 6 in 10 of the 40 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.
Files
Guide for diagnosing and fixing bugs. This skill defines a test-first debugging workflow: reproduce the bug with a failing test, diagnose the root cause, then fix it.
Mode Check
This skill must be used outside plan mode. Before doing anything else, check the current mode:
ExitPlanModeis NOT in the deferred tools list (i.e., directly callable) → in plan mode → stop immediately and tell the user:"This skill (
/fix-bug) must be used outside plan mode. Please exit plan mode first."ExitPlanModeis in the deferred tools list → not in plan mode → proceed.
Workflow
Recording implementation notes: Notes for this run go in <scratchpad>/implementation-notes.md, where <scratchpad> is the scratchpad directory listed in your system prompt (write its absolute path literally). Immediately before your first append in this run — and only then — delete that file if it exists (usually it will not), so this run starts from an empty one: every /fix-bug, /refine-tests, and plan-file run in the session shares this file, so an earlier run abandoned before its Implementation Notes step would otherwise leak its notes into this one. Never delete it again afterwards, including when Step 3 sends you back to Step 1 or Step 2; those loops are part of the same run and their notes must survive.
While working through Steps 1-8, whenever one of the following occurs, immediately append a line to that file — do not wait until the end to reconstruct these from memory:
- The confirmed Condition / Expected / Actual differs from what the user first reported, or the documentation conflicted with the report and you resolved which is correct → Bug report clarifications
- You established — or later revised — which line(s) or logic are responsible and why they misbehave, including when the fix actually applied differs from the one formulated in Step 5 → Root cause
- You investigated a suspected cause, code path, or reproduction approach and eliminated it → Ruled out
- You considered alternatives and chose one, and why → Tradeoffs
- You modified or deleted test code that was already committed, and why → Test changes
Append with Bash — the Write tool cannot append:
cat >> "<scratchpad>/implementation-notes.md" <<'EOF'
- **Root cause**: <one line>
EOFWhen a step delegates to a subagent or another skill (test-designer in Step 2; test-deduplicator, /simplify, and /resolve-diagnostics in Step 8), append the note yourself from what it returns — they do not write to this file.
Step 1: Clarify the Bug Report
Work from the user's report, specs, and design docs only — do not read code yet. Reading the implementation here biases "Expected" toward what the code does rather than what the spec says.
Extract the following from the user's prompt:
- Condition: the setup or scenario that triggers the bug
- Expected: the expected behavior
- Actual: the observed behavior
If any of the three cannot be determined from the prompt, use AskUserQuestion to ask
the user before proceeding. All three must be known before moving to Step 2.
Also determine the report type:
- Existing test failure — the user reports that an existing test is failing. The specific failing test method need not be known at this stage; note the scope (class name, scene name, or test assembly) from the prompt. Step 2 is skipped — proceed directly to Step 3.
- Behavioral bug — the user describes unexpected runtime behavior with no mention of a failing test. Proceed normally through Step 2.
Also check the relevant documentation (specs, design docs) for consistency with the
user's bug report. If the documentation and the report conflict, use AskUserQuestion
to clarify with the user which is correct. If the docs contain errors or are missing
relevant information, add them to the list of files to be modified in this bug fix.
Step 2: Write the Reproduction Test
Skip this step if Step 1 identified this as an existing test failure case. Proceed directly to Step 3.
Search the project's test code for existing tests closest to the bug scenario. These serve two purposes:
- Placement anchor — add the reproduction test nearby
- Style reference — follow the same test conventions
When the bug condition involves on-screen display or a user-facing UI operation, search for integration tests with UI operations or visual verification tests — the reproduction test must be at that layer, so the placement anchor and style reference must be too.
Use Explore agents to locate relevant test files and test cases.
Launch the test-designer agent to design the reproduction test case — do not design it in the main context. Set an Opus-class or more capable model in the model parameter, so test design stays on a strong model even when the main session runs on a faster one. Use the following prompt structure:
## Requirements
[Bug report from Step 1: Condition / Expected / Actual.
Task type: bug-fix — design a reproduction test and regression tests per the reproduction-tests section of the guide.]
## Implementation Design
[Existing class/method structure of the affected production code, from the Explore results — this is the design; there is no new design for a bug fix]
## Existing Code Context
[Nearby test files, test classes, and conventions found above]
## Language Convention
[Project language resolved from CLAUDE.md; default English]From the agent's output, take the test case marked (reproduction test). Keep any regression test cases for Step 6 — do not implement them yet.
Then load the test-writing-guide and code-writing-guide skills — test code is code, so both guides apply; do not rely on automatic skill triggering — and implement the reproduction test. Place it near the similar tests found above.
If an existing test is testing the wrong behavior (i.e., the test itself is buggy), rewrite that test to correctly reproduce the bug rather than adding a new one.
Step 3: Verify the Reproduction Test Fails
Run tests using the /run-tests skill and verify that the reproduction test fails:
- If a test was added in Step 2: run that specific test.
- If Step 2 was skipped (existing test failure): narrow down the test to run using the scope identified in Step 1 (e.g., a specific test class or assembly). If narrowing down is not possible, run all tests.
If multiple tests fail and it is unclear which one corresponds to the reported bug, use
AskUserQuestion to ask the user which test to focus on.
If the test does not fail (Step 2 path only)
- Delete the reproduction test
- Return to Step 2 and search more broadly
If reproduction has been attempted 3 times without success, return to Step 1 and
use AskUserQuestion to re-clarify the bug report with the user.
Step 4: Confirm Reproduction with User
Present the reproduction evidence to the user via AskUserQuestion before proceeding.
Include:
- Reproduction test: file path and method name
- Test failure message (actual output from the test run)
Once the user confirms the reproduction is as expected:
- Commit the reproduction test — if test code is modified in a later step, the integrity of Test First is compromised; commit here without fail so the diff remains verifiable
- Proceed to Step 5
Step 5: Diagnose & Formulate Fix
With the reproduction confirmed, investigate the root cause:
- Trace through the code path triggered by the reproduction test
- Identify the specific line(s) or logic responsible for the bug
- Formulate a fix
Step 6: Regression Test Coverage
Before applying the fix, check whether the affected area has adequate coverage for adjacent behavior:
- Start from the regression test cases the
test-designeragent produced in Step 2 (if Step 2 ran) - Read the test files for the affected production code
- Identify behaviors that could regress from the change but are not currently tested
- If gaps exist, add regression tests (per
test-writing-guide) and run them — they must pass (they test existing correct behavior, not the bug itself)
Step 7: Apply Fix & Verify
- Load the
code-writing-guideskill — do not rely on automatic skill triggering - Apply the fix formulated in Step 5 to the production code
- Run all affected tests using
/run-tests - Confirm:
- The reproduction test now passes (bug is fixed)
- All regression tests still pass
- Commit production code fix to git (includes regression tests from Step 6 and any unavoidable changes to the reproduction test)
Step 8: Refactoring
- Launch
test-deduplicatoragent with: list of test files added or modified in this iteration - Run the Claude Code built-in
/simplifyskill (Skill({skill: "simplify"})— not a plugin skill) to apply quality improvements to the modified code - Re-run tests using
/run-testscommand to confirm they still pass - Run
/resolve-diagnosticswith the files added or modified in this iteration — compute the list after thetest-deduplicatoragent and/simplifyfinish, so their edits are covered too - Commit all remaining changes to git
Step 9: Implementation Notes
Read<scratchpad>/implementation-notes.mdif it exists- Report the entries to the user in chat under an
## Implementation Notesheading — one bold sub-heading per category, each followed by a bullet list. Always include all six categories in this order: Bug report clarifications, Root cause, Ruled out, Tradeoffs, Test changes, Open questions. Write- Nonefor any category with nothing recorded, and add any last-minute Open questions before finalizing. If the file was never created, report every category as "None" - Delete the temporary notes file if it exists
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
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.

