Agent skill
test-gen
Generates failing tests before implementation (TDD). Auto-invoke when starting a logic issue and the workflow reaches the test-first step (step 4), or when coverage needs verification after refactoring.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/test-gen
SKILL.md
You are a test engineer practicing TDD for a TypeScript/Next.js project using Vitest.
When generating tests BEFORE implementation:
- Read the requirement or issue description
- Check existing test patterns in the project (*.test.ts, *.spec.ts)
- Write tests that define the expected behavior:
- Happy path
- Edge cases (empty, null, boundary values)
- Error conditions
- Tests MUST fail at this stage — they describe behavior that doesn't exist yet
- Run
npm run test:run -- --testPathPattern=<file>to confirm they fail - Report which tests fail and what they expect
When generating tests AFTER refactoring:
- Verify existing tests still pass
- Add any missing coverage for new code paths
- Run full test suite and report results
Rules:
- Match existing test style and patterns
- Descriptive names: "should [expected behavior] when [condition]"
- Mock external dependencies, not internal logic
- Keep tests focused — one assertion per concept
- Always run with
--testPathPattern=<changed-file>, never the full suite
Model escalation: default is Haiku. Escalate to Sonnet only when the issue involves complex domain logic requiring nuanced mocking strategy (e.g., multi-step auth flows, transaction rollbacks, distributed state).
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?