vitest-standard

vitest-standard is a skill for Claude Code, Codex from neverinfamous/memory-journal-mcp. It costs 120 tokens per session (816 once invoked), scanned A, original, MIT.

A guide to unit testing with Vitest, a JavaScript testing tool. It also explains TDD, or test-driven development, where tests help shape the code before it is written.

In plain words
What is it for?
Use it to write and organize unit tests, mock external services, check asynchronous errors, measure coverage, and follow the Red-Green-Refactor cycle.
Why use it?
It encourages tests that check user-visible behavior, avoid shared state, and produce dependable results instead of passing by accident.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to write and organize unit tests, mock external services, check asynchronous errors, measure coverage, and follow the Red-Green-Refactor cycle.

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

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-standard

README.md
[![agentmods](https://agentmods.dev/badge/skills/neverinfamous/memory-journal-mcp/vitest-standard/github.svg)](https://agentmods.dev/skills/neverinfamous/memory-journal-mcp/vitest-standard)
Your own site
<a href="https://agentmods.dev/skills/neverinfamous/memory-journal-mcp/vitest-standard"><img src="https://agentmods.dev/badge/skills/neverinfamous/memory-journal-mcp/vitest-standard/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-standard

Your own site · 80×15
<a href="https://agentmods.dev/skills/neverinfamous/memory-journal-mcp/vitest-standard"><img src="https://agentmods.dev/badge/skills/neverinfamous/memory-journal-mcp/vitest-standard.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 120 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 816 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.00120 $0.00816
Opus 5 $0.00060 $0.00408
Sonnet 5 $0.00024 $0.00163
Haiku 4.5 $0.00012 $0.00082

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

Security

Grade A, and why

vitest-standard 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 9d ago.

The scan reads SKILL.md. This mod also ships 3 executable files (examples/service-mock.ts, examples/tdd-calculator.ts, examples/type-stubs.d.ts), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/vitest-standard/SKILL.md · 77 lines

How it starts

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

Vitest Standard

This skill provides opinionated, production-tested guidance for high-integrity unit testing with Vitest. It emphasizes behavior-driven design, strictly isolated tests, and the TDD lifecycle.

Golden Rules (Mandatory)

  1. Test Behavior, Not Implementation — Assert what the code does, not how it looks internally.
  2. Strict Isolation — NO shared state between tests. Create new instances in beforeEach.
  3. Clean Mocks — Use vi.clearAllMocks() in beforeEach to prevent call history leaks.
  4. No Magic Numbers — Use descriptive variables for expected values.
  5. AAA Pattern — Every test must follow Arrange-Act-Assert.
  6. Async/Await — Always await promises; use rejects.toThrow() for error paths.
  7. Deterministic Tests — No dependence on system time, environment variables, or randomness (mock them).
  8. Meaningful Names — Use it('should [action] when [condition]') or Given-When-Then.
  9. Mock at Boundaries — Mock external APIs, databases, and third-party SDKs; test your own logic.
  10. Red-Green-Refactor — Prefer writing tests before code to drive API design.
  11. Security — Use fake/mock credentials in all tests — never real API keys, tokens, or passwords. Load sensitive test config from .env.test.local (gitignored).

Core Patterns

AAA (Arrange-Act-Assert)

it('should calculate total price', () => {
  // Arrange: Setup data and environment
  const cart = new ShoppingCart()
  cart.addItem({ price: 10, quantity: 2 })

  // Act: Execute the method being tested
  const total = cart.getTotal()

  // Assert: Verify the outcome
  expect(total).toBe(20)
})

Mocking Example

import { vi, it, expect } from 'vitest'

it('mocks dependencies', () => {
  const mockFn = vi.fn().mockReturnValue(42)
  expect(mockFn()).toBe(42)
  expect(mockFn).toHaveBeenCalledOnce()
})

Quick Reference: Assertions

See assertions.md for a full list of Vitest assertions (toBe, toEqual, toThrow, etc.). This reference is auto-loaded only when writing test assertions.

Read the full file on GitHub · 77 lines

Files

What ships with it

8 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. 9d ago First seen · 77 lines · 120 tokens per session scan A 38962fd67e4e

Subscribe to this mod's changes

vitest-standard is a skill published in the GitHub repository neverinfamous/memory-journal-mcp (20 stars, last pushed 1mo ago), licensed MIT. It adds 120 tokens to every session and 816 once invoked, about $0.0006 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-30.