| name | test-generator |
| description | Generate unit and integration tests for existing code: happy path, edge cases, error handling, mocks — for any language or framework |
Test Generator Skill
When to activate
- Adding tests to untested code (greenfield or legacy)
- A new function was written and needs test coverage
- Code review feedback says "add tests for X"
- Increasing coverage on a specific file or module
- Writing tests before a refactor to establish a safety net
When NOT to use
- TDD (test-first) — write the tests yourself first, then implement
- E2E tests for UI flows — use the browser skill with Playwright instead
- Load/performance tests — use dedicated tools (k6, Artillery, Locust)
- When the function is so simple that tests add no signal
Instructions
What to tell Claude
/test-generator
File: {path/to/file.py or paste the function}
Framework: {pytest / jest / vitest / go test / JUnit / RSpec / etc}
Test for: {all exported functions / just `functionName` / the whole module}
Coverage goals: {happy path only / edge cases / error handling / all}
Or just:
/test-generator
Write tests for the `calculateDiscount()` function in src/billing/discounts.ts.
Include: happy path, zero quantity, negative quantity, max discount cap, rounding edge cases.
Test anatomy Claude follows
def test_{what}_{scenario}():
...
result = function_under_test(inputs)
result == expected