Test Writer
Generates unit tests for a specific function or module, with sensible edge cases.
Entry verified April 20, 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 with happy-path, sad-path, and 2-3 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 I/O. Avoid for integration-heavy or UI-driven code.
Setup
- 1
Save as ~/.claude/commands/test-writer.md.
- 2
Skill reads the project's testing conventions (.claude/rules/testing.md or looks for jest/vitest/mocha config).
- 3
Invoke: /test-writer path/to/module.js
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.
Browse more skills
47 skills across 10 categories, all licence-verified.