test-engineer · qdhenry — Claude Code subagent: test generation and coverage
test-engineer writes unit, integration and end-to-end tests for the code you just finished, then reports coverage by line, branch and function. Useful when a feature works but nothing guards it.
no license ★ 1,357 updated 2026-03-01
.claude/agents/test-engineer.mdWhat test-engineer does
A Claude subagent that writes tests for code you already have and measures how much of it they touch. Its description tells Claude to call it whenever code is written or changed, so it is meant to stay in the loop instead of running once.
The instructions walk through three stages. First it hunts for files with no tests and runs npm test -- --coverage. Then planning: function signatures, boundaries, failure cases, test data. Then the tests themselves, built around setup, action and assertion, with mocks and isolation. Coverage targets are fixed: lines above 90%, branches above 85%, functions above 95%, critical paths at 100%. It finishes with a markdown report that breaks coverage down by module and lists the lines still uncovered.
It holds Read, Write, Edit, Bash, Grep and Glob, so it can edit test files and run the suite itself. The numbers come from npm test -- --coverage; a project without that script leaves the percentages empty and the report a summary of code.
What it helps with
- write unit tests for a function that just landed
- find source files with no test file at all
- read a coverage report by module and spot uncovered branches
- cover validation errors and failure paths
- guard critical paths before a release
Example prompts for the agent
- Use the test-engineer subagent to add tests for
UserService, including the validation errors. - Run test-engineer and show me which modules fall short on coverage.
- Have test-engineer write a regression test for the bug we just fixed.
How to install test-engineer
Manually: put the files in place
.claude/agents/test-engineer.mdFor all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention
Manually: put the files in place
.codex/agents/test-engineer.tomlCodex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/
Manually: put the files in place
.cursor/agents/test-engineer.mdCursor also reads .claude/agents/
Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean
Questions about test-engineer
How do I install test-engineer in Claude Code?
Copy the agent file into your project at .claude/agents/test-engineer.md.
What does test-engineer do?
It writes tests for new or changed code, from unit and integration cases to end-to-end and regression ones, and produces a coverage report split by module.
What coverage does it aim for?
Lines above 90%, branches above 85%, functions above 95%, and full coverage of critical paths.
Similar subagents
All subagents for Testing and QA →test-engineer by other authors comes first.