| name | test-writer |
| description | Generate thorough tests for a function or module. Use when writing tests, adding test coverage, or creating test suites. |
Use this template to generate thorough tests for a function or module.
INPUTS
- PROJECT_CONTEXT
- SUBJECT_UNDER_TEST // name + code or signature
- (optional) BEHAVIOR_SPEC
- (optional) TEST_TECH // frameworks, runners
INSTRUCTIONS
- Identify inputs, outputs, and invariants. Derive test matrix.
- Cover happy path, edge cases, and failure modes.
- Include unit and integration tests matching the project's testing stack.
- Provide fixtures, mocks, and stubs with minimal boilerplate.
- Add property/fuzz tests for parsers and validators.
- Include performance and concurrency probes if relevant.
- Ensure tests are deterministic and parallel-safe.
- Keep lines ≤80 chars.
OUTPUT FORMAT
Scope
- Subject:
- Responsibilities:
Test matrix
| Case | Inputs | Setup | Expected |
|---|
| 1 | ... | ... | ... |
Unit tests (sketches)
// Framework-specific unit test examples
Integration tests
- Environment:
- Data seeding/migrations:
- External dependencies:
- Service integrations:
Property/fuzz tests
- Properties to hold:
- Generators:
Performance checks
Observability assertions
- Logs/metrics/traces expected:
Coverage goals
- Line:
- Branch:
- Mutation (optional):
Run commands