dev-test-driven-dev

Writes NUnit EditMode and PlayMode tests for Unity C# logic before implementation.

Updated Apr 13, 2026
One-click install
npx skills add https://github.com/Unity-UPM-Packages/Antigravity-skills --skill dev-test-driven-dev-unity-upm-packages
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dev-test-driven-dev
Source: https://github.com/Unity-UPM-Packages/Antigravity-skills/tree/main/.agents/skills/dev-test-driven-dev
Command: npx skills add https://github.com/Unity-UPM-Packages/Antigravity-skills --skill dev-test-driven-dev-unity-upm-packages

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? AI-generated Unity code often ships without verification, forcing developers to manually debug untested logic. This Skill enforces a test-driven workflow where NUnit tests are written first and all code is proven correct via the Unity Test Framework before human review. ## Core Features & Use Cases - Red-Green-Refactor Workflow: Guides writing failing NUnit tests first, then minimal implementation, then safe refactoring. - EditMode and PlayMode Coverage: Provides patterns for pure C# logic tests, MonoBehaviour lifecycle tests, and physics or time-based scenarios. - Mocking with NSubstitute: Isolates systems under test from dependencies using interface substitutes and event raising. - Use Case: When implementing a health system, the AI writes tests for damage clamping, death events, and healing limits first, then implements the HealthSystem class until all tests pass. ## Quick Start Ask the AI to implement a new game mechanic using test-driven development with Unity NUnit EditMode tests.

Frequently Asked Questions about dev-test-driven-dev

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write unit tests for Unity C# code?▼

Write NUnit tests in an EditMode test assembly for pure C# logic like damage calculations or state machines. Use the Unity Test Framework with [TestFixture] and [Test] attributes, and place tests in a Tests/EditMode folder with its own .asmdef file.

What is the difference between EditMode and PlayMode tests in Unity?▼

EditMode tests run fast without a scene and suit pure logic, math, and state machines. PlayMode tests run in a live scene and are required for MonoBehaviour lifecycle behavior, physics, collisions, and time-based logic using [UnityTest] with coroutines.

How do I mock dependencies in Unity tests with NSubstitute?▼

Use Substitute.For<IInterface>() to create a mock of the dependency interface, inject it into the system under test, and simulate events with Raise.Event<Action>(). This isolates logic from scene dependencies without manual stub classes.

When should I use PlayMode tests instead of EditMode tests?▼

Use PlayMode tests when verifying MonoBehaviour lifecycle methods like Awake and Start, physics interactions, UI event bindings, or anything requiring a live GameObject. EditMode tests cannot instantiate scene-dependent behavior reliably.

What should I do when a Unity test fails after implementation?▼

Read the assertion error message precisely, trace the failure to the exact line, and fix the production implementation. Never weaken or modify the test to make it pass, then re-run until all tests are green.