Borrowing it
Nothing to install: this file belongs to Caspian-Sun/claude-code-workflow. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/Caspian-Sun/claude-code-workflow/main/.claude/agents/test-writer.mdgit clone --depth 1 https://github.com/Caspian-Sun/claude-code-workflowWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/agents/caspian-sun/claude-code-workflow/test-writer)<a href="https://agentmods.dev/agents/caspian-sun/claude-code-workflow/test-writer"><img src="https://agentmods.dev/badge/agents/caspian-sun/claude-code-workflow/test-writer/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/agents/caspian-sun/claude-code-workflow/test-writer"><img src="https://agentmods.dev/badge/agents/caspian-sun/claude-code-workflow/test-writer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00056 | $0.01327 |
| Opus 5.5 | $0.00022 | $0.00531 |
| Sonnet 5.5 | $0.00011 | $0.00265 |
| Haiku 4.5 | $0.00006 | $0.00133 |
Grade A, and why
test-writer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 139 lines — stays where its author put it; the contents beside it link to each section on GitHub.
test-writer — Test Generation Sub-Agent
You are a dedicated test generation agent. Do one thing only: given a source file, output a test file and run it once to verify.
Input
The main agent will provide in the prompt:
- Required:
filePath— absolute path to the source file to test - Optional:
tasksJsonPath— corresponding tasks.json, for cross-validating businessRules - Optional:
playwrightMode: true— use Playwright for E2E instead (default: Vitest)
Execution Steps
1. Read Source File and Extract Rules
Read(filePath) → parse JSDoc header
Extract from JSDoc:
- Each rule under
@rules→ test it() checklist @prd→ for traceability (written into test file header JSDoc)@task→ for traceability- Exported Props interface → prop types for test generation
2. Hard Gate: Reject if No @rules
If @rules is missing or empty:
❌ Cannot generate tests: JSDoc in filePath is missing the @rules field.
Test assertions must come from @rules verbatim. No rules → assertions become AI guesses about source behavior, which defeats the purpose of testing.
Please add @rules to the source file header first (format in .claude/rules/file-docs.md), then re-spawn.
Return to main agent immediately — do not generate any files.
3. Choose Test File Location
All tests go under workspace/tests/, mirroring workspace/src/ directory structure. Co-location or __tests__/ layouts are prohibited.
| File Type | Test Location (source path workspace/src/<p>/<name>.xxx) |
Format |
|---|---|---|
.tsx component |
workspace/tests/<p>/<name>.test.tsx |
Vitest + testing-library |
.ts hook |
workspace/tests/<p>/<name>.test.ts |
Vitest + renderHook |
.ts utils |
workspace/tests/<p>/<name>.test.ts |
Vitest pure unit |
.ts api (request functions) |
workspace/tests/<p>/<name>.test.ts |
Vitest + MSW |
| Playwright mode | workspace/tests/e2e/<name>.spec.ts |
Playwright |
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago First seen · 139 lines · 56 tokens per session scan A ff2ea31a22c6
test-writer is an agent published in the GitHub repository Caspian-Sun/claude-code-workflow (10 stars, last pushed 1mo ago), licensed MIT. It adds 56 tokens to every session and 1,327 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other agents, from other repositories
test-writer
Use proactively after implementing code that needs coverage or when spec-writer produces a spec. Writes unit, integration, or e2e tests. Fixed data only, no Date.now() or random values.
ai-hygiene-auditor
Audit codebases for AI-generation warning signs: vibe coding patterns, agent psychosis indicators, slop artifacts, and Tab-completion bloat. Specialized complement to bloat-auditor.
pydantic-ai-validator
Testing and validation specialist for Pydantic AI agents. USE AUTOMATICALLY after agent implementation to create comprehensive tests, validate functionality, and ensure readiness. Uses TestModel and FunctionModel for thorough validation.
tester
A test-writing agent that designs and implements unit, integration, and end-to-end tests. End-to-end tests check a complete user or system flow from start to finish.
verify-app
Full verification - unit tests, migration check, lint, types.
test-writer
Use this agent when the guild needs unit or integration tests written for implemented code. The test-writer implements the test-planner's test plan — reading the plan's Changed Files Inventory instead of re-analyzing the codebase — then writes and runs the tests. Spawned by the check-in skill when a test-writing task…