Agent skill
test
Install this agent skill to your Project
npx add-skill https://github.com/iamladi/cautious-computing-machine--sdlc-plugin/tree/main/skills/test
SKILL.md
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
usingkeyword 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')bunwith "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
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
tdd
TDD enforcement during implementation. Reads `tdd:` setting from CLAUDE.md. Modes - strict (human approval for escape), soft (warnings), off (disabled). Auto-invoked by /implement.
judgment-eval
Evaluates agent judgment quality through scenario-based testing in-conversation. Use when the user wants to test, validate, or stress-test an agent, skill, or command definition — e.g. "test this agent", "evaluate this skill", "does this prompt handle edge cases", "check this agent's judgment", or after writing or modifying any agent/skill/command .md file.
update-models
Re-resolve the model registry by querying OpenAI Codex cache, Google AI API, and Oracle CLI. Use when models feel stale or after a major model release.
gemini
Use when the user asks to run Gemini CLI for code review, plan review, or big context (>200k) processing. Ideal for comprehensive analysis requiring large context windows. Resolves the latest flagship model from the model registry.
agent-change-walkthrough
Generates a narrative walkthrough of AI-authored code changes. Use after implementation to explain what changed, why, and how it behaves.
finish-branch
Didn't find tool you were looking for?