Skip to content
Back to skills

Fix Bug

ASecurity

Reproduce a defect, find its root cause, pin it with a failing test, fix it and check the neighbouring code for the same mistake. Use for "fix this bug", "it crashes when", "this returns the wrong value", "regression after the last change".

  • 11 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 5, 2026
ai-agentsgorefactoring

Security analysis

A100/100

Scanned December 5, 2026

npx -y skills add kinzarra/vibetrack --skill fix-bug --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Fix Bug?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Fix Bug
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/kinzarra-fix-bug/badge)](https://www.skillsdirectory.com/skills/kinzarra-fix-bug)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: fix-bug
description: Reproduce a defect, find its root cause, pin it with a failing test, fix it and check the neighbouring code for the same mistake. Use for "fix this bug", "it crashes when", "this returns the wrong value", "regression after the last change".
---

# Fix a bug

The result is a fix for the cause, not the symptom, with a test that fails without the fix and passes with it, and a report that names the cause.

## 1. Reproduce first

- Collect what the task gives: steps, input, expected and actual result, error text, stack trace, logs, version, environment, how often it happens.
- Reproduce it in the worktree with the shortest possible steps. Write the exact command or steps and the output.
- No fix is written before the bug has been seen. If it cannot be reproduced in 3 serious attempts (different data, configuration, order, timing), stop as blocked and say what was tried and which piece is missing: the input, the account state, the logs, the build.
- For an intermittent bug, find a way to make it frequent (a loop, a smaller timeout, a fixed seed, forced ordering) and record the failure rate, for example 7 of 50 runs.

## 2. Find the root cause

- Read the error and the stack trace to the end. Start from the first frame in the project's own code.
- State a hypothesis that can be proven false, then test it with one observation: a log line, a debugger stop, a narrowed test. Change one thing at a time.
- When the bug is a regression, find the change that introduced it: read the history of the lines involved, or bisect between a good and a bad revision when both are known.
- Ask "why" until the answer is a decision in the code, not a value: "the list is empty" is a symptom, "the filter runs before the data is loaded" is a cause.
- The cause is found when it explains every observed symptom, including why it worked before or works in other cases.

## 3. Write the failing test

- Add a test at the lowest level that still shows the bug, in the project's test style, named for the behaviour ("rejects an expired token"), not for the task number.
- Run it and see it fail with the same failure as the bug. A test that passes before the fix proves nothing.
- If the project has no tests or the bug cannot be reached by a test, write the manual steps instead and say so in the report.

## 4. Fix

- Fix where the wrong decision is made, not where the damage shows. A null check at the crash site is a fix only when null is a legal value there.
- Keep the change minimal. No refactoring, renaming or reformatting in the same change.
- Do not silence the error: no empty catch, no widened type, no skipped test, no raised timeout, no retry around a logic error.
- If the right fix is large or changes a public interface or the schema, make the smallest safe fix, describe the larger one as a follow-up, or stop as blocked when the small fix would be wrong.

## 5. Check the neighbours

- Search the codebase for the same pattern: copies of the code, other callers of the same function, the same assumption in sibling modules.
- Fix the same bug where it is proven and inside the task's area. List the other places in the report with file and line.
- Check whether the bug already wrote bad data. If it did, describe the damage and how to find the affected records; repair data only when the task asks for it.

## 6. Verify

- The new test passes. The original reproduction steps now give the expected result.
- For an intermittent bug, repeat the run that showed it at least as many times as before: 0 of 50, not "seems fine".
- Run the project's linter and its full test command. No new failures.
- Read the diff once more: only the fix and its test, no debug output left behind.

## 7. Report

1. **Symptom**: what the user saw, in one sentence.
2. **Reproduction**: the exact steps or command, before the fix.
3. **Root cause**: the file and line, what the code assumed and why that was wrong, and which change introduced it when known.
4. **Fix**: what was changed and why there.
5. **Tested**: the new test (name and file), the commands run and their results, the manual checks.
6. **Same bug elsewhere**: places fixed and places found but left, with file and line.
7. **Not covered**: what could not be verified, data that may need repair, follow-ups.

Rules: work only in the task's worktree. Do not commit, push, merge or deploy unless the task says so. Never paste secrets or personal data from logs into the report; mask them. When blocked, state exactly what is needed to continue.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.