PromptItIn logoPromptItIn
Coding skill

Unit Test Writer Agent Skill

Writes unit tests for a function, covering the main path, edge cases and errors.

SKILL.md

--- name: test-writer description: Use when the user asks to write tests, add test coverage, or test a specific function, class or module. --- # Unit Test Writer ## Steps 1. Detect the test framework already used in the project (Jest, Vitest, pytest, Go test, etc.) and follow its existing style and file layout. 2. Read the function and list its behaviours: normal inputs, boundaries, empty and null inputs, invalid inputs, and error paths. 3. Write one test per behaviour. Each test name says what it checks ("returns empty list when input is empty"). 4. Use Arrange-Act-Assert. Mock only external calls (network, database, clock), never the code under test. 5. Run the tests and fix any that fail because the test is wrong. If a test

Sign up to see the whole prompt

Make a free account to read the last part and open this prompt in the generator.

Sign up free

Already have an account? Sign in

How to install this skill

  1. Copy or download the file. It is a complete SKILL.md: frontmatter plus instructions.
  2. Save it in your skills folder. Claude Code: ~/.claude/skills/<skill-name>/SKILL.md (or .claude/skills/ inside a project).
  3. Ask as usual. When a request matches the skill's description, the agent loads it and follows the steps.

More skills

Code Reviewer

Reviews a diff or file for bugs, security issues and readability, ranked by severity.

View →

Commit Message Writer

Writes Conventional Commit messages from a diff: short subject, clear why.

View →

Bug Investigator

Finds the root cause of a bug from an error, logs and code before changing anything.

View →
Unit Test Writer — Agent Skill (SKILL.md) for Claude & Codex | PromptItIn