/vitest:vitestfrom vitest
Writes, runs, and debugs tests using Vitest. Handles configuration, mocking with vi, coverage setup, and diagnosing test failures.
Ships in vitest. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Minimum setup:
npm install -D vitest
// vitest.config.ts
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
environment: 'node',
},
})
First test (src/math.test.ts):
import { describe, it, expect } from 'vitest'
import { add } from './math'
describe('add', () => {
it('returns the sum of two numbers', () => {
expect(add(1, 2)).toBe(3)
})
})
npx vitest # watch mode
npx vitest run # single run (CI)
describe, it, expect, vi, etc. from 'vitest', not from @jest/* packages.vitest.config.ts or vite.config.ts before suggesting configuration changes.*.test.ts vs *.spec.ts, it vs test) and follow them.vi for all mocking — never suggest jest.fn(), jest.mock(), etc.npx vitest run to confirm they pass.Load additional context files based on what the user needs:
| Situation | Load |
|---|---|
Questions about vitest.config.ts, environments, globals, setupFiles | references/config.md |
Questions about describe, it, test, expect, hooks | references/api.md |
Questions about vi.fn(), vi.mock(), vi.spyOn(), timers, globals | references/mocking.md |
Questions about coverage providers, thresholds, --coverage flag | references/coverage.md |
Read only what is relevant to the current question. Do not preload all files unless the user's question spans multiple areas.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub hamsurang/kit --plugin vitestOther plugins' skills for the same job