unit-testing
Installation
SKILL.md
Unit testing
A test earns its place by failing when something breaks and staying quiet otherwise. A test that never fails is documentation with a runtime cost; a test that fails on every refactor is a tax. Both get deleted eventually, and the second one takes the good tests' credibility with it.
Coverage is not the goal. Coverage measures which lines ran, not whether anything was checked — a suite that executes everything and asserts nothing scores beautifully and catches nothing.
1. Decide what deserves a test
In descending order of value:
- Logic with branches — conditionals, loops, calculations, parsing, state transitions
- Anything that has broken before — bugs cluster; a fixed bug without a test will return
- Boundaries — where data is validated, converted, or crosses a system edge
- Contracts other code relies on — a public API's shape and its documented failure modes