
Test Generator
Tests that would actually catch a bug — derived from the contract, one behavior each, no coverage-gaming.
v1.0.0 · ~548 tokens · ⬇ 0 · Updated July 6, 2026
What it does
Generates meaningful tests from the function's contract (happy path, boundaries, invalid input, edge semantics, error paths, side effects). Enforces one-behavior-per-test named like a spec, arrange-act-assert, behavior-not-implementation, order-independence, minimal mocking. Honest about coverage — names what it left untested.
Example uses
Add tests to untested code
A module that matters has zero tests and you want a real safety net, not coverage-number padding.
Write tests for calculateProratedRefund() in src/billing/refunds.ts. Derive the cases from its contract, not its code: mid-cycle cancellations, same-day cancels, annual plans, and the zero-amount edge. One behavior per test, named so the test list reads like a spec.Pin behavior before a refactor
You are about to restructure a function and need tests that capture today's behavior first, so any change shows up red.
I'm about to refactor parseCsvImport() in our data-import service. Before I touch it, generate tests that pin its current behavior — empty files, missing headers, duplicate rows, and non-UTF-8 encodings — so I'll know immediately if the refactor changes anything observable.Cover the error paths
The happy path is tested but nobody has ever verified what happens on bad input or a failing dependency.
Our POST /api/subscriptions handler only has happy-path tests. Add the missing ones: malformed request body, unknown plan ID, and a payment-provider timeout mid-request. Assert each fails the documented way — the exact status code and error shape — not just that something throws.Install
# 1. Create the skill folder in your Claude setup mkdir -p ~/.claude/skills/test-generator # 2. Download SKILL.md into it (or move the file you just downloaded) # → ~/.claude/skills/test-generator/SKILL.md # 3. Claude Code auto-discovers it on next launch.
Inside the skill
--- name: test-generator description: Generate meaningful tests for a function or module — behavior and edge cases, not coverage-gaming. Use when code lacks tests, before a refactor, or when asked "write tests for this", "add test coverage", "test this function". Tests the contract, not the implementation. --- # Test Generator Write tests that would actually catch a bug, not tests that inflate a coverage number. A test that can never fail is worse than no test — it's false confidence. ## Derive cases from the contract (not the code lines) For the function under test, enumerate: - **Happy path**: typical input → expected output. One clear example. - **Boundaries**: empty, zero, one, max, off-by-one neighbors, very large. - **Invalid input**: null/undefined, wrong type, malformed — assert it fails the RIGHT way. - **Edge semantics**: negatives, unicode, duplicates, ordering, timezone/locale if relevant. - **Error paths**: does it throw / return an error / retry as documented? - **Side effects**: if it writes/calls, assert that happened (with a spy/mock), and only that. ## Rules for tests that hold their value - **One behavior per test.** The test name states the behavior: `returns empty array when input is empty`. Reading the names should read like a spec. - **Arrange-Act-Assert**, no logic in the test (no loops computing the expected value — hardcode it, or you're testing your test). - **Test behavior, not implementation.** Don't assert internal calls that a refactor would change; assert observable outcomes. Brittle tests get deleted, then you have none. - **No shared mutable state** between tests; each sets up its own. Order-independence is non-negotiable. - Mock only what you must (I/O, time, network). Over-mocking tests the mocks, not the code. ## Coverage, honestly Coverage shows what ran, not what was verified. Aim for the meaningful branches and edge cases; don't chase 100% by testing getters. Name any behavior you deliberately left untested. ## Output The test file (matching the project's framework + conventions — read an existing test first), each test named for its behavior, plus a one-line note on what's covered and what isn't.
Changelog
- v1.0.02026-07-03Initial clean-room write.
Frequently asked questions
Is Test Generator free?
Yes. Test Generator is free to download and MIT-licensed.
Where do I install Test Generator?
Place the SKILL.md file in ~/.claude/skills/test-generator/ and Claude Code auto-discovers it on next launch.
How many tokens does Test Generator use?
About 548 tokens — it is designed to be token-lean.

We're developers and SaaS builders who use these tools daily in production. Every review comes from hands-on experience building real products — DealPropFirm, ThePlanetIndicator, PropFirmsCodes, and many more. We don't just review tools — we build and ship with them every day.
Written and tested by developers who build with these tools daily.