fix-bug
Skill15 starsChanged 8 months agoMITView on GitHub
You MUST use this skill before writing any fix or editing any code to address a bug. Use when the code should do X but currently does Y — restoring correct behavior in existing code. Stronger signals: error messages, stack traces, "not working", "broken", "failing", "regression", "it used to work". Use sextant:debug instead when you have a symptom but cannot yet point to a specific file or line. Use sextant:modify-feature instead when the requirement itself is changing, not just broken behavior.
21 other projects use a version of this.
Adopted by
Most recently taken up by
- tddworks/ClaudeBartheir own version, first seen Oct 5, 2026
- hawkyre/hawk-skillstheir own version, first seen Sep 28, 2026
- abigayleh/claude-workflow-plugintheir own version, first seen Sep 27, 2026
- mthines/agent-skillstheir own version, first seen Sep 25, 2026
- mgiovani/cc-arsenaltheir own version, first seen Sep 25, 2026
- rmstdope/cerebrotheir own version, first seen Sep 24, 2026
Used with
Projects with it also use implement-feature, refactor and 2 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.
tddworksSkillimplement-feature
Guide for implementing features following architecture-first design, TDD, rich domain models, and Swift 6.2 patterns. Use this skill when: (1) Adding new functionality to a Swift 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 4 projects that use this
GitHubSkillrefactor
Surgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, improving type safety, eliminating code smells, and applying design patterns. Less drastic than repo-rebuilder; use for gradual improvements.
Also in 6 projects that use this
HashiCorpSkillchangelog
Add a `.changelog/<PR_NUMBER>.txt` entry for a GitHub Pull Request, commit, and push.
Also in 3 projects that use this
ElasticSkillcreate-skill
Interactively create a new Claude Code skill and add it to the elastic-docs-skills catalog. Use when the user wants to generate a new skill, scaffold a slash command, or build automation for docs tasks.
Also in 3 projects that use this
Other versions21 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 21
- JetBrains/Exposed★ 9.3ksame name
- bytebase/dbhub★ 3.6ksame name
- tddworks/ClaudeBar★ 1.5ksame name
- danielvm-git/bigpowers★ 252same name
- tddworks/SkillsManager★ 168same name
- AlemTuzlak/skills★ 42same name
- hawkyre/hawk-skills★ 30same name
- nowsprinting/unity-coding-skills★ 20same name
- YehudaFrankel/clankbrain★ 16same name
- mthines/agent-skills★ 13same name
11 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 repository12 other files it gives its agents.
- add-featureSkill
- debugSkill
- migrateSkill
- modify-featureSkill
- planSkill
- sextantSkill
- refine-requirementsSkill
- review-codeSkill
- securitySkill
- shipSkill
- tool-gitnexusSkill
- write-testsSkill
The file
We split this skill into the rules it gives an agent
12 rules. 0 are common, 10 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 21 edited versions we read keep these.
10
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
- Distinctive: line 31
When fixing bugs, make surgical modifications to the existing solution — do not start over with a rewrite.
- Distinctive: line 53
Before making any changes, confirm:
- Distinctive: line 62
Check whether implicit state assumptions have been violated (e.g., a variable expected to be non-null is actually null)
- Distinctive: line 69
After locating the root cause, assess the potential impact of the fix:
- Distinctive: line 95
After completing the Impact Assessment, before writing any code, use the confirmation gate with:
- Distinctive: line 118
If user selects "No": ask *"What direction would you prefer?"*, incorporate their feedback, update the Proposed Fix Plan, and use the …
- Distinctive: line 128
No hitchhiking: Don't "optimize" unrelated code while fixing a bug — this introduces new regression risk
- Distinctive: line 151
After completing the fix, check:
- Distinctive: line 172
Delete the old function and write a new "better" replacement (unless the user explicitly requests refactoring)
- Very specific: line 174
Use a temporary patch to work around the problem without fixing the root cause (e.g., adding try/except to swallow the exception)
- Very specific: line 207
If .sextant/state.json exists in the project root and the current task matches a sprint task:
- Distinctive: line 213
Do not write the file without explicit user confirmation.
“Common” is measured: kept by at least 6 in 10 of the 21 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
!../principles/SKILL_BODY.md
!../tool-gitnexus/SKILL_BODY.md
Bug Fix Workflow
Disambiguating fix-bug vs modify-feature
Use this skill when: the code should do X but does Y — you want to restore correct behavior. Use modify-feature when: the code does X correctly — you want it to do Z instead (desired behavior changed).
Quick test: "Did this ever work correctly, or was it always intended to work differently?" → Yes, it used to work / should work → fix-bug (continue here). → No, the requirement itself is changing → stop. Tell the user: "This looks like a behavior change rather than a bug fix — the modify-feature workflow is a better fit. You can say something like 'refactor/change how X works' to trigger the right workflow, or tell me to proceed anyway and I'll apply baseline rules only." Do not proceed unless the user explicitly says to proceed.
Edge case: A feature never implemented but expected is a bug only if it was promised in an interface contract; otherwise stop and direct the user to
sextant:add-feature.
Core Principle
When fixing bugs, make surgical modifications to the existing solution — do not start over with a rewrite.
Complete Execution Workflow
Progress tracking: At the start of each step, output an updated progress block so the user always knows where you are. Use this format:
Bug Fix Progress ✓ Step 1: Reproduce & Locate — <one-line finding> ✓ Step 2: Impact Assessment — Risk: <Low/Medium/High> → Step 3: Minimal-Change Fix — in progress ○ Step 4: Boundary ValidationReplace
○with→for the current step, and✓once complete.
Step 1: Reproduce and Locate the Root Cause
Before making any changes, confirm:
- What is the specific manifestation of the bug? (Error message, abnormal behavior, data anomaly)
- What are the trigger conditions? (Specific input, timing, environment)
- Where is the root cause? (Don't fix the symptom — find the source)
Localization techniques:
- Starting from the error manifestation, trace the call chain upward to the earliest point of failure
- Distinguish between "where the bug is exposed" and "where the bug originates" — they are often not the same place
- Check whether implicit state assumptions have been violated (e.g., a variable expected to be non-null is actually null)
- Pay attention to boundary conditions: null values, zero values, overflow, concurrency races, type mismatches
🔗 When GitNexus is available, use context / trace MCP tools for enhanced root-cause tracing.
Step 2: Impact Assessment
After locating the root cause, assess the potential impact of the fix:
- Which callers does this function/method have? Will their behavior change after the fix?
- Does the bug location involve a public interface? Will the fix change the interface contract?
- Is there other code that depends on the bug's behavior? (Sometimes bugs have existed so long that other code has adapted to the erroneous behavior)
🔗 When GitNexus is available, use impact MCP tool to enumerate callers automatically.
─── Bug Impact Assessment ───────────────────────────
Bug location: <file/function name>
Root cause: <brief description>
Number of callers: <N>
Involves public interface: Yes / No
Possible code depending on buggy behavior: Yes (explanation) / No
Fix impact scope: Internal only / Affects callers / Cross-module
Risk level: Low / Medium / High
─────────────────────────────────────────────────────When risk level is "High" (involves public interface or cross-module), you MUST inform the user of the impact scope and confirm before fixing.
Confirmation Gate (between Step 2 and Step 3)
After completing the Impact Assessment, before writing any code, use the confirmation gate with:
- question: A concise Proposed Fix Plan (see format below)
- options:
"Yes, apply the fix""No — let's discuss a different approach"
Proposed Fix Plan format:
Root cause : <one sentence>
What changes : <file:line-range — what will be added/removed>
Callers affected : <N callers — names>
Risk : <Low / Medium / High> — <one-sentence justification>Decision rules by risk level:
| Risk | Behavior |
| High | Always use the confirmation gate. Do not touch any file until user selects "Yes". |
| Medium | Always use the confirmation gate. Do not touch any file until user selects "Yes". |
| Low | Use the confirmation gate with an additional option "Yes, and skip confirmations for low-risk fixes in this session". If the user selected that option earlier in the current conversation, proceed directly without using the confirmation gate for subsequent low-risk fixes — this preference is session-scoped only. |
If user selects "No": ask "What direction would you prefer?", incorporate their feedback, update the Proposed Fix Plan, and use the confirmation gate again before proceeding.
Step 3: Minimal-Change Fix
Execution discipline:
- Only change the part of code that causes the bug — do not expand the scope of changes
- Maintain style consistency: The fix code is fully consistent with surrounding code style (naming, indentation, comment language)
- Annotate changes: Comments explaining the fix reason, format:
# fix: <reason description> - No hitchhiking: Don't "optimize" unrelated code while fixing a bug — this introduces new regression risk
✅ Correct fix approach:
def calculate_discount(price, rate):
# fix: rate = 0 causes division by zero; added boundary check
if rate <= 0:
return price
return price / rate❌ Incorrect fix approach:
# Rewrote the entire function — introduces unnecessary change risk
def calculate_discount(price, rate):
if not isinstance(price, (int, float)): # Added type checking (not part of this bug)
raise TypeError("...")
validated_rate = max(rate, 0.01) # Changed boundary strategy (not the original behavior)
return round(price / validated_rate, 2) # Added rounding (not part of this bug)Step 4: Boundary Validation
After completing the fix, check:
─── Fix Verification Checklist ──────────────────────
[ ] Is the original bug fixed? (Verify with original trigger conditions)
[ ] Is the normal path still correct? (Regression validation)
[ ] Are related boundary conditions handled correctly? (Null, zero, extreme values)
[ ] Does the fix introduce new boundary issues?
[ ] Does caller behavior still match expectations?
[ ] Do related unit tests pass? If new tests are needed, use the sextant:write-tests skill
with bug-fix context: root cause (Step 1) + impact scope (Step 2) already resolved.
[ ] Is the style consistent with surrounding code?
─────────────────────────────────────────────────────Report to the user: Fix complete ✅ or Additional issues found ⚠️ (with description).
Forbidden Actions
- Delete the old function and write a new "better" replacement (unless the user explicitly requests refactoring)
- "Optimize" unrelated code while fixing a bug (introduces new variables, increases regression risk)
- Use a temporary patch to work around the problem without fixing the root cause (e.g., adding
try/exceptto swallow the exception) - "Mask" the bug with defensive code without understanding the root cause
Exceptions (Require Explicit User Authorization)
The following situations can break the "minimal change" principle, but must be initiated by the user:
- User says "this approach has fundamental flaws, try a different approach"
- User says "redesign this module/component"
- User says "refactor this part of the code while you're at it"
Even when the user authorizes expanding the scope, fix the bug first, then refactor — do it in separate steps, don't mix them together.
Common Bug Pattern Quick Reference
| Bug Pattern | Typical Manifestation | Investigation Direction |
| Null/None reference | NoneType has no attribute | Check if data source can be null/None |
| Out-of-bounds access | IndexError / KeyError | Check collection length / key existence |
| Concurrency race | Intermittent errors, data inconsistency | Check if shared state reads/writes are locked |
| Type mismatch | TypeError / implicit conversion error | Check type consistency across layers |
| State leak | Previous call's state affects the next | Check for unreset global/class-level variables |
| Missing boundary | Abnormal behavior for specific inputs | Check null, zero, negative, very large values |
| Async timing | Callback/Promise order doesn't match expectation | Check missing await, event order |
| Configuration error | Only occurs in specific environments | Check env vars, config file differences |
Sprint State Integration
If .sextant/state.json exists in the project root and the current task matches a sprint task:
- On start: offer to update the task's
statusfrompending→in_progress. Ask: "Update sprint state to mark Task N as in_progress?" - On completion (acceptance condition met): offer to update
statustodone. Ask: "Update sprint state to mark Task N as done?" - On blocker (test failure, missing dependency, unresolvable ambiguity that halts progress): surface the issue, then ask: "Mark Task N as blocked and record the reason in flags?" If confirmed, set
status: "blocked"and append{"task": N, "reason": "<one-sentence blocker description>"}to the top-levelflagsarray. Do not proceed to the next task while a task is blocked.
Do not write the file without explicit user confirmation. If the user declines, continue without state updates.
Reply Format
Lightweight task (single function, < 50 lines changed): one sentence only.
✅ Fixed `<function>`: <root cause> — <what changed> (<file>:<line>).or if something needs attention:
⚠️ Fixed `<function>`: <root cause> — <what changed>. Note: <one risk or open question>.Medium/large task (cross-file, public interface, or high-risk): full block.
Fix Summary:
| # | Item | Detail |
| [1] | Conclusion | <one sentence: root cause + fix approach + outcome> |
| [2] | Changes | <files / functions modified, with line ranges> |
| [3] | Risks / Assumptions | <caller assumptions made; edge cases not yet covered> |
| [4] | Verification | <Step 4 checklist status; unit test pass / fail / not yet run> |
| [5] | Needs your input | <high-risk callers to review; tests the user should run> |
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.

