ralph-loop: Skill for Claude Code

.agent/skills/vitest-best-practices/SKILL.md

vitest-best-practices is a skill for Claude Code, Codex from PageAI-Pro/ralph-loop. It costs 84 tokens per session (1,123 once invoked), scanned A, original, MIT.

A set of guidance for writing and maintaining Vitest tests for JavaScript and TypeScript. Vitest is a tool that runs automated code tests; TDD means writing tests before the code they check.

In plain words
What is it for?
Use it when creating, reviewing, refactoring, debugging, or expanding Vitest tests. It covers test structure, setup and cleanup, parameterized cases, assertions, mocks, error handling, asynchronous code, and test speed.
Why use it?
It helps make test files clearer, more consistent, and easier to maintain. It also addresses common problems such as unclear assertions, unreliable mocks, failing asynchronous tests, and slow test suites.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions AGENTS.md.

This is PageAI-Pro/ralph-loop's own configuration. It tells Claude Code and Codex how to work on ralph-loop itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything ralph-loop configures →

Reuse

Borrowing it

Nothing to install: this file belongs to PageAI-Pro/ralph-loop. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/PageAI-Pro/ralph-loop/main/.agent/skills/vitest-best-practices/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/PageAI-Pro/ralph-loop

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-best-practices

README.md
[![agentmods](https://agentmods.dev/badge/skills/pageai-pro/ralph-loop/vitest-best-practices.svg)](https://agentmods.dev/skills/pageai-pro/ralph-loop/vitest-best-practices)
Your own site
<a href="https://agentmods.dev/skills/pageai-pro/ralph-loop/vitest-best-practices"><img src="https://agentmods.dev/badge/skills/pageai-pro/ralph-loop/vitest-best-practices.svg" alt="Measured on agentmods" height="20"></a>
Per session 84 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,123 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.00084 $0.01123
Opus 5 $0.00042 $0.00562
Sonnet 5 $0.00017 $0.00225
Haiku 4.5 $0.00008 $0.00112

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

Security

Grade A, and why

vitest-best-practices 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 8d 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.

.agent/skills/vitest-best-practices/SKILL.md · 131 lines

How it starts

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

Vitest Best Practices

When to Apply This Skill

Use this skill when you encounter any of these scenarios:

File Patterns

  • Working with *.test.ts, *.spec.ts, or similar test files
  • Creating new test files for TypeScript/JavaScript modules
  • Reviewing existing vitest test suites

User Intent Keywords

  • User mentions: vitest, testing, TDD, BDD, unit tests, integration tests
  • User asks to: write tests, add test coverage, fix failing tests, refactor tests
  • User discusses: mocking, stubbing, assertions, test performance, test organization

Code Context

  • Files importing from vitest (describe, it, expect, vi)
  • Test setup/teardown code (beforeEach, afterEach, beforeAll, afterAll)
  • Mock/spy implementations using vi.mock(), vi.spyOn(), vi.fn()
  • Assertion chains (expect(...).toEqual(), .toBe(), .toThrow(), etc.)

Common Tasks

  • Writing new test cases for existing functionality
  • Refactoring tests for better clarity or performance
  • Debugging flaky or failing tests
  • Improving test coverage or maintainability
  • Reviewing test code for best practices compliance

Do NOT Use This Skill When

  • Writing end-to-end tests with Playwright/Cypress (different scope)
  • The task is purely about implementation code, not tests

What This Skill Covers

This skill provides comprehensive guidance on:

  1. Test Organization: File placement, naming conventions, grouping strategies
  2. AAA Pattern: Arrange, Act, Assert structure for clarity
  3. Parameterized Tests: Using it.each() for testing variations
  4. Error Handling: Testing exceptions, edge cases, and fault injection
  5. Assertions: Choosing strict assertions (toEqual, toStrictEqual, toThrow)
  6. Test Doubles: Fakes, stubs, mocks, spies - when to use each
  7. Async Testing: Promises, async/await, timers, and concurrent tests
  8. Performance: Fast tests, avoiding expensive operations, cleanup patterns
  9. Vitest-Specific Features: Coverage, watch mode, benchmarking, type testing, setup files
  10. Snapshot Testing: When and how to use snapshots effectively

Read the full file on GitHub · 131 lines

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. 8d ago First seen · 131 lines · 84 tokens per session scan A d477f683649a

Subscribe to this mod's changes

vitest-best-practices is a skill published in the GitHub repository PageAI-Pro/ralph-loop (295 stars, last pushed 7d ago), licensed MIT. It adds 84 tokens to every session and 1,123 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-30.

Related

Other skills, from other repositories

web3-testing

Test smart contracts comprehensively using Hardhat and Foundry with unit tests, integration tests, and mainnet forking. Use when testing Solidity contracts, setting up blockchain test suites, or validating DeFi protocols.

wshobson/agents · 46 tokens

temporal-python-testing

Test Temporal workflows with pytest, time-skipping, and mocking strategies. Covers unit testing, integration testing, replay testing, and local development setup. Use when implementing Temporal workflow tests or debugging test failures.

wshobson/agents · 45 tokens

data-quality-frameworks

Implement data quality validation with Great Expectations, dbt tests, and data contracts. Use when building data quality pipelines, implementing validation rules, or establishing data contracts.

wshobson/agents · 37 tokens

dbt-transformation-patterns

Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.

wshobson/agents · 47 tokens

python-testing

Guidelines for writing and running tests in the Agent Framework Python codebase. Use this when creating, modifying, or running tests.

microsoft/agent-framework · 29 tokens

nemo-automodel-model-onboarding

Guide for onboarding new model architectures into NeMo AutoModel, including architecture discovery, implementation patterns, registration, and validation.

NVIDIA/skills · 33 tokens