vitest
An agent skill by antfu, from antfu/skills. Tags: cli, debugging, javascript, testing, validation.
What it does
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.
Install
With the skills CLI, which installs into Claude Code, Codex, Cursor and other agents:
npx skills add antfu/skills --skill vitest
Or copy the skill folder into Claude Code's skills directory by hand (~/.claude/skills for every project, or .claude/skills inside one):
git clone --depth 1 https://github.com/antfu/skills
cp -r skills/skills/vitest ~/.claude/skills/vitest
Safety box score
Grade C, moderate risk: 26 of 100 risk points, rated 2026-10-23. The grade rates what the skill and its scripts can reach on the machine of whoever installs it, across eight categories from shell execution to secrets access. How the score works.
This skill is documentation for Vitest, a test runner. It mainly grants the ability to run project tests and benchmarks, update snapshots and report artifacts, and optionally drive browser-based tests. The main risks are executing repository code, modifying test/source files via snapshot updates, and reaching out to browsers or env-backed test data.
| Category | Level | Why |
|---|---|---|
| Code & shell execution | 2 (moderate) | It explicitly invokes the project’s test runner and benchmarks (`vitest run`, `vitest bench`), which execute repository code under the agent’s permissions. |
| Network access | 1 (low) | The docs include browser mode/Playwright setup and package-install examples (`provider: playwright(...)`, `npm i -D jsdom`), so using the skill can involve external network access, but it does not itself fetch remote code. |
| Filesystem reach | 2 (moderate) | Vitest can rewrite snapshots and inline snapshots in source files (`vitest -u`, `toMatchInlineSnapshot`) and writes artifacts such as `.vitest/json/output.json` and `.vitest/junit/output.xml`. |
| Secrets & credentials | 1 (low) | The examples and APIs work with environment variables (`process.env.CI`, `vi.stubEnv('API_KEY', ...)`), so test code may read secret-bearing env values if they exist. |
| Privilege & persistence | 0 (none) | There is no sudo, service registration, shell startup editing, or other privilege escalation in the shipped files. |
| Instruction hijack surface | 0 (none) | I found no prompt-injection style instructions to ignore safeguards, hide actions, or follow remote instructions. |
| Irreversible actions | 1 (low) | The skill can automate test execution, sharding, report merging, and browser-driven test flows, but it does not by itself post, deploy, pay, or delete anything outside testing. |
| Transparency | 0 (none) | All shipped content is plain markdown documentation; there are no binaries, hidden blobs, or decoded-at-runtime scripts. |
Before installing
- Read `references/features-snapshots.md` before using `-u` or inline snapshots.
- Check whether your repo will generate `.vitest/` artifacts and add them to ignore rules if needed.
- If you plan to use browser mode, review `references/advanced-environments.md` and `references/advanced-projects.md` first.
- Run `vitest list --json` or `vitest run --changed` in a scratch clone before enabling it on a sensitive repo.
Rated 2026-10-23 by an automated review of 21 files from the skill's repository.
Source
- Repository
- antfu/skills (all skills from this repository)
- Path
- skills/vitest/SKILL.md
- Branch
- main
- Updated
- 2026-09-22
Related skills
- check-compiler-errors — Run compile and type-check commands and report failures
- control-cli — Build or adapt a local harness to drive, inspect, and profile an interactive CLI or TUI without external services.
- E2E Testing Nori Skillsets Subcommands — Use when you need to interactively test a nori-skillsets CLI subcommand end-to-end via tmux, with full filesystem isolation
- TUI Puppeteering with tmux — Use when automating or testing TUI/CLI applications - provides isolated tmux sessions with scripts for input, output capture, and state verification
- address-sanitizer — Builds and runs code under AddressSanitizer to catch buffer overflows, use-after-free, and other memory errors during fuzzing or tests.
- blast-radius — Find what a change could break somewhere else before it ships, beyond the diff.