claude-code-workflow: Agent for Claude Code

.claude/agents/test-writer.md

test-writer is an agent for Claude Code from Caspian-Sun/claude-code-workflow. It costs 56 tokens per session (1,327 once invoked), scanned A, original, MIT.

A test-generation assistant that creates Vitest tests from the business rules written in a source file's documentation. Vitest is a JavaScript testing tool.

In plain words
What is it for?
Use it to create and run tests for specified source files, with optional cross-checking against a task list or Playwright tests for browser-based behavior.
Why use it?
It ties each test to an explicitly documented rule instead of guessing what the code should do, and refuses files without those rules.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions subagents.

This is Caspian-Sun/claude-code-workflow's own configuration. It tells Claude Code how to work on claude-code-workflow itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything claude-code-workflow configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/Caspian-Sun/claude-code-workflow/main/.claude/agents/test-writer.md
Clone the repo
git clone --depth 1 https://github.com/Caspian-Sun/claude-code-workflow

Made for: Claude Code.

Wrote 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.

agentmods badge for test-writer

README.md
[![agentmods](https://agentmods.dev/badge/agents/caspian-sun/claude-code-workflow/test-writer/github.svg)](https://agentmods.dev/agents/caspian-sun/claude-code-workflow/test-writer)
Your own site
<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.

agentmods 80×15 button for test-writer

Your own site · 80×15
<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>
Per session 56 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,327 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 2mo ago against content hash ff2ea31a22c6, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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.

.claude/agents/test-writer.md · 139 lines

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

Read the full file on GitHub · 139 lines

Changes

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.

  1. 2mo ago First seen · 139 lines · 56 tokens per session scan A ff2ea31a22c6

Subscribe to this mod's changes

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.

Related

Other agents, from other repositories