vitest-v4

vitest-v4 is a skill for Claude Code, Codex from blockmatic/basilic. It costs 77 tokens per session (1,366 once invoked), scanned A, original, MIT.

A set of patterns for testing JavaScript and TypeScript code with Vitest, a testing framework.

In plain words
What is it for?
It supports Vitest test setup, asynchronous tests, mocking with vi, snapshots, and test performance.
Why use it?
It helps avoid common problems when setting up tests, testing asynchronous code, replacing dependencies with mocks, or using snapshots.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Good fit It supports Vitest test setup, asynchronous tests, mocking with vi, snapshots, and test performance.

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

Made for: Claude Code, Codex.

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/blockmatic/basilic/vitest-v4.svg)](https://agentmods.dev/skills/blockmatic/basilic/vitest-v4)
Your own site
<a href="https://agentmods.dev/skills/blockmatic/basilic/vitest-v4"><img src="https://agentmods.dev/badge/skills/blockmatic/basilic/vitest-v4.svg" alt="Measured on agentmods" height="20"></a>
Per session 77 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,366 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00077 $0.01366
Opus 5 $0.00039 $0.00683
Sonnet 5 $0.00015 $0.00273
Haiku 4.5 $0.00008 $0.00137

Measured yesterday against content hash b8c1122c4721, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, 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 yesterday.

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.

.agents/skills/vitest-v4/SKILL.md · 126 lines

How it starts

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

Vitest Best Practices

Comprehensive performance optimization and best practices guide for Vitest testing framework. Contains 44 rules across 8 categories, prioritized by impact to guide test writing, refactoring, and code review.

When to Apply

Reference these guidelines when:

  • Writing new Vitest tests
  • Debugging flaky or slow tests
  • Setting up test configuration
  • Reviewing test code in PRs
  • Migrating from Jest to Vitest
  • Optimizing CI/CD test performance

Rule Categories by Priority

Priority Category Impact Prefix
1 Async Patterns CRITICAL async-
2 Test Setup & Isolation CRITICAL setup-
3 Mocking Patterns HIGH mock-
4 Performance HIGH perf-
5 Snapshot Testing MEDIUM snap-
6 Environment MEDIUM env-
7 Assertions LOW-MEDIUM assert-
8 Test Organization LOW org-

Quick Reference

1. Async Patterns (CRITICAL)

  • async-await-assertions - Await async assertions to prevent false positives
  • async-return-promises - Return promises from test functions
  • async-fake-timers - Use fake timers for time-dependent code
  • async-waitfor-polling - Use vi.waitFor for async conditions
  • async-concurrent-expect - Use test context expect in concurrent tests
  • async-act-wrapper - Await user events to avoid act warnings
  • async-error-handling - Test async error handling properly

2. Test Setup & Isolation (CRITICAL)

  • setup-beforeeach-cleanup - Clean up state in afterEach hooks
  • setup-restore-mocks - Restore mocks after each test
  • setup-avoid-shared-state - Avoid shared mutable state between tests
  • setup-beforeall-expensive - Use beforeAll for expensive one-time setup
  • setup-reset-modules - Reset modules when testing module state
  • setup-test-factories - Use test factories for complex test data

3. Mocking Patterns (HIGH)

  • mock-vi-mock-hoisting - Understand vi.mock hoisting behavior
  • mock-spyon-vs-mock - Choose vi.spyOn vs vi.mock appropriately
  • mock-implementation-not-value - Use mockImplementation for dynamic mocks
  • mock-msw-network - Use MSW for network request mocking
  • mock-avoid-overmocking - Avoid over-mocking
  • mock-type-safety - Maintain type safety in mocks
  • mock-clear-between-tests - Clear mock state between tests

Read the full file on GitHub · 126 lines

Files

What ships with it

49 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. yesterday Changed b8c1122c4721
  2. 4d ago First seen · 126 lines · 77 tokens per session scan A b61b3577bf9c

Subscribe to this mod's changes

vitest-v4 is a skill published in the GitHub repository blockmatic/basilic (89 stars, last pushed yesterday), licensed MIT. It adds 77 tokens to every session and 1,366 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-09-03.