vitest-testing-strategy
Defines a practical testing strategy for TypeScript and JavaScript using Vitest across unit, integration, and type-level tests. Use when adding features, refactoring, or preventing regressions with fast feedback loops.
Best use case
vitest-testing-strategy is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Defines a practical testing strategy for TypeScript and JavaScript using Vitest across unit, integration, and type-level tests. Use when adding features, refactoring, or preventing regressions with fast feedback loops.
Teams using vitest-testing-strategy should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/vitest-testing-strategy/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How vitest-testing-strategy Compares
| Feature / Agent | vitest-testing-strategy | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Defines a practical testing strategy for TypeScript and JavaScript using Vitest across unit, integration, and type-level tests. Use when adding features, refactoring, or preventing regressions with fast feedback loops.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
SKILL.md Source
# Vitest Testing Strategy ## Rule Anchor - `.agents/rules/verification.md` > "Build Requirements" - `.agents/project-structure.md` > package dependency rules ## Use This Skill When - Adding or refactoring TS/JS logic that needs regression safety. - Reorganizing test layers for faster and more reliable feedback. - Validating runtime behavior and compile-time type contracts. ## Test Pyramid for TS/JS 1. Unit tests: pure logic and small components. 2. Integration tests: module boundaries, adapters, and I/O wiring. 3. Type tests: compile-time contracts for public APIs. ## Workflow 1. Classify change scope (logic, boundary, API type surface). 2. Add unit tests for deterministic core behavior first. 3. Add integration tests for key side-effect paths. 4. Add type assertions for exported contracts when applicable. 5. Run targeted tests, then full package test run. ## CLI and Headless Paths - CLI, transport, `InteractiveSession`, command, model-routed tool, streaming, provider setup, permission, or session persistence changes need at least one headless integration test when the behavior can run outside the TUI. - Prefer an injected provider fixture over real API keys. - Assert structured evidence such as tool schemas, tool result messages, command or skill activation events, persisted records, exit codes, or JSON/stream-json output. ## Reference Patterns - Unit: table-driven cases with clear input/output pairs. - Integration: minimal fixture setup, real wiring for one boundary. - Type-level: `expectTypeOf` for generic and inference guarantees. ## Checklist - [ ] New behavior has at least one unit test. - [ ] Critical side effects have integration coverage. - [ ] CLI-reachable behavior has headless integration coverage when applicable. - [ ] Public type contracts are validated when changed. - [ ] Tests avoid over-mocking implementation details. - [ ] Failure messages are readable and actionable. ## Anti-Patterns - Only snapshot tests without behavioral assertions. - Massive integration suites replacing all unit tests. - Tests tightly coupled to private implementation details. - Skipping type-level tests when changing exported generic types.
Related Skills
contract-testing
Applies consumer-driven contract testing to verify API compatibility between packages or services without full E2E tests. Use when designing or evolving API boundaries between loosely coupled modules.
web-design-guidelines
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
version-management
All packages must have the same version. Use changesets for coordinated version bumps. Never version packages independently.
vercel-react-native-skills
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
vercel-react-best-practices
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
vercel-composition-patterns
React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.
user-request-gate
Use immediately when the user requests any implementation, code change, feature addition, fix, or modification. Gates code writing behind a backlog draft document. Read-only exploration is always permitted.
type-boundary-and-ssot
Applies Robota's preferred workflow for trust-boundary validation, strict typing, quality gates, and owner-based SSOT reuse. Use when adding or reviewing type contracts, boundary parsing, shared contract ownership, or running quality checks.
tdd-red-green-refactor
Kent Beck's TDD workflow. Use when writing new code or modifying existing behavior. Enforces the Red-Green-Refactor cycle with small, verifiable steps.
task-tracking
Track work using task files in .agents/tasks/. Use when starting, progressing, or completing a task to maintain a persistent record of work.
tailwind-truncation
Provide Tailwind truncation patterns for single-line and multi-line text. Use when discussing text ellipsis, truncation, or line-clamp usage.
state-machine-design
Designs finite state machines as pure, declarative transition tables with guards and actions. Use when modeling lifecycle states, status flows, or any system with discrete states and controlled transitions.