vitest · paulrberg — Claude Code skill: what it does, how to install
Testing instructions for coding agents writing, running, and debugging Vitest suites in TypeScript projects.
MIT 186 installs ★ 107 updated 2026-10-24
npx skills add PaulRBerg/agent-skills --skill vitest -a claude-codeWhat vitest does
This skill directs how coding agents interact with Vitest in TypeScript codebases. It explicitly forbids agents from adding global test variables or jsdom without prior project setup. Existing configuration files govern the test structure. The agent must inspect nearby test files first.
Bug fixing follows a strict pattern. Failure precedes the fix. The agent reproduces the issue with a failing test before writing any code changes. Mocks isolate external system boundaries, leaving the unit logic intact. For Effect codebases, the skill requires @effect/vitest conventions such as it.effect and TestClock.
Test execution stays focused. The agent runs the narrowest package script available instead of triggering the whole suite. It resorts to nlx vitest run only when no project script exists. Passing runs conclude with explicit verification markers.
What it helps with
- write component and unit tests for Vitest in TypeScript
- reproduce bugs with failing tests before applying fixes
- isolate external boundaries with targeted Vitest mocks
- structure Effect test suites using
@effect/vitestconventions
Example prompts for the agent
- Write Vitest unit tests for the token parser in
src/token.ts. - Reproduce the checkout calculation bug with a failing test first.
- Run the focused test suite for the updated auth package.
How to install vitest
1Skills CLI (Vercel)
npx skills add PaulRBerg/agent-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 PaulRBerg/agent-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 PaulRBerg/agent-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 PaulRBerg/agent-skills skills/vitest2Manually: put the files in place
.github/skills/vitest/SKILL.md1Skills CLI (Vercel)
npx skills add PaulRBerg/agent-skills --skill vitest -a gemini-cli2Platform CLI
gemini skills install https://github.com/PaulRBerg/agent-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 PaulRBerg/agent-skills --skill vitest -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about vitest
How to install vitest in Claude Code?
Run npx skills add PaulRBerg/agent-skills --skill vitest -a claude-code. Alternatively, place the file directly at ~/.claude/skills/vitest/SKILL.md.
What does the vitest skill do?
It guides coding agents on writing, mocking, and running Vitest tests cleanly. It prevents agents from injecting unwanted configurations like unneeded browser modes or globals.
How does it handle Effect projects?
It instructs the agent to use native @effect/vitest features such as it.effect, TestClock, and Layers instead of generic mocks.
Source text
SKILL.md · MIT
--- name: vitest description: "Use for Vitest in TypeScript projects (Node, bun, React/Next.js, Effect): write, run, or debug unit/component tests, mocks, testing utilities, and coverage." --- # Vitest Repository configuration, projects, setup, imports/globals, environments, aliases, test placement, and cleanup own the test contract. Inspect them and nearby tests before adding generic patterns. Do not add globals, jsdom, coverage, new setup, or browser mode by default. ## Workflow Define the behavior or regression. Test its observable public result. Mock system boundaries rather than the behavior under test. Follow local fixture and cleanup ownership. In Effect repositories, use established `@effect/vitest` conventions such as `it.effect`, Layers, and TestClock rather than generic replacements. For a bug fix, reproduce the failure before relying on a passing result when practical. Read [patterns](references/testing-patterns.md) for component, async, fixture, snapshot, tag, or browser questions. Read [mocking](references/mocking.md) for module, timer, spy, or global boundaries. Read [configuration](references/configuration.md) for projects, migration, coverage, or reporter selection. Read [troubleshooting](references/troubleshooting.md) for hangs, discovery, resolution, or flaky state. For test changes, run the narrowest established command for the changed behavior, then the affected package suite only when shared setup or contracts changed. Use `nlx vitest run` only when no project recipe or script exists. Reuse passing results until new edits, failures, or unresolved concerns justify another run. Completion requires a meaningful passing focused test under repository configuration and concise command/result evidence for test changes. A read-only explanation instead requires supporting configuration or API evidence. Do not add or run tests merely to satisfy the change workflow. When red-before-green evidence exists, use `### 🧪 Regression covered`. Otherwise, use `### 🧪 Tests verified` for executed tests.
© PaulRBerg · MIT · PaulRBerg/agent-skills
Similar skills
All skills for Testing and QA →vitest by other authors comes first.