vitest

vitest is a skill for Claude Code from xobotyi/cc-foundry. It costs 47 tokens per session (6,461 once invoked), scanned B, original, MIT.

A set of instructions for using Vitest, a testing framework designed for projects built with Vite. It covers test structure, configuration, mocks, assertions, coverage, and moving from Jest.

In plain words
What is it for?
Use it when writing or debugging Vitest tests, configuring Vitest, mocking modules, working with snapshots or coverage, or migrating Jest tests.
Why use it?
It helps tests match the application’s build setup and encourages tests that check observable behavior instead of internal implementation details.

Skill for Claude Code

Written for Claude Code: when-to-use in frontmatter. Also seen: mentions Claude Code.

Part of the javascript plugin — 5 skills shipped together

Good fit Use it when writing or debugging Vitest tests, configuring Vitest, mocking modules, working with snapshots or coverage, or migrating Jest tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/xobotyi/cc-foundry/vitest
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add xobotyi/cc-foundry --skill vitest
Clone the repo
git clone --depth 1 https://github.com/xobotyi/cc-foundry

Made for: Claude Code.

Or install javascript, the plugin that ships this one along with the rest of its 5 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for vitest

README.md
[![agentmods](https://agentmods.dev/badge/skills/xobotyi/cc-foundry/vitest/github.svg)](https://agentmods.dev/skills/xobotyi/cc-foundry/vitest)
Your own site
<a href="https://agentmods.dev/skills/xobotyi/cc-foundry/vitest"><img src="https://agentmods.dev/badge/skills/xobotyi/cc-foundry/vitest/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for vitest

Your own site · 80×15
<a href="https://agentmods.dev/skills/xobotyi/cc-foundry/vitest"><img src="https://agentmods.dev/badge/skills/xobotyi/cc-foundry/vitest.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 47 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,461 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00047 $0.06461
Opus 5.5 $0.00019 $0.02584
Sonnet 5.5 $0.00009 $0.01292
Haiku 4.5 $0.00005 $0.00646

Measured 7d ago against content hash 533f8913e30e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

vitest scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Strips warnings and disclaimersmediumAnti-refusal

Omitting safety caveats hides risk from the user and is a common jailbreak preamble.

When **reviewing** tests, cite the violation and show the fix inline. Do not lecture.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

`vi.useFakeTimers({ toFake: ["nextTick"] }) is not supported in node:child_process. Use --pool=threads if mocking nextTick is required.`
plugins/javascript/skills/vitest/SKILL.md · 358 lines

How it starts

The opening of the file, as written. The whole thing — 358 lines — stays where its author put it; the contents beside it link to each section on GitHub.

A test earns its place by failing when the behavior breaks, and at no other time. Three biases decide most calls:

  • Mock the boundary, never the unit under test. Every mock asserts that the real thing cannot run here. Most such assertions are false, and each false one buys a test that keeps passing after the code is wrong.
  • Prefer a fixture to a hook. test.extend initializes on demand, tears down in its own scope, and declares its dependencies in the signature. A beforeEach runs for every test in scope whether that test needs it or not.
  • The installed major decides what may be written, not the shape recalled from an older one.

Version and Toolchain

Vitest 4 is the target. Read the installed version out of the lockfile before touching a config file — the configuration surface moved in 3.2, 4.0 and 4.1, and a key from the wrong one is silently ignored or loudly rejected.

Vitest 4.1 requires Node ^20 || ^22 || >=24 and Vite ^6 || ^7 || ^8. Vitest 4.0 shipped requiring Vite 6 and Node 20; 4.1 added Vite 8 and uses the installed vite rather than a bundled copy.

What changed, by version. Every removal below is rejected or ignored under Vitest 4; the 4.1 entries are additions and need 4.1 installed.

  • 3.2 — workspace deprecated in favor of projects; fixture scopes (test, file, worker) added; AST-aware v8 coverage remapping added behind coverage.experimentalAstAwareRemapping
  • 4.0 — workspace removed; poolOptions.* flattened to top level; maxThreads/maxForks became maxWorkers; singleThread/singleFork became maxWorkers: 1, isolate: false; minWorkers removed; coverage.all and coverage.extensions removed; environmentMatchGlobs and poolMatchGlobs removed; deps.external/deps.inline moved under server.deps; browser providers became separate packages taking a factory; the basic reporter and the pre-3.0 reporter hooks removed; the third-argument options object on test and describe removed
  • 4.1 — aroundEach and aroundAll hooks; the test.extend builder pattern with type inference; test.override; test tags with --tags-filter; --detect-async-leaks; vi.defineHelper; vi.setTimerTickMode; experimental.viteModuleRunner

Read [${CLAUDE_SKILL_DIR}/references/configuration.md] when reconciling a config written against an older major — it carries the rename inventory entry by entry, each with the major that made the change.

Read the full file on GitHub · 358 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago Changed · +3 lines 533f8913e30e
  2. 1mo ago Changed · +166 lines · +1 tokens per session 49f7067fff80
  3. 1mo ago First seen · 189 lines · 46 tokens per session scan B d8685a34df2d

Subscribe to this mod's changes

vitest is a skill published in the GitHub repository xobotyi/cc-foundry (22 stars, last pushed 7d ago), licensed MIT. It adds 47 tokens to every session and 6,461 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it B with 2 findings (strips warnings and disclaimers, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories