unit-test-author
Installation
SKILL.md
Unit Test Author
Overview
This skill produces unit tests that are correct, behavior-focused, exhaustive on edge cases, and resistant to brittleness. It applies across languages and frameworks and emphasizes testing observable behavior over implementation details.
Keywords: unit test, test coverage, edge cases, table-driven, parametrize, mock, stub, spy, fake, fixture, AAA arrange-act-assert, flaky test, property-based, snapshot, regression test, pytest, Jest, Vitest, Go test, JUnit, RSpec, xUnit, NUnit, Rust test.
Use this skill whenever the goal is to create or strengthen unit tests for a specific function, class, or module — not for end-to-end or load testing.
Core Principles
- Test behavior, not implementation. Assert on outputs, return values, raised errors, and observable side effects — never on private internals that can change without breaking the contract.
- One logical concept per test. A test may have several assertions, but they should all verify a single behavior. If a test name needs "and", split it.
- Deterministic always. No real clocks, randomness, network, filesystem, or ordering assumptions unless explicitly under test. Inject or freeze them.
- Arrange-Act-Assert (AAA). Visually separate setup, the single action, and verification. Keep the "act" to one call.
- Fail for one reason. When a test fails the message should point to the cause. Prefer precise assertions over
assertTrue(x == y). - Cover the contract, then the edges. Happy path first, then boundaries, then error/exception paths.