Test Writer Skill
Priorities
Correctness > Simplicity > Readability > Concision
Goal
Write and review tests that are maintainable, isolated, and follow modern testing principles. Apply flat structure with no nested describe blocks, composable setup functions instead of beforeEach, disposable fixtures for automatic cleanup, and AHA testing principles (avoid hasty abstractions, prefer duplication over wrong abstraction).
Constraints
- Flat structure: No nested describe blocks (max 1 level for grouping)
- Composable setup functions: Return objects, never mutate shared variables
- Disposable fixtures: Use
using keyword with Symbol.dispose for automatic cleanup
- AHA testing: Prefer explicit tests over test generators, duplication over abstraction
- Descriptive test names: Describe behavior, not implementation
- Fresh state: Each test creates its own setup, no shared mutable state
- Framework-agnostic: Detect vitest/bun/jest from package.json
Modes
Write (default): Generate tests for a source file. Read the source, identify exports, analyze edge cases, write test file with setup functions and disposable fixtures.
Review: Analyze existing tests for anti-patterns. Flag nested describes, beforeEach with variable assignment, missing cleanup, over-abstraction, shared mutable state. Report findings with specific fixes.
Convert: Transform legacy tests to modern patterns. Flatten describes, convert beforeEach to setup functions, add disposables for resources.
Framework Detection
Read package.json to determine framework:
vitest → Use Vitest patterns (import from 'vitest')
bun with "test" script → Use Bun patterns (import from 'bun:test')
jest → Recommend Vitest migration, use Vitest patterns
Mode Detection
Parse $ARGUMENTS to determine mode:
- First arg is
review → Review mode
- First arg is
convert → Convert mode
- Path to source file → Write mode (default)
- No args → Ask what to test
References
Load test patterns and code examples via:
Glob(pattern: "**/sdlc/**/skills/test/references/test-patterns.md", path: "~/.claude/plugins") → Read result
Reference file contains:
- Setup function patterns
- Disposable fixture patterns
- Test naming conventions
- Anti-patterns to detect
- Transformation rules for Convert mode
Write Mode Process
- Read source file completely
- Identify exports (functions, classes, constants)
- Analyze inputs, outputs, edge cases, errors, dependencies
- Generate test file with setup functions section and tests section
- Use disposable fixtures for resources (servers, databases, files)
Review Mode Process
- Find test files matching
*.test.ts, *.spec.ts, *.test.tsx, *.spec.tsx
- Analyze for anti-patterns: nested describes >1 level, beforeEach with variable assignment, missing cleanup, over-abstraction, shared mutable state
- Report findings with severity, line numbers, current code, and specific fixes
Convert Mode Process
- Read test file completely
- Parse structure: identifies describes, hooks, variable declarations
- Transform: flatten describes, convert beforeEach to setup functions, add disposables
- Write converted file or show diff
Arguments
$ARGUMENTS
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: test-473description: Write or review tests following Kent C. Dodds testing principles - flat structure, composable setup, disposable fixtures. Use when the user asks to write tests, review tests, or convert legacy tests. Use when this capability is needed.4---56# Test Writer Skill78## Priorities910Correctness > Simplicity > Readability > Concision1112## Goal1314Write and review tests that are maintainable, isolated, and follow modern testing principles. Apply flat structure with no nested describe blocks, composable setup functions instead of beforeEach, disposable fixtures for automatic cleanup, and AHA testing principles (avoid hasty abstractions, prefer duplication over wrong abstraction).1516## Constraints1718- Flat structure: No nested describe blocks (max 1 level for grouping)19- Composable setup functions: Return objects, never mutate shared variables20- Disposable fixtures: Use `using` keyword with Symbol.dispose for automatic cleanup21- AHA testing: Prefer explicit tests over test generators, duplication over abstraction22- Descriptive test names: Describe behavior, not implementation23- Fresh state: Each test creates its own setup, no shared mutable state24- Framework-agnostic: Detect vitest/bun/jest from package.json2526## Modes2728**Write** (default): Generate tests for a source file. Read the source, identify exports, analyze edge cases, write test file with setup functions and disposable fixtures.2930**Review**: Analyze existing tests for anti-patterns. Flag nested describes, beforeEach with variable assignment, missing cleanup, over-abstraction, shared mutable state. Report findings with specific fixes.3132**Convert**: Transform legacy tests to modern patterns. Flatten describes, convert beforeEach to setup functions, add disposables for resources.3334## Framework Detection3536Read package.json to determine framework:37- `vitest` → Use Vitest patterns (import from 'vitest')38- `bun` with "test" script → Use Bun patterns (import from 'bun:test')39- `jest` → Recommend Vitest migration, use Vitest patterns4041## Mode Detection4243Parse `$ARGUMENTS` to determine mode:44- First arg is `review` → Review mode45- First arg is `convert` → Convert mode46- Path to source file → Write mode (default)47- No args → Ask what to test4849## References5051Load test patterns and code examples via:52- `Glob(pattern: "**/sdlc/**/skills/test/references/test-patterns.md", path: "~/.claude/plugins")` → Read result5354Reference file contains:55- Setup function patterns56- Disposable fixture patterns57- Test naming conventions58- Anti-patterns to detect59- Transformation rules for Convert mode6061## Write Mode Process62631. Read source file completely642. Identify exports (functions, classes, constants)653. Analyze inputs, outputs, edge cases, errors, dependencies664. Generate test file with setup functions section and tests section675. Use disposable fixtures for resources (servers, databases, files)6869## Review Mode Process70711. Find test files matching `*.test.ts`, `*.spec.ts`, `*.test.tsx`, `*.spec.tsx`722. Analyze for anti-patterns: nested describes >1 level, beforeEach with variable assignment, missing cleanup, over-abstraction, shared mutable state733. Report findings with severity, line numbers, current code, and specific fixes7475## Convert Mode Process76771. Read test file completely782. Parse structure: identifies describes, hooks, variable declarations793. Transform: flatten describes, convert beforeEach to setup functions, add disposables804. Write converted file or show diff8182## Arguments8384$ARGUMENTS8586---87> Converted and distributed by [TomeVault](https://tomevault.io/claim/iamladi) — claim your Tome and manage your conversions.88<!-- tomevault:4.0:skill_md:2026-04-13 -->