Agent skill

Vitest Testing

by secondsky in secondsky/claude-skills

Modern TypeScript/JavaScript testing with Vitest. An agent skill from secondsky/claude-skills.

MITAuto-check: notesTesting & QA

Install Vitest Testing

skills CLI
$ npx skills add secondsky/claude-skills --skill vitest-testing -a claude-code

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

GitHub CLI
$ gh skill install secondsky/claude-skills vitest-testing --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/secondsky/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/vitest-testing/skills/vitest-testing .claude/skills/vitest-testing && 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-testing
GitHub stars
227
Token cost
~1.2k tokens
SKILL.md length
97 words
Files
1
Skills in repo
169
Repo updated
First seen
Licence
MIT

At a glance

Modern TypeScript/JavaScript testing with Vitest. An agent skill from secondsky/claude-skills.

  • Testing TS/JS projects
  • SKILL.md covers Quick Start, Running Tests, Writing Tests and Assertions, plus 5 more sections
  • Calls bun and npm
  • Tasks that involve Unit testing

What it does

Vitest Testing is an agent skill from secondsky/claude-skills. Modern TypeScript/JavaScript testing with Vitest. Fast unit and integration tests, native ESM support, Vite-powered HMR, and comprehensive mocking. Use for testing TS/JS projects.

Its SKILL.md is about 1.2k 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 and Integration testing. It works with Vitest, Vite, JavaScript and TypeScript. The repository describes itself as: Production-ready skills for Claude Code CLI - Cloudflare, React, Tailwind v4, and AI integrations. The licence is MIT.

When your agent uses it

  • Testing TS/JS projects
  • Tasks that involve Unit testing
  • Tasks that involve Integration testing

Example prompts

  • “/vitest-testing”

Requirements

  • Node.js
  • Pre-approved tools (allowed-tools): Bash, Read, Edit, Write, Grep, Glob, TodoWrite

What it can do on your machine

Read from SKILL.md and the folder at commit 8837836. 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:

    • Bash
    • Read
    • Edit
    • Write
    • Grep
    • Glob
    • TodoWrite

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • bun
    • npm

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

  • Network

    No URLs in SKILL.md. Its commands use npm, which can reach the network depending on how they are called.

    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 Testing loads about 1.2k tokens when it runs. Until then it costs about 49 tokens; SKILL.md has 97 words of instructions outside code blocks.

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

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: Bash, Read, Edit, Write, Grep, Glob, TodoWrite

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 secondsky/claude-skills at commit 8837836, republished under its MIT licence (© secondsky). 97 words, ~1,196 tokens.

