Skip to content
Testing
Skill

/fix-bug

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

From plugin
unity-coding-skills
2010 skills3 agents

Claude Code

$ npx -y skills add nowsprinting/unity-coding-skills --skill fix-bug --agent claude-code

SKILL.md

fix-bug.SKILL.md
name: fix-bug
description: >-
  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.
argument-hint: "[incident or failing-test-name]"
license: Unlicense
metadata:
  author: Koji Hasegawa

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:

  • `ExitPlanMode` is 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."

  • `ExitPlanMode` is 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>
EOF

When 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; defau
Read more
@nowsprinting
Ships withunity-coding-skills

A Claude Code plugin for Unity development that enables coding agents to work autonomously through a test-first workflow — writing reliable, maintainable tests before production code, then iterating to completion without constant oversight.

2010 skills3 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
20
Star history of nowsprinting/unity-coding-skills on GitHub, a chart by star-history.com

Other skills on unity-coding-skills.

More skills from other plugins.

api-review

api-review

Produce the "Playwright 1.xx API Review" artifact for a range of commits - the public API additions and the breaking or behavior…

@microsoft@microsoftInstall Skill
add-e2e-selectors

add-e2e-selectors

Add reliable @grafana/e2e-selectors to interactive elements and key containers in the Grafana frontend. Use when adding e2e…

grafana5d78k
@grafana@grafanaInstall Skill
promptfoo-evals

promptfoo-evals

Write, refine, run, and QA promptfoo evaluation suites: promptfooconfig.yaml, prompts, providers, vars, tests, assertions,…

promptfoo13d27k
@promptfoo@promptfooInstall Skill
deepeval

deepeval

DeepEval evaluation workflow for AI agents and LLM applications. TRIGGER when the user wants to evaluate or improve an AI agent,…

@confident-ai@confident-aiInstall Skill

Questions about fix-bug.

Which coding agents can use fix-bug?
fix-bug installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.