vitest-v4

vitest-v4 is a skill for Claude Code from sablier-labs/plugin-marketplace. It costs 75 tokens per session (2,266 once invoked), scanned A, original, MIT.

A guide for writing and running Vitest v4 tests in TypeScript React and Next.js projects. Vitest is a tool that checks whether code behaves as expected.

In plain words
What is it for?
Use it for unit tests, component tests, test coverage, mocked functions, watch mode, and debugging failing tests.
Why use it?
It helps developers add tests, understand failed tests, and organize test files without having to work out the testing setup and patterns from scratch.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the testing plugin — 3 skills shipped together

Good fit Use it for unit tests, component tests, test coverage, mocked functions, watch mode, and debugging failing tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sablier-labs/plugin-marketplace/vitest-v4
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 sablier-labs/plugin-marketplace --skill vitest-v4
Clone the repo
git clone --depth 1 https://github.com/sablier-labs/plugin-marketplace

Made for: Claude Code.

Or install testing, the plugin that ships this one along with the rest of its 3 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-v4

README.md
[![agentmods](https://agentmods.dev/badge/skills/sablier-labs/plugin-marketplace/vitest-v4/github.svg)](https://agentmods.dev/skills/sablier-labs/plugin-marketplace/vitest-v4)
Your own site
<a href="https://agentmods.dev/skills/sablier-labs/plugin-marketplace/vitest-v4"><img src="https://agentmods.dev/badge/skills/sablier-labs/plugin-marketplace/vitest-v4/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-v4

Your own site · 80×15
<a href="https://agentmods.dev/skills/sablier-labs/plugin-marketplace/vitest-v4"><img src="https://agentmods.dev/badge/skills/sablier-labs/plugin-marketplace/vitest-v4.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 75 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,266 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 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.00075 $0.02266
Opus 5 $0.00037 $0.01133
Sonnet 5 $0.00015 $0.00453
Haiku 4.5 $0.00007 $0.00227

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

Security

Grade A, and why

vitest-v4 scanned grade A with 0 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 10d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/testing/skills/vitest-v4/SKILL.md · 397 lines

How it starts

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

Your Role

You are an expert in writing tests with Vitest v4 for TypeScript React/Next.js projects. You help users write high-quality tests, debug failures, and maintain test suites efficiently.

Typical setup:

  • Vitest v4 with jsdom environment
  • Globals enabled (describe, test, expect, vi)
  • Path aliases configured per project

Skill delegation:

If the task is related to Zustand store testing, activate the zustand skill

Quick Start

Running Tests

# Run all unit tests
nlx vitest run

# Run tests matching pattern
nlx vitest run tokens

# Run specific test file
nlx vitest run src/utils/format.test.ts

# Run tests with matching name
nlx vitest run -t "adds token"

# Watch mode
nlx vitest

Writing Your First Test

File naming: *.test.ts or *.test.tsx

Location: Colocate with source files

import { describe, test, expect } from "vitest";
import { myFunction } from "./my-function";

describe("myFunction", () => {
  test("returns expected value", () => {
    expect(myFunction(5)).toBe(10);
  });
});

Project-Specific Patterns

Test Organization

Use visual separators and descriptive blocks:

describe("TokenStore", () => {
  /* ----------------------------------------------------------------
   * Setup
   * ------------------------------------------------------------- */

  const validToken = { address: "0x123", symbol: "TEST" };

  afterEach(() => {
    // Reset state between tests
    useTokensStore.getState().clearAll();
  });

  /* ----------------------------------------------------------------
   * Adding tokens
   * ------------------------------------------------------------- */

  describe("addToken", () => {
    test("adds valid token and returns true", () => {
      const success = useTokensStore.getState().addToken(validToken);
      expect(success).toBe(true);
    });
  });
});

Cleanup Pattern

Always reset state in afterEach():

import { afterEach } from "vitest";

afterEach(() => {
  // Reset mocks
  vi.clearAllMocks();

  // Reset environment
  process.env.NODE_ENV = originalEnv;

  // Reset stores (if not using zustand skill)
  // For Zustand stores, use the `zustand` skill
});

Read the full file on GitHub · 397 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 10d ago First seen · 397 lines · 75 tokens per session scan A d73847e284da

Subscribe to this mod's changes

vitest-v4 is a skill published in the GitHub repository sablier-labs/plugin-marketplace (7 stars, last pushed 2mo ago), licensed MIT. It adds 75 tokens to every session and 2,266 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.