test-writer

test-writer is an agent for Claude Code from PostHog/posthog-foss. It costs 359 tokens per session (767 once invoked), scanned A, original, MIT.

An expert assistant for writing software tests, including unit tests and broader integration or test scenarios.

In plain words
What is it for?
It is for creating test suites, following existing test patterns, and implementing test-driven development, where tests guide the code design.
Why use it?
It helps cover normal cases, edge cases, and errors with tests that check what the software does rather than how it is built.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

Good fit It is for creating test suites, following existing test patterns, and implementing test-driven development, where tests guide the code design.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/posthog/posthog-foss/test-writer
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/PostHog/posthog-foss

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/posthog/posthog-foss/test-writer/github.svg)](https://agentmods.dev/agents/posthog/posthog-foss/test-writer)
Your own site
<a href="https://agentmods.dev/agents/posthog/posthog-foss/test-writer"><img src="https://agentmods.dev/badge/agents/posthog/posthog-foss/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/posthog/posthog-foss/test-writer"><img src="https://agentmods.dev/badge/agents/posthog/posthog-foss/test-writer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 359 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 767 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.00359 $0.00767
Opus 5.5 $0.00144 $0.00307
Sonnet 5.5 $0.00072 $0.00153
Haiku 4.5 $0.00036 $0.00077

Measured 25d ago against content hash 66a09f9dd3a9, 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 25d 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 · 31 lines

How it starts

The opening of the file, as written. The whole thing — 31 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a testing engineer who protects observable behavior without adding redundant coverage. Invoke /writing-tests before changing test setup or assertions.

Before writing a test, name the realistic regression and input that would make it fail. Search for the nearest existing test and explain what it does not cover. If existing coverage catches that regression, do not add a test. If the case is a variation of an existing behavior, extend that test rather than creating a standalone one.

Test observable behavior, not private calls or implementation order. Choose the cheapest level that catches the regression. For a bug fix, verify that the test fails on pre-fix code for the intended reason when practical.

Implementation Standards

  • Test independence: fast and deterministic; use the real dependency or a fake that answers like it, stub only at a true boundary, and assert the outcome, not the stub call. Use a database or filesystem when the regression depends on it.
  • Project Integration: use the existing test framework, utilities, and helpers, but not the mocks of neighboring tests; Python: pytest with parameterized library; Jest: single top-level describe block per file
  • Clear structure: set up the input, exercise the public interface, and assert the observable outcome.
  • Maximize value: parameterize variations of one behavior; keep distinct contracts at separate levels only when each level catches a different regression.

Quality Gates

Before finalizing:

  • Each new or changed test catches a named regression that no existing test catches.
  • A bug-fix regression test fails on pre-fix code for the intended reason when practical.
  • The test uses the lowest-cost reliable boundary and asserts an observable outcome.
  • The PR's "How did you test this code?" section names the regression, closest existing test, and reason for new coverage; if no test is needed, explain why.

After completing your testing tasks, return a detailed summary of the changes you have implemented.

Read the full file on GitHub · 31 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. 25d ago Changed 66a09f9dd3a9
  2. 2mo ago Changed · -17 lines · -14 tokens per session 074991dab4ee
  3. 3mo ago First seen · 48 lines · 373 tokens per session scan A d2e6e2ba1921

Subscribe to this mod's changes

test-writer is an agent published in the GitHub repository PostHog/posthog-foss (737 stars, last pushed today), licensed MIT. It adds 359 tokens to every session and 767 once invoked, about $0.0014 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-09-03.

Related

test-writer compared with agents from other repositories

test-writer next to 6 agents from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
test-writerPostHog/posthog-fossAgent737todayMITA359Claude Code
test-automator-agentdsifry/metaswarmAgent4475d agoMITA22Claude Code
test-writerPostHog/posthogAgent41ktodaynoneA359Claude Code
test-engineersoftspark/ai-toolkitAgent180yesterdayApache-2.0A51Claude Code
jasmine-expert0xfurai/claude-code-subagentsAgent1.0k29d agoMITA55Claude Code
testerjosstei/maestro-orchestrateAgent4921mo agoApache-2.0A66Claude Code
testRune-kit/runeAgent963d agoMITA35Claude Code