A skill your agent uses when the user asks about Vitest mocking, spies, stubs, fake timers, config, or test runner behavior.

MITAuto-check: notesTesting & QA

Install Vitest

skills CLI
$ npx skills add confluentinc/mcp-confluent --skill vitest -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install confluentinc/mcp-confluent vitest --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/confluentinc/mcp-confluent.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/vitest .claude/skills/vitest && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
vitest
GitHub stars
167
Token cost
~1.7k tokens
SKILL.md length
534 words
Files
1
Skills in repo
3
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when the user asks about Vitest mocking, spies, stubs, fake timers, config, or test runner behavior.

  • Works in 5 steps: Determine the question type → Check project rules first - read… → Fetch the relevant page with WebFetch → …
  • The user asks about Vitest mocking
  • SKILL.md covers Sources, Process, Topic Selection Examples and Output Format, plus 2 more sections
  • Calls vitest; reaches vitest.dev

What it does

Vitest is an agent skill from confluentinc/mcp-confluent. Use when the user asks about Vitest mocking, spies, stubs, fake timers, config, or test runner behavior. Triggers on questions like "vi.fn", "vi.spyOn", "vi.mocked", "Mocked<T", "mockResolvedValue", "restoreMocks", "vitest mock", "createMockInstance", "useFakeTimers", or how to accomplish test double patterns with Vitest.

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA, covering Unit testing. It works with Vitest. The licence is MIT.

When your agent uses it

  • The user asks about Vitest mocking
  • Test runner behavior
  • Questions like vi.fn
  • MockResolvedValue

Example prompts

  • “vi.spyOn”
  • “vi.mocked”
  • “Mocked<T”
  • “/vitest”

Requirements

  • Pre-approved tools (allowed-tools): Read, Bash, WebFetch, WebSearch

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Determine the question type
  2. Check project rules first - read .claude/rules/unit-tests.md before fetching. It already
  3. Fetch the relevant page with WebFetch
  4. Look at existing project tests for pattern examples before synthesizing your own
  5. Cross-reference version: this project is on Vitest v4. If a WebSearch result or older

What it can do on your machine

Read from SKILL.md and the folder at commit 76cffd5. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Bash
    • WebFetch
    • WebSearch

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • vitest

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • vitest.dev

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Vitest loads about 1.7k tokens when it runs. Until then it costs about 83 tokens; SKILL.md has 534 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~83
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Bash, WebFetch, WebSearch

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from confluentinc/mcp-confluent at commit 76cffd5, republished under its MIT licence (© confluentinc). 534 words, ~1,675 tokens.

