vitest — Claude Code skill: what it does, how to install
This skill guides work with Vitest tests, mocks, coverage, filtering, and fixtures. Use it when setting up tests or checking how Vitest fits a Vite project.
npx skills add antfu/skills --skill vitest -a claude-codeWhat vitest does
The skill covers Vitest and Vite configuration, test and assertion APIs, hooks, and test grouping. It also explains mocks, snapshots, coverage with V8 or Istanbul, fixtures, parallel execution, and reporters.
Reference topics include the CLI, filtering by test name or file pattern, tags, node, jsdom, and happy-dom environments, type testing, and multi-project workspaces. Vitest shares configuration and plugins with Vite, so check the project setup if it does not use Vite.
The skill supports Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, and OpenCode. For Claude Code, install it with npx skills add antfu/skills --skill vitest -a claude-code; the skill file is at ~/.claude/skills/vitest/SKILL.md.
What it helps with
- write tests with the appropriate assertions
- mock modules, timers, or dates
- filter test runs by name or file pattern
- configure coverage with V8 or Istanbul
- organize tests with fixtures and parallel execution
Example prompts for the agent
- Help me configure Vitest and Vite for this project's tests.
- Write tests for this module and add mocks with `vi`.
- How can I filter tests by name and configure Istanbul coverage?
How to install vitest
1Skills CLI (Vercel)
npx skills add antfu/skills --skill vitest -a claude-code2Manually: put the files in place
~/.claude/skills/vitest/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/vitest/
1Skills CLI (Vercel)
npx skills add antfu/skills --skill vitest -a codex2Manually: put the files in place
.agents/skills/vitest/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add antfu/skills --skill vitest -a cursor2Manually: put the files in place
.cursor/skills/vitest/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install antfu/skills vitest2Manually: put the files in place
.github/skills/vitest/SKILL.md1Skills CLI (Vercel)
npx skills add antfu/skills --skill vitest -a gemini-cli2Platform CLI
gemini skills install https://github.com/antfu/skills --path skills/vitestManually: put the files in place
.devin/skills/vitest/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add antfu/skills --skill vitest -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set7
The whole set →Similar
Questions about vitest
How do I install vitest in Claude Code?
Run npx skills add antfu/skills --skill vitest -a claude-code. The skill file is available at ~/.claude/skills/vitest/SKILL.md.
What does the vitest skill do?
It guides work with Vitest configuration, test APIs, mocks, fixtures, and coverage. It also covers filtering, test environments, and parallel execution.
Which platforms does the vitest skill support?
It supports Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, and OpenCode.
Source text
SKILL.md · MIT
--- name: vitest description: Vitest fast unit testing framework powered by Vite with Jest-compatible API. Use when writing tests, mocking, configuring coverage, or working with test filtering and fixtures. metadata: author: Anthony Fu version: "2026.10.23" source: Generated from https://github.com/vitest-dev/vitest, scripts located at https://github.com/antfu/skills --- Vitest is a next-generation testing framework powered by Vite. It provides a Jest-compatible API with native ESM, TypeScript, and JSX support out of the box. Vitest shares the same config, transformers, resolvers, and plugins with your Vite app. **Key Features:** - Vite-native: Uses Vite's transformation pipeline for fast HMR-like test updates - Jest-compatible: Drop-in replacement for most Jest test suites - Smart watch mode: Only reruns affected tests based on module graph - Native ESM, TypeScript, JSX support without configuration - Multi-threaded workers for parallel test execution - Built-in coverage via V8 or Istanbul - Snapshot testing, mocking, and spy utilities > The skill is based on Vitest 5.1.0-beta.1, generated at 2026-10-23. ## Core | Topic | Description | Reference | |-------|-------------|-----------| | Configuration | Vitest and Vite config integration, defineConfig usage | [core-config](references/core-config.md) | | CLI | Command line interface, commands and options | [core-cli](references/core-cli.md) | | Test API | test/it function, modifiers like skip, only, concurrent | [core-test-api](references/core-test-api.md) | | Describe API | describe/suite for grouping tests and nested suites | [core-describe](references/core-describe.md) | | Expect API | Assertions with toBe, toEqual, matchers and asymmetric matchers | [core-expect](references/core-expect.md) | | Hooks | beforeEach, afterEach, beforeAll, afterAll, aroundEach | [core-hooks](references/core-hooks.md) | ## Features | Topic | Description | Reference | |-------|-------------|-----------| | Mocking | Mock functions, modules, timers, dates with vi utilities | [features-mocking](references/features-mocking.md) | | Snapshots | Snapshot testing with toMatchSnapshot and inline snapshots | [features-snapshots](references/features-snapshots.md) | | Coverage | Code coverage with V8 or Istanbul providers | [features-coverage](references/features-coverage.md) | | Test Context | Test fixtures, context.expect, test.extend for custom fixtures | [features-context](references/features-context.md) | | Concurrency | Concurrent tests, parallel execution, sharding | [features-concurrency](references/features-concurrency.md) | | Filtering | Filter tests by name, file patterns, tags | [features-filtering](references/features-filtering.md) | | Test Tags | Label tests with tags to filter runs and apply shared options | [features-test-tags](references/features-test-tags.md) | | Reporters | Built-in reporters, default selection, CI/output config | [features-reporters](references/features-reporters.md) | | Benchmarking | Write benchmarks with the bench fixture (Tinybench) | [features-benchmarking](references/features-benchmarking.md) | ## Advanced | Topic | Description | Reference | |-------|-------------|-----------| | Vi Utilities | vi helper: mock, spyOn, fake timers, hoisted, waitFor | [advanced-vi](references/advanced-vi.md) | | Environments | Test environments: node, jsdom, happy-dom, custom | [advanced-environments](references/advanced-environments.md) | | Type Testing | Type-level testing with expectTypeOf and assertType | [advanced-type-testing](references/advanced-type-testing.md) | | Projects | Multi-project workspaces, different configs per project | [advanced-projects](references/advanced-projects.md) |
© Anthony Fu · MIT · antfu/skills