SolidMITOriginal

Test Writer

Generates unit tests for a specific function or module with sensible edge cases — happy path, sad path, and 2-3 boundary cases.

Entry verified April 21, 2026

The short answer

The test-writing skill that bridges "I should add tests" and "I have tests". Takes a function, produces a test file covering the obvious paths plus a handful of edge cases. Not a replacement for thinking about tests — a replacement for the boilerplate around them.

When to use it

On pure functions (parsers, validators, formatters). On business-logic modules with clear inputs and outputs. Avoid for integration-heavy or UI-driven code where mocking cost exceeds the payoff.

Setup

  1. 1

    Save the file as ~/.claude/commands/test-writer.md.

  2. 2

    Skill reads the project's testing conventions — .claude/rules/testing.md if present, otherwise looks for a jest, vitest or mocha config.

  3. 3

    Invoke: /test-writer path/to/module.js; skill writes the matching test file.

  4. 4

    Verify the generated tests actually fail when the code is broken — otherwise you have tautological tests that pass regardless.

Example

You: /test-writer lib/claude-data.js
Claude: Writing tests/claude-data.test.js with 8 test cases covering getModelById happy path, legacy lookup, null input, and tier filter.

Source & attribution

Author
Bryan Collins + community pattern
Licence
MIT
Type
Original

Original pattern published under MIT — attribution preserved by convention, not licence requirement.

Caveats

Verify the tests actually fail when the code is broken — skill can produce tautological tests if the implementation leaks into the assertion.

New skills, explained plainly.

One short email when a new Claude Code skill is worth installing — and when to skip the hype. No spam.

56 skills across 10 categories, all licence-verified.