skills/unity-test-unit/SKILL.md
Use this skill to write Edit Mode and Play Mode unit tests for Unity C# using Arrange-Act-Assert pattern with 10+ test cases per class. Use when the user says "write tests," "unit test this class," "add test coverage," "create tests for X," or wants automated verification of a MonoBehaviour, ScriptableObject, or utility class. Do not use for manual QA test case documentation — use unity-test-case for that.
npx skillsauth add cuozg/oh-my-skills unity-test-unitInstall 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.
Write Unity unit tests: Edit Mode + Play Mode, Arrange-Act-Assert, minimum 10 test cases per class.
Category 1: Valid Data (Happy Path) — normal inputs → correct output, typical combinations, state transitions with valid triggers.
Category 2: Invalid/Malformed Data (CRITICAL) — test every failure path with same rigor as happy paths:
[SerializeField], null from GetComponent<T>()"", " ", new List<T>(), new T[0], empty ScriptableObjectint.MaxValue/MinValue, float.NaN, float.PositiveInfinity(MyEnum)999, invalid GUID/path, strings with <script>, \0, \nDestroy(), wrong sequence, on disabled/destroyed componentAssert specific behavior per failure path: Assert.Throws<ArgumentNullException> (not just Assert.Throws<Exception>), Assert.IsNull, explicit state check. Never assert only "it doesn't crash."
Category 3: Boundary Values (REQUIRED) — at-min · at-max · just-below-min · just-above-max · midpoint. For collections: empty · single-element · first/last element.
Minimum distribution: 3+ valid · 3+ boundary · 4+ invalid = 10+ total per class.
[Test] or [UnityTest]"" and " " testsAssert.Throws<T> for expected exceptions — never catch-and-ignoreMethodName_Condition_ExpectedResult (e.g. _WithNullInput_, _AtMaxBoundary_)Assets/Tests/EditMode/ or Assets/Tests/PlayMode/[SetUp]/[TearDown] to prevent state leakage[TestCase] for parameterized variantsDebug.Log in tests — Assert onlyVia read_skill_file("unity-test-unit", "references/<file>"):
test-patterns.md — data-focused patterns, NSubstitute mockingunity-test-attributes.md — [Test], [UnityTest], Edit vs Play modeVia read_skill_file("unity-standards", "references/test/<file>"):
edit-mode-patterns.md · play-mode-patterns.md · naming-conventions.md · coverage-strategy.mdtools
Generate Unity raster image assets through Unity MCP: game sprites, item art, backgrounds, UI icons, portraits, concept images, transparent cutouts, image edits, upscales, background removal, and Unity scene or Game View screenshots. Use when a Unity project needs image files imported under Assets or screenshots captured from the editor. Do not use for meshes, audio, animation, materials, gameplay code, UI Toolkit layout, or generic non-Unity image generation.
tools
Create Unity technical solution documents from user requirements, feature ideas, bug goals, specs, or codebase problems. Use when the user asks for a technical approach, architecture, implementation strategy, solution options, feasibility analysis, system design, or "how should we build/fix this" for Unity runtime, Editor, tools, assets, data, UI, WebGL, SDKs, or production pipelines.
tools
Orchestrate Unity Editor via MCP (Model Context Protocol) tools and resources. Use when working with Unity projects through MCP for Unity - creating/modifying GameObjects, editing scripts, managing scenes, running tests, or any Unity Editor automation. Provides best practices, tool schemas, and workflow patterns for effective Unity-MCP integration.
development
Convert a spec document into an implementation TODO list in the same spec folder. U se when the user says goal-todo, todo from spec, generate tasks from spec, turn this spec into todos, create implementation checklist, extract tasks, or asks to read a Docs/Specs design doc and produce what must be implemented. Includes UI/UX review and codebase investigation before writing the checklist. Do not use for implementing the tasks, creating new goal files, writing test cases, or verifying completed work.