No slash command · from unity-coding-skills
Provides guidelines for writing test code in Unity projects, covering test design tags, test basis documentation, and category conventions. Load this skill when creating or modifying test files under Tests/.
Ships in unity-coding-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Guide for writing test code for Unity projects.
Test code is code: load the code-writing-guide skill too, which holds the Unity rules that apply to every code file (checking Play Mode before editing, never creating .meta files, etc.).
Terms:
existing.test fix or spec change, change the existing test to match the test case instead of adding a new one.**unverifiable**, **undefined**, or **ambiguous**: the test cannot arrange its input, cannot observe its actual result, or has no single expected result to assert.List the test bases at the top of each test file you write or modify, below its header comment if any, one // Test-basis: line each:
// Copyright (c) 2026 Example Inc.
// Test-basis: docs/battle.md
// Test-basis: https://github.com/owner/repo/issues/42
using NUnit.Framework;
The file is the unit: /measure-spec-coverage finds a file by these lines and reads every test class in it, so one file needs no rule on which of its classes is the test class.
### Test basis headings instead of the document itself: a test design document is no test basis/measure-spec-coverage uses them only to find the tests of a specification, and reads the tests themselves to judge what they coveracceptance in the test design, apply [Category("Acceptance")] to the test method.[Category("Integration")] to the test method.Arrange the input values the test design states — the parameters of a parameterized test and the input values in the Verification column — as given: the expected result depends on them. Give every other value — the values the test's outcome does not depend on, e.g., an argument of the SUT, a field of an object passed to the SUT, the default of a creation-method parameter — a value that declares "this value does not matter here":
0, null, false, empty string/collection.
A domain-plausible value (e.g. hp = 79) reads as a deliberate Arrange choice, and no reader can tell it apart from a value the outcome depends on.0/null breaks the object graph or crashes something downstream — then nothing can mean "does not matter", so the test states the value it needs.
Substituting a different "safe" value just hides the same problem behind a less obvious number.A value no assertion can depend on (e.g. a display name used only for logging) genuinely does not matter, so a descriptive placeholder such as "TestEnemy" is fine in place of null — but default to neutral, and deviate only when you can state why the value is provably inert.
Use a creation method for objects needed in tests:
private SomeClass CreateSystemUnderTest() { ... }
Give a creation-method parameter a default so that tests state only the values their outcome depends on, and pick it per Neutral Values. If no neutral value works, give no default at all: make the parameter required so every call site states its own value.
// Do NOT do this — 79/80 reads as an intentional Arrange choice; 2 silently hides that 0 throws
private RunState CreateRunState(int hp = 79, int maxHp = 80) { ... }
private static Catalog CreateCatalog(int midCount = 2) { ... }
// Do this — neutral where a "does not matter" value exists; required where none does
private RunState CreateRunState(int hp = 0, int maxHp = 0) { ... }
private static Catalog CreateCatalog(int midCount) { ... }
Implement a test case whose Test case column has parameters after the method name as one parameterized test.
The parameter notation of the test design and the attribute that implements each form are in unity-test-framework.md → Parameterized Tests.
Implement a test case the test design gives as a layout assertion test — the element is within the screen, elements do not overlap, text does not overflow its container — with deterministic assertions, as designed; do not substitute a screenshot: a boolean assertion runs unattended in CI, and an overlap assertion names the two elements where a screenshot cannot.
The constraint that implements each condition, and the layout settling to do before asserting, are in test-helper.md → Layout constraints.
In an integration test of a scene, prefab, or screen, find a GameObject the user interacts with through GameObjectFinder, reproduce the user's operation (click, drag, text input) through an operator, and verify that a modal or overlay blocks the elements behind it by their reachability; never through GameObject.Find, a direct event invocation, or a field assignment.
The APIs and the reasons are in test-helper-ui.md: read it before writing or modifying such a test.
When implementing a visual verification test (a test designed to verify on-screen rendering via screenshot and image analysis):
[TakeScreenshot] or ScreenshotHelper.TakeScreenshotAsync() (see test-helper.md).[Description("After running this test, verify the screenshots from the following perspectives: <verification aspects>")] to the test method.
The verification aspects are taken directly from the Image analysis by saved screenshot column in the test case design.[Category("VisualVerification")] to the test method.Assert statements.When a designed visual verification test shares its test condition with a designed layout assertion test, you may implement both as a single test method: take the screenshot in the layout assertion test, apply steps 2–3 to it, and keep the layout assertions (step 4 does not apply).
Read the appropriate resource file based on the situation:
${CLAUDE_SKILL_DIR}/resources/unity-test-framework.md and ${CLAUDE_SKILL_DIR}/resources/test-helper.md${CLAUDE_SKILL_DIR}/resources/test-doubles.mdTestHelper.Statistics namespace API: Read ${CLAUDE_SKILL_DIR}/resources/test-helper-statistics.md${CLAUDE_SKILL_DIR}/resources/test-helper-ui.mdcom.unity.test-framework.performance, [Performance], Measure.*): Read ${CLAUDE_SKILL_DIR}/resources/unity-test-framework-performance.mdresources/test-doubles.md (opens in a new tab)resources/test-helper-random.md (opens in a new tab)resources/test-helper-statistics.md (opens in a new tab)resources/test-helper-ui.md (opens in a new tab)resources/test-helper.md (opens in a new tab)resources/unity-test-framework-performance.md (opens in a new tab)resources/unity-test-framework.md (opens in a new tab)scripts/create_test_asmdef.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
12 skills in this plugin
/code-writing-guideProvides coding guidelines for Unity projects. Make sure to use this skill whenever writing, creating, editing, or modifying code files. This includes implementing new features, fixing bugs, refactoring, adding tests, or any task that results in code changes. Even for small edits or one-line fixes, load this skill to ensure project conventions are followed./design-testsDesigns tests from a specification, whatever document states it — a requirements document, design docs, or an ADR: extracts the test targets, then creates test cases for each target at the test level of its subject — e.g., integration tests for a scene or prefab, unit tests for a class's API. Use this skill whenever the specification is settled and the next step is to design the tests./edit-sceneCreates and modifies Unity scene and prefab files. Use this skill whenever creating, editing, or modifying .unity scene files or .prefab prefab files. This includes adding GameObjects, building uGUI hierarchies, wiring up components, and any task that results in changes to .unity or .prefab files./find-and-setup-analysis-ruleFinds an analysis rule that flags a given coding pattern — a Roslyn analyzer package, an IDE inspection, an IDE plugin, or a custom Roslyn analyzer — and sets it up in the Unity project at `warning` or higher severity. Use this skill when the user wants a coding pattern flagged as the code is written, e.g., to keep a fixed bug from recurring, to ban an API, to cap method complexity, or to enforce a coding rule. Also use it when the user wants a named Roslyn analyzer package installed in the Unity project./fix-bugDiagnoses 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./implementImplements a feature or a specification change test-first, phase by phase from the parts with no dependencies up: each phase designs its missing test cases, then writes failing tests and the production code that passes them. Use this skill whenever the user asks to implement or add a feature, or to change an existing specification.npx claudepluginhub nowsprinting/unity-coding-skills --plugin unity-coding-skillsOther plugins' skills for the same job