Sign in
Explore
Prompts · PromptTesting & SecurityReviewed

testing/write-tests

Writes unit and integration tests with proper mocking and coverage.

Kind
Prompt
Works with
Claude Code
Source
Claude Code Templates @ 72e5f237f64d
Path
cli-tool/components/commands/testing/write-tests.md
License
MIT
Jobs
Testing
InstallCopy it from the source repository, or sign in and let the assistant adapt it for your project.
# Write Tests

Write comprehensive unit and integration tests with framework-specific best practices: **$ARGUMENTS**

## Current Testing Context

- Test framework: !`find . -name "jest.config.*" -o -name "*.test.*" | head -1 && echo "Jest/Vitest detected" || echo "Detect framework"`
- Target file: Analysis of $ARGUMENTS for test requirements and complexity
- Project patterns: !`find . -name "*.test.*" -o -name "*.spec.*" | head -3` existing test patterns
- Coverage setup: !`grep -l "coverage" package.json jest.config.* 2>/dev/null | head -1 || echo "Setup needed"`

## Task

Execute comprehensive test writing with framework-specific optimizations and best practices:

**Test Focus**: Use $ARGUMENTS to specify target file, unit tests, integration tests, e2e tests, or component tests

**Test Writing Framework**:

1. **Code Analysis** - Analyze target code structure, identify testable functions, assess dependency complexity, evaluate edge cases
2. **Test Strategy Design** - Plan test organization, design test hierarchies, identify mock requirements, optimize test isolation
…