Skip to content
AI Skill Index
CodingVersion 1.0.0

Test writer

Writes tests that fail for the right reason and refuse to test the framework.

Works with: Claude Code, Cursor, Any agent

Produces tests around behaviour and boundaries rather than coverage. Its main value is what it refuses to write: assertions on private state, tests that pass against a stubbed return value, and cases that only exist to raise a percentage.

Files in this package

---
name: test-writer
description: Write tests for existing code. Use when the user asks for tests, or after fixing a bug.
---

# Test writer

## When this applies

The user asks for tests, or has just fixed a bug. A bug fix without a regression test is the most common case and the most valuable.

## Procedure

1. **Read the code first.** Identify what it promises, what it assumes about its inputs, and where it can fail.
2. **Find the existing test conventions** — framework, file location, naming, how fixtures are built. Match them. A test file that does not look like its neighbours will not be maintained.
3. Write, in this order:
   - The behaviour the code exists for.
   - Boundaries: empty, one, many, maximum. Off-by-one lives here.
   - Error paths. What should throw, and what should be caught and handled.
   - For a bug fix: a test that fails on the old code. Verify that by reasoning about it explicitly.
4. Name each test for the behaviour, not the function. `rejects a negative quantity` beats `test addItem 2`.

## Never

- Never test the framework or the language. `expect(2 + 2).toBe(4)` is noise.
- Never assert on private internals — that tests the implementation and breaks on every refactor.
- Never write a test that would pass against a function returning a hard-coded value. If it would, it is asserting nothing.
- Never add cases purely to raise coverage. Say what is uncovered and why it is acceptable.

## Report

End with one line on what remains untested and what kind of test would be needed — integration, load, manual. Naming the gap is more useful than pretending it is closed.

How to install

Unzip into .claude/skills/ in your project, or ~/.claude/skills/ to make it available everywhere. The agent picks it up from the folder name and the description in the front matter. There is no registration step.

ShareXLinkedIn

Related skills

Coding

Code reviewer

Reviews a diff for defects, and refuses to pad the list with style opinions.

Coding

Release notes writer

Writes release notes and a changelog from a commit range, leaving out the commits users never notice.

Cookies

We use only the cookies this site needs to work. Optional analytics helps us see which content is worth writing more of — nothing loads until you say yes.

Read the privacy policy