skills/fix-bug/SKILL.md
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.
npx skillsauth add nowsprinting/claude-code-settings-for-unity fix-bugInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
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.Do not read code files during this phase. You may only read specs and design docs.
Extract the following from the user's prompt:
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 Phase 2.
Also determine the report type:
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.
Skip this phase if Phase 1 identified this as an existing test failure case. Proceed directly to Phase 3.
Search the project's test code for existing tests closest to the bug scenario. These serve two purposes:
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.
Load the test-designing-guide skill to design the reproduction test case, then load test-writing-guide to implement it. Place the reproduction test 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.
Run tests using the /run-tests skill and verify that the reproduction test fails:
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 reproduction has been attempted 3 times without success, return to Phase 1 and
use AskUserQuestion to re-clarify the bug report with the user.
Present the reproduction evidence to the user via AskUserQuestion before proceeding.
Include:
Proceed to Phase 5 only after the user confirms the reproduction is as expected.
With the reproduction confirmed, investigate the root cause:
Before applying the fix, check whether the affected area has adequate coverage for adjacent behavior:
/run-testsgeneral-purpose subagent to check for duplicate test cases in the test files
added or modified in this iteration (plus any existing files in the same test class).
Subagent instructions:
warning or higher severity level: for each modified file,
run open_file_in_editor → mcp__ide__getDiagnostics → fix as a single set, one file
at a time (opening all files at once exceeds the editor tab limit)./run-tests command to confirm they still pass./code-review ${CLAUDE_EFFORT} skill, then apply the returned findings to fix
the code. For each finding: read the flagged code, understand the issue, and make the
correction. If the finding is a bug, write a reproduction test first, run it with
/run-tests to confirm it fails, then fix the bug./run-tests command to confirm they still pass.testing
Orchestrates the test-first implementation planning workflow for feature implementation and spec changes. Use this skill whenever plan mode is active and the task involves implementing or adding a new feature, or changing an existing specification. Even if the user only says "plan this" or "how should we implement this", load this skill to ensure the full test-first planning workflow is followed.
development
Creates and modifies Unity scene and prefab files. Use this skill whenever creating, editing, or modifying .unity scene files or .prefab prefab files, or writing editor scripts under Assets/Editor/ that generate or manipulate scenes, prefabs, or scene-bound assets. This includes adding GameObjects, building uGUI hierarchies, wiring up components, and any task that results in changes to .unity or .prefab files.
tools
Provides guidelines for directly editing Unity YAML-serialized asset files for Unity projects. Make sure to use this skill whenever creating, editing, or modifying simple YAML asset files (ScriptableObjects, Materials, etc.) via Edit/Write tools without going through the Unity Editor. This includes adjusting ScriptableObject field values, modifying material shader properties, or any task that results in direct changes to allowlisted Unity YAML asset files. Even for small edits or one-line value changes, load this skill to ensure Unity asset-YAML conventions are followed.
development
Provides test design methodology for Unity projects. Use this skill whenever designing test cases from requirements or specifications, including selecting test techniques, deriving test cases, and formatting them. Even for small features, load this skill to ensure test design rigor.