# Test Writer

> Generate thorough tests for a function or module. Use when writing tests, adding test coverage, or creating test suites.

- Skill: `devclarityai/test-writer-2` (Agent Skill)
- Install (CLI): `npx skillmds@latest add devclarityai/test-writer-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/devclarityai/test-writer-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: devclarityai (https://skillmd.com/u/devclarityai)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/devclarityai/test-writer-2

---


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

1. Identify inputs, outputs, and invariants. Derive test matrix.
2. Cover happy path, edge cases, and failure modes.
3. Include unit and integration tests matching the project's testing stack.
4. Provide fixtures, mocks, and stubs with minimal boilerplate.
5. Add property/fuzz tests for parsers and validators.
6. Include performance and concurrency probes if relevant.
7. Ensure tests are deterministic and parallel-safe.
8. Keep lines ≤80 chars.

## OUTPUT FORMAT

### Scope

- **Subject:**
- **Responsibilities:**

### Test matrix

| Case | Inputs | Setup | Expected |
|------|--------|-------|----------|
| 1    | ...    | ...   | ...      |

### Unit tests (sketches)

```[language]
// Framework-specific unit test examples
```

### Integration tests

- **Environment:**
- **Data seeding/migrations:**
- **External dependencies:**
- **Service integrations:**

### Property/fuzz tests

- **Properties to hold:**
- **Generators:**

### Performance checks

- **Baselines:**
- **Thresholds:**

### Observability assertions

- **Logs/metrics/traces expected:**

### Coverage goals

- **Line:**
- **Branch:**
- **Mutation (optional):**

### Run commands

- ...

