Skip to main content
skill CX Codex

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

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add PaulRBerg/agent-skills --skill vitest -a claude-code
Open on GitHub

What 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/vitest conventions

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-code

2Manually: put the files in place

~/.claude/skills/vitest/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/vitest/

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.

vitest Anthony Fu vitest is a Claude Code skill for writing tests with Vitest. It comes into play for mocking, coverage setup, test filters, and fixtures. CX Codex +1 48,600installs vitest jezweb Detects your project type and generates a Vitest config, test utilities, and a sample test. Triggers when you ask to add tests, set up coverage, or migrate from Jest. CX Codex +1 1,800installs vitest pproenca Equips your coding agent with 44 prioritized rules for writing, debugging, and speeding up Vitest suites. Covers async patterns, mocks, and test isolation. CX Codex +1 7,800installs vitest sentimony Configures, runs, and audits Vitest suites in JavaScript and TypeScript projects. It inspects project settings and sets up runners without manual API lookups. CX Codex +1 4,600installs vitest Claude MPM Team Guides the agent in configuring Vitest, writing unit tests, checking TypeScript types, and creating mocks in Vite projects. CX Codex +1 949installs vitest-skill TestMu AI Generates Vitest unit tests for JavaScript and TypeScript projects. Provides patterns for vi mocking and React component testing. CX Codex +1 506installs vitest-testing-patterns curiositech vitest-testing-patterns provides Vitest and React Testing Library conventions for coding agents. Useful for writing component tests, API route checks, and dependency mocks. CX Codex +1 373installs vitest-testing secondsky vitest-testing — a skill for Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, and OpenCode that loads Vitest knowledge into the agent for unit and integration testing in TypeScript and JavaScript projects. CX Codex +1 1,300installs vitest-expert 0xfurai vitest-expert — a subagent that writes Vitest unit tests for JavaScript and TypeScript code: mocks, hooks, snapshots and a test config that holds up in CI. CX Codex ★ 1,029repo stars safe-action-testing next-safe-action safe-action-testing tells the agent how to write Vitest tests for next-safe-action actions and hooks: validation, middleware, server errors. CX Codex +1 1,200installs vitest-testing-expert carlrannaberg vitest-testing-expert — a Claude subagent for Vitest work: Vite config, moving tests off Jest, and running them in a real browser. CX Codex ★ 763repo stars

From the same set16

The whole set →

Project sponsors

Companies that keep this analytics open