Skill

Test writer

Writes tests for a function or file using the testing tools your project already has, and runs them to check they pass.

Free For Claude Code

How to use it

  1. Save the file below as .claude/skills/test-writer/SKILL.md in your project.
  2. Run it in Claude Code with /test-writer.

SKILL.md

.claude/skills/test-writer/SKILL.md
---
name: test-writer
description: Writes automated tests for existing code. Use when the user asks for tests, wants more coverage, or has just added a function without tests.
---

1. Find out which test framework the project uses (check the dependency file and existing test files). Use that one. Do not add a new framework.
2. Match the naming and folder conventions of the existing tests.
3. Cover the normal case, edge cases (empty, very large, invalid input) and one failure case.
4. Run the tests. If one fails, decide whether the test or the code is wrong and tell the user which.

Keep tests small and readable. Never change the code under test unless the user agrees.