Download SKILL.mdSave it as .claude/skills/vitest/SKILL.md (or your agent's skills folder).
name
vitest
description
Use when the user asks about Vitest mocking, spies, stubs, fake timers, config, or test runner behavior. Triggers on questions like "vi.fn", "vi.spyOn", "vi.mocked", "Mocked<T>", "mockResolvedValue", "restoreMocks", "vitest mock", "createMockInstance", "useFakeTimers", or how to accomplish test double patterns with Vitest.
allowed-tools
Read, Bash, WebFetch, WebSearch

Vitest Documentation Lookup

Look up Vitest APIs, patterns, and best practices via WebFetch against the official docs. Use this skill to answer questions about vi.*, mock instances, assertions, fake timers, and config options. Project-specific test conventions (naming, stubbing strategy, node-deps.ts pattern) live in .claude/rules/unit-tests.md - reference that rule rather than re-deriving the conventions.

Sources

Base URL: https://vitest.dev

TopicPathUse for
Getting started/guide/General concepts, project setup, runner behavior
Mocking guide/guide/mockingWorked examples: modules, timers, dates, classes
Config reference/config/vitest.config.ts options (restoreMocks, pool, coverage)
vi API/api/viTop-level helpers (vi.fn, vi.spyOn, vi.mocked, timers)
Mock instance API/api/mockMethods on a Mock (.mockReturnValue, .mockImplementation)
Assertions/api/expectexpect() matchers, argument matchers
Fake timers/api/vi#vi-usefaketimersvi.useFakeTimers, advanceTimersByTimeAsync
CLI/guide/clivitest run, flags, watch mode

Process

  1. Determine the question type

    • API reference (exact signature, options, return type) → /api/* pages
    • Pattern guidance / worked examples → /guide/mocking or /guide/
    • Config option behavior → /config/
    • CLI flag / runner behavior → /guide/cli
  2. Check project rules first - read .claude/rules/unit-tests.md before fetching. It already documents: restoreMocks: true behavior, the node-deps.ts namespace pattern, createMockInstance, constructor-stub gotchas, and the vi.mock anti-pattern. Don't re-explain these; cite the rule and only fetch docs for anything beyond it.

  3. Fetch the relevant page with WebFetch:

    WebFetch: https://vitest.dev/api/mock
    Prompt: "Find the signature and options for [specific method, e.g. mockImplementationOnce]"

    For cross-cutting questions (e.g. "how do I mock a class constructor"), fetch the guide page (/guide/mocking) alongside the API page.

  4. Look at existing project tests for pattern examples before synthesizing your own:

    Grep: "vi\.spyOn|createMockInstance|vi\.useFakeTimers" --glob "**/*.test.ts"

    Good reference files: src/confluent/telemetry.test.ts (many spies), src/cli.test.ts (env-proxy spying), src/confluent/oauth/token-store.test.ts (async + timers).

  5. Cross-reference version: this project is on Vitest v4. If a WebSearch result or older example uses vi.mock factories or pre-v1 APIs, verify against the v4 /api/* page before recommending.

Show full SKILL.md (258 more words)Show less

Topic Selection Examples

User asks about…Fetch
"how do I stub a class constructor?"/guide/mocking + /api/vi
"what's the difference between vi.fn and vi.spyOn?"/api/vi
"mock returns different value on second call"/api/mock (mockReturnValueOnce)
"how do I advance fake timers in an async test?"/api/vi#vi-usefaketimers
"what does restoreMocks do?"/config/ (search: restoreMocks)
"how to type a stubbed class instance?"unit-tests.md (project helper) + /api/vi (Mocked<T>)
"argument matcher for partial object"/api/expect (expect.objectContaining)
"why can't I spy on this ESM import?"unit-tests.md §Design for Stubbing (no fetch needed)

Output Format

API Reference
markdown
## Vitest: [method/feature]

### Signature

[From /api/*]

### Example

[Adapted to project patterns where relevant]

### Project usage

[Reference to unit-tests.md section or a real `.test.ts` file if applicable]
Pattern Guidance
markdown
## Pattern: [description]

### From the docs

[Approach recommended by /guide/mocking or /api/*]

### In this project

[How existing tests implement it; cite file paths]

### Gotchas

[Edge cases - e.g. arrow-fn constructor, ESM live bindings, mock hoisting]

Anti-patterns (project-specific)

  • Don't use vi.mock: it hoists above imports, loses type safety, and splits the project's stubbing model. If a dependency can't be spied on, wrap it in a namespace object (see src/confluent/node-deps.ts). Full rationale in .claude/rules/unit-tests.md §Why vi.mock is not used in this project.
  • Don't add afterEach restore blocks: restoreMocks: true in vitest.config.ts handles it.
  • Don't use arrow functions for constructor mocks: arrows aren't constructable. Use a regular function with vi.spyOn(ns, "Ctor").mockImplementation(function () { return {...}; }).

Tips

  • Prefer /api/* pages for signature lookups, /guide/* for worked examples.
  • /api/vi covers top-level helpers (vi.fn, vi.spyOn, timers, module hooks); /api/mock covers methods on a Mock instance. Pick the right one based on whether the user is asking "how do I create this mock" vs. "how do I configure an existing mock".
  • v4 is current. Older blog posts and Stack Overflow answers often show pre-v1 or vi.mock-heavy patterns - verify against the current API page before recommending.
  • For anything that overlaps with .claude/rules/unit-tests.md, cite the rule instead of duplicating its tables in the response.

© confluentinc, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/vitest of confluentinc/mcp-confluent.

Open the folder on GitHubat commit 76cffd5

Compare with similar skills

Vitest next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Vitest compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Vitest this skillconfluentinc/mcp-confluent167—~1.7kAutomated safety check: NotesMIT
Test Writing WorkflowiOfficeAI/AionUi33k1 repos~1.2kAutomated safety check: PassApache-2.0
Vitestsupabase/supabase111k12 repos~1.1kAutomated safety check: PassApache-2.0
Test GuardamElnagdy/guard-skills1.3k2 repos~2.1kAutomated safety check: PassMIT
Control UI E2Eopenclaw/openclaw392k—~2.9kAutomated safety check: PassMIT
Adding LLM MCP ToolsTriliumNext/Trilium38k—~2.5kAutomated safety check: PassAGPL-3.0

Similar skills

  • Test Writing Workflow

    iOfficeAI/AionUi

    Sets the test-writing workflow for the repository: risk-first scenario lists, behavior-focused Vitest tests, a full run before each commit and a coverage target.

    33k GitHub starsUsed in 1 repo~1.2k tokens
    Testing & QAAuto-check passed
  • Vitest

    supabase/supabase

    Official

    Vitest API and config reference (Jest-compatible) — mocking with vi., spies, fake timers, coverage configuration, fixtures, snapshots, and test filtering.

    111k GitHub starsUsed in 12 repos~1.1k tokens
    Testing & QAAuto-check passed
  • Test Guard

    amElnagdy/guard-skills

    Reviews newly written or edited tests against nine rules that cut test bloat, such as mock-heavy checks and near-duplicate cases, before they are committed.

    1.3k GitHub starsUsed in 2 repos~2.1k tokens
    Testing & QAAuto-check passed
  • Control UI E2E

    openclaw/openclaw

    A skill your agent uses when designing, testing, fixing, or extending the OpenClaw Control UI GUI, including UI stress-test galleries with feedback inputs, Vitest + Playwright end-to-end checks…

    392k GitHub stars~2.9k tokensUpdated today
    Testing & QAAuto-check passed
  • Adding LLM MCP Tools

    TriliumNext/Trilium

    A skill your agent uses when adding, changing, or reviewing an LLM/MCP tool in Trilium (the defineTools definitions under packages/trilium-core/src/services/llm/tools/ —…

    38k GitHub stars~2.5k tokensUpdated today
    Testing & QAAuto-check passed
  • Concept Page Test Writer

    leonardomso/33-js-concepts

    Generates Vitest tests for every runnable code example on a JavaScript concept documentation page, following a four-phase extraction and conversion process.

    67k GitHub stars~5.5k tokensUpdated 27 days ago
    Testing & QAAuto-check passed

More from confluentinc/mcp-confluent

  • PR Review

    confluentinc/mcp-confluent

    Reviews pull requests for the Confluent MCP server. An agent skill from confluentinc/mcp-confluent.

    167 GitHub stars~4.6k tokensUpdated yesterday
    Auto-check: notes
  • MCP Docs

    confluentinc/mcp-confluent

    A skill your agent uses when the user asks about Model Context Protocol details (protocol spec, transports, authorization, tools/resources/prompts, sampling/elicitation/roots, server/client…

    167 GitHub stars~604 tokensUpdated yesterday
    Auto-check passed

Works with

Categories

Questions about Vitest

What does Vitest do?

A skill your agent uses when the user asks about Vitest mocking, spies, stubs, fake timers, config, or test runner behavior. Vitest is an agent skill from confluentinc/mcp-confluent. Use when the user asks about Vitest mocking, spies, stubs, fake timers, config, or test runner behavior.

When should I use Vitest?

Vitest fits situations like: the user asks about Vitest mocking; test runner behavior; questions like vi.fn; mockResolvedValue.

How do I install Vitest in Claude Code?

Run `npx skills add confluentinc/mcp-confluent --skill vitest -a claude-code`. Or copy the skill folder (.claude/skills/vitest in confluentinc/mcp-confluent) into .claude/skills/vitest in your project. Claude Code loads it when a task matches its description.

How do I install Vitest in Codex?

Run `npx skills add confluentinc/mcp-confluent --skill vitest -a codex`. Or copy the skill folder (.claude/skills/vitest in confluentinc/mcp-confluent) into .agents/skills/vitest in your project. Codex loads it when a task matches its description.

Can I use Vitest in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add confluentinc/mcp-confluent --skill vitest -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/vitest, .gemini/skills/vitest, .github/skills/vitest and .opencode/skills/vitest in your project.

What does Vitest need to run?

Going by SKILL.md and its folder, Vitest needs the command-line tools its instructions call (vitest). Its frontmatter pre-approves these tools: Read, Bash, WebFetch, WebSearch.

Does Vitest access the network?

SKILL.md names 1 domain. In commands or code: vitest.dev; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Vitest safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Vitest use?

Vitest is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Vitest use?

About 1.7k tokens (SKILL.md is roughly 6.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Vitest?

Skills that share tags, products or a category with Vitest: Test Writing Workflow (iOfficeAI/AionUi, 33k stars), Vitest (supabase/supabase, 111k stars), Test Guard (amElnagdy/guard-skills, 1.3k stars) and Control UI E2E (openclaw/openclaw, 392k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Vitest?

confluentinc (a GitHub organization) maintains it in confluentinc/mcp-confluent, which has 167 GitHub stars. The repository holds 3 skills in this directory. The repository was last updated on October 7, 2026.

Source: confluentinc/mcp-confluent on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.