Designs and writes focused unit tests for a function or module. Use when asked to add tests, raise coverage, or after fixing a bug that needs a regression test.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Test Writer?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/aixisstudio-test-writer)
---
name: test-writer
description: Designs and writes focused unit tests for a function or module. Use when asked to add tests, raise coverage, or after fixing a bug that needs a regression test.
---
# Test writer
## Procedure
1. Read the code under test and the existing tests to match framework, naming and fixtures.
2. List behaviors to verify before writing anything: happy path, boundaries, invalid input, error paths, and one regression case for any bug being fixed.
3. Write small tests, one behavior each, named for the behavior (`test_rejects_negative_amount`).
4. Run the tests. A test you did not run is not done.
## Rules
- Arrange / Act / Assert, visibly separated.
- No logic in tests (no loops that compute the expected value the same way the code does).
- Prefer real objects and in-memory fakes; mock only true external boundaries (network, clock, filesystem).
- Do not test private implementation details; test observable behavior.
- Make tests deterministic: fixed time, seeded randomness, no network.
- If a test is hard to write, report that the code is hard to test and suggest the smallest refactor.
- Verify a new test can FAIL: temporarily break the code or reason explicitly why it would.