Borrowing it
Nothing to install: this file belongs to bakabaka91/claude-baton. 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/bakabaka91/claude-baton/main/.claude/agents/test-gen.mdgit clone --depth 1 https://github.com/bakabaka91/claude-batonWrote 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/bakabaka91/claude-baton/test-gen)<a href="https://agentmods.dev/agents/bakabaka91/claude-baton/test-gen"><img src="https://agentmods.dev/badge/agents/bakabaka91/claude-baton/test-gen.svg" alt="Measured on agentmods" 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.00018 | $0.00562 |
| Opus 5 | $0.00009 | $0.00281 |
| Sonnet 5 | $0.00004 | $0.00112 |
| Haiku 4.5 | $0.00002 | $0.00056 |
Grade A, and why
test-gen scanned grade A with 1 finding 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 5d 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.
Runs shell commandslowCapability
Expected in a hook, worth knowing in a rule or an instructions file.
- Mock `claude -p` calls (child_process.spawn) — never make real LLM calls in tests How it starts
The opening of the file, as written. The whole thing — 77 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Test Generation Agent
You own all test files and test configuration.
Files you own
tests/store.test.tstests/extractor.test.tstests/consolidator.test.tstests/claude-md.test.tstests/cli.test.ts- Any new test files in
tests/
Before writing any code
Load these skills:
- Read
.claude/skills/sql-js-patterns.md(for mocking store) - Read
.claude/skills/extraction-pipeline.md(for testing extraction)
Key rules
- Use vitest as test runner
- Each test gets a fresh in-memory sql.js database — never share state between tests
- Mock
claude -pcalls (child_process.spawn) — never make real LLM calls in tests - Mock file system operations for CLAUDE.md sync tests
- Test files mirror source files:
src/store.ts→tests/store.test.ts
Critical test cases (must exist)
store.test.ts
- CRUD for all 8 tables
- Search across multiple projects
- Deduplication (Jaccard similarity, threshold 0.6)
- Confidence decay calculation
- JSON column round-trip (tags, done_when, etc.)
- Status transitions (active → archived, active → superseded)
extractor.test.ts
- Transcript JSONL parsing
- Chunking with overlap (6000 chars, 500 overlap)
- Extraction prompt construction
- LLM response parsing (valid JSON, malformed JSON, empty response)
- Cursor tracking (don't re-process already-extracted content)
- Idempotency (same transcript twice → no duplicates)
consolidator.test.ts
- Confidence decay math (7d and 30d half-lives)
- Jaccard similarity calculation
- Merge behavior for duplicate memories
- Prune behavior for low-confidence memories
- Supersede behavior for contradicting memories
claude-md.test.ts
- Block generation with correct ordering
- Token budget enforcement (~200 lines)
- Idempotent writes (running twice → same output)
- Marker insertion when none exist
- Marker replacement when block already exists
- Priority truncation (context truncated before constraints)
cli.test.ts
- Setup creates directory and initializes DB
- Setup is idempotent
- Status output format
- Search returns matching results
- Export produces valid JSON
- Import validates schema and skips duplicates
- Reset requires confirmation
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.
- 5d ago First seen · 77 lines · 18 tokens per session scan A f77799b21dda
test-gen is an agent published in the GitHub repository bakabaka91/claude-baton (25 stars, last pushed 5mo ago), licensed MIT. It adds 18 tokens to every session and 562 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-01.
Other agents, from other repositories
tester
Use when you need to validate code through testing -- running test suites, analyzing coverage, checking for regressions, validating error handling, or verifying build processes after implementation changes.
test-runner
Test writing and execution agent. Use for writing tests, running test suites, maintaining test coverage, and ensuring code quality through testing.
test-writer
Generates tests for code. Use when writing unit tests, integration tests, or component tests with Vitest and React Testing Library.
test-writer
Writes comprehensive tests for existing code — unit, integration, edge cases.
pr-test-analyzer
Review pull request test coverage quality and completeness, with emphasis on behavioral coverage and real bug prevention.
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.