Download SKILL.mdSave it as .claude/skills/vitest-testing/SKILL.md (or your agent's skills folder).
name
vitest-testing
description
Modern TypeScript/JavaScript testing with Vitest. Fast unit and integration tests, native ESM support, Vite-powered HMR, and comprehensive mocking. Use for testing TS/JS projects.
allowed-tools
Bash, Read, Edit, Write, Grep, Glob, TodoWrite
license
MIT

Vitest Testing

Expert knowledge for testing JavaScript/TypeScript projects using Vitest - a blazingly fast testing framework powered by Vite.

Quick Start

Installation
bash
# Using Bun (recommended)
bun add -d vitest

# Using npm
npm install -D vitest
Configuration
typescript
// vitest.config.ts
import { defineConfig } from 'vitest/config'

export default defineConfig({
  test: {
    globals: true,
    environment: 'node', // or 'jsdom'
    coverage: {
      provider: 'v8',
      reporter: ['text', 'json', 'html'],
      thresholds: { lines: 80, functions: 80, branches: 80 },
    },
    include: ['**/*.{test,spec}.{js,ts,jsx,tsx}'],
  },
})

Running Tests

bash
# Run all tests (prefer bun)
bun test

# Watch mode (default)
bun test --watch

# Run once (CI mode)
bun test --run

# With coverage
bun test --coverage

# Specific file
bun test src/utils/math.test.ts

# Pattern matching
bun test --grep="calculates sum"

# UI mode (interactive)
bun test --ui

# Verbose output (in Vitest 2+, --reporter=verbose prints a flat list;
# use --reporter=tree for the hierarchical tree view)
bun test --reporter=verbose

Writing Tests

Basic Structure
typescript
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
import { add, subtract } from './math'

describe('Math utilities', () => {
  beforeEach(() => {
    // Setup before each test
  })

  it('adds two numbers correctly', () => {
    expect(add(2, 3)).toBe(5)
  })

  it('subtracts two numbers correctly', () => {
    expect(subtract(5, 3)).toBe(2)
  })
})
Parametrized Tests
typescript
describe.each([
  { input: 2, expected: 4 },
  { input: 3, expected: 9 },
])('square function', ({ input, expected }) => {
  it(`squares ${input} to ${expected}`, () => {
    expect(square(input)).toBe(expected)
  })
})

Assertions

typescript
// Equality
expect(value).toBe(expected)
expect(value).toEqual(expected)

// Truthiness
expect(value).toBeTruthy()
expect(value).toBeNull()
expect(value).toBeDefined()

// Numbers
expect(number).toBeGreaterThan(3)
expect(number).toBeCloseTo(0.3, 1)

// Strings/Arrays
expect(string).toMatch(/pattern/)
expect(array).toContain(item)

// Objects
expect(object).toHaveProperty('key')
expect(object).toMatchObject({ a: 1 })

// Exceptions
expect(() => throwError()).toThrow('message')

// Promises
await expect(promise).resolves.toBe(value)
await expect(promise).rejects.toThrow()

Mocking

Function Mocks
typescript
import { vi } from 'vitest'

const mockFn = vi.fn()
mockFn.mockReturnValue(42)
mockFn.mockResolvedValue('async result')
mockFn.mockImplementation((x) => x * 2)

expect(mockFn).toHaveBeenCalled()
expect(mockFn).toHaveBeenCalledWith('arg')
Module Mocking
typescript
vi.mock('./api', () => ({
  fetchUser: vi.fn(() => ({ id: 1, name: 'Test User' })),
}))

import { fetchUser } from './api'

beforeEach(() => {
  vi.clearAllMocks()
})
Timers
typescript
beforeEach(() => vi.useFakeTimers())
afterEach(() => vi.restoreAllMocks())

it('advances timers', () => {
  const callback = vi.fn()
  setTimeout(callback, 1000)
  vi.advanceTimersByTime(1000)
  expect(callback).toHaveBeenCalledOnce()
})

it('mocks dates', () => {
  const date = new Date('2024-01-01')
  vi.setSystemTime(date)
  expect(Date.now()).toBe(date.getTime())
})

Coverage

bash
# Generate coverage report
bun test --coverage

# HTML report
bun test --coverage --coverage.reporter=html
open coverage/index.html

# Check against thresholds
bun test --coverage --coverage.thresholds.lines=90

Integration Testing

typescript
import request from 'supertest'
import { app } from './app'

describe('API endpoints', () => {
  it('creates a user', async () => {
    const response = await request(app)
      .post('/api/users')
      .send({ name: 'John' })
      .expect(201)

    expect(response.body).toMatchObject({
      id: expect.any(Number),
      name: 'John',
    })
  })
})

Best Practices

  • One test file per source file: math.ts → math.test.ts
  • Group related tests with describe() blocks
  • Use descriptive test names
  • Mock only external dependencies
  • Use concurrent tests for independent async tests
  • Share expensive fixtures with beforeAll()
  • Aim for 80%+ coverage but don't chase 100%

See Also

  • test-quality-analysis - Detecting test smells
  • playwright-testing - E2E testing
  • mutation-testing - Validate test effectiveness

© secondsky, 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 plugins/vitest-testing/skills/vitest-testing of secondsky/claude-skills.

Open the folder on GitHubat commit 8837836

Compare with similar skills

Vitest Testing 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 Testing compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Vitest Testing this skillsecondsky/claude-skills227—~1.2kAutomated safety check: NotesMIT
Vitest Skillsickn33/agentic-awesome-skills47k1 repos~1.2kAutomated safety check: PassMIT
Angular TestingKilo-Org/kilo-marketplace189—~2.9kAutomated safety check: PassMIT
Test Writing WorkflowiOfficeAI/AionUi33k1 repos~1.2kAutomated safety check: PassApache-2.0
Test Coveragescott-fryxell/brayness124—~1.6kAutomated safety check: PassMIT
Phoenix Client DevelopmentArize-ai/phoenix12k—~370Automated safety check: PassApache-2.0

Similar skills

  • Vitest Skill

    sickn33/agentic-awesome-skills

    Generates Vitest tests in JavaScript/TypeScript with Vite-native speed.

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

    Kilo-Org/kilo-marketplace

    Write unit and integration tests for Angular v20+ applications using Vitest or Jasmine with TestBed and modern testing patterns.

    189 GitHub stars~2.9k tokensUpdated 9 days ago
    Testing & QAAuto-check passed
  • 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
  • Test Coverage

    scott-fryxell/brayness

    Write Vitest specs for Vue 3 JavaScript (Vite Plus, happy-dom, @vue/test-utils) and analyze V8 coverage + Fallow health to prioritize test-first refactors.

    124 GitHub stars~1.6k tokensUpdated 9 days ago
    Testing & QAAuto-check passed
  • Development guide for the @arizeai/phoenix-client TypeScript SDK — run and resume experiments, manage OpenTelemetry tracer providers with stack-based attach/detach, and write vitest unit and…

    12k GitHub stars~370 tokensUpdated today
    Testing & QAAuto-check passed
  • Test Specialist

    ailabs-393/ai-labs-claude-skills

    This skill should be used when writing test cases, fixing bugs, analyzing code for potential issues, or improving test coverage for JavaScript/TypeScript applications.

    454 GitHub stars~3.4k tokensUpdated 11 mo ago
    Testing & QAAuto-check passed

More from secondsky/claude-skills

All 169 skills in this repo
  • Tanstack AI

    secondsky/claude-skills

    TanStack AI (alpha) provider-agnostic type-safe chat with streaming for OpenAI, Anthropic, Gemini, Ollama.

    227 GitHub starsUsed in 1 repo~3.6k tokens
    Auto-check: notes
  • Auto Animate

    secondsky/claude-skills

    AutoAnimate (@formkit/auto-animate) zero-config animations for React.

    227 GitHub stars~2.9k tokensUpdated 9 days ago
    Auto-check passed
  • Base UI React

    secondsky/claude-skills

    MUI Base UI unstyled React components with Floating UI. An agent skill from secondsky/claude-skills.

    227 GitHub stars~1.9k tokensUpdated 9 days ago
    Auto-check passed
  • Cloudflare Images

    secondsky/claude-skills

    This skill should be used when the user asks to "upload images to Cloudflare", "implement direct creator upload", "configure image transformations", "optimize WebP/AVIF", "create image variants"…

    227 GitHub stars~3.6k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Nextjs

    secondsky/claude-skills

    Deploy Next.js to Cloudflare Workers via the OpenNext adapter (@opennextjs/cloudflare).

    227 GitHub stars~5.3k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Sandbox

    secondsky/claude-skills

    Cloudflare Sandboxes SDK for secure code execution in Linux containers at edge.

    227 GitHub stars~4.5k tokensUpdated 9 days ago
    Auto-check passed

Categories

Questions about Vitest Testing

What does Vitest Testing do?

Modern TypeScript/JavaScript testing with Vitest. An agent skill from secondsky/claude-skills. Vitest Testing is an agent skill from secondsky/claude-skills. Modern TypeScript/JavaScript testing with Vitest.

When should I use Vitest Testing?

Vitest Testing fits situations like: testing TS/JS projects; tasks that involve Unit testing; tasks that involve Integration testing.

How do I install Vitest Testing in Claude Code?

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

How do I install Vitest Testing in Codex?

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

Can I use Vitest Testing 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 secondsky/claude-skills --skill vitest-testing -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-testing, .gemini/skills/vitest-testing, .github/skills/vitest-testing and .opencode/skills/vitest-testing in your project.

What does Vitest Testing need to run?

Going by SKILL.md and its folder, Vitest Testing needs the command-line tools its instructions call (bun and npm). Our summary lists: Node.js. Its frontmatter pre-approves these tools: Bash, Read, Edit, Write, Grep, Glob, TodoWrite.

Does Vitest Testing access the network?

SKILL.md contains no URLs. Its commands use npm, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Vitest Testing 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 Testing use?

Vitest Testing is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Vitest Testing use?

About 1.2k tokens (SKILL.md is roughly 4.8k 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 Testing?

Skills that share tags, products or a category with Vitest Testing: Vitest Skill (sickn33/agentic-awesome-skills, 47k stars), Angular Testing (Kilo-Org/kilo-marketplace, 189 stars), Test Writing Workflow (iOfficeAI/AionUi, 33k stars) and Test Coverage (scott-fryxell/brayness, 124 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Vitest Testing?

secondsky (a GitHub user) maintains it in secondsky/claude-skills, which has 227 GitHub stars. The repository holds 169 skills in this directory. The repository was last updated on September 28, 2026.

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