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.
curl -O https://raw.githubusercontent.com/PageAI-Pro/ralph-loop/main/.agent/skills/vitest-best-practices/SKILL.mdgit clone --depth 1 https://github.com/PageAI-Pro/ralph-loopWrote 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.
[](https://agentmods.dev/skills/pageai-pro/ralph-loop/vitest-best-practices)<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>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once 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 |
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.
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:
- Test Organization: File placement, naming conventions, grouping strategies
- AAA Pattern: Arrange, Act, Assert structure for clarity
- Parameterized Tests: Using
it.each()for testing variations - Error Handling: Testing exceptions, edge cases, and fault injection
- Assertions: Choosing strict assertions (
toEqual,toStrictEqual,toThrow) - Test Doubles: Fakes, stubs, mocks, spies - when to use each
- Async Testing: Promises, async/await, timers, and concurrent tests
- Performance: Fast tests, avoiding expensive operations, cleanup patterns
- Vitest-Specific Features: Coverage, watch mode, benchmarking, type testing, setup files
- Snapshot Testing: When and how to use snapshots effectively
What ships with it
11 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.
- AGENTS.md 2.8 KB
- references/aaa-pattern.md 7.1 KB
- references/assertions.md 10 KB
- references/async-testing.md 10 KB
- references/error-handling.md 11 KB
- references/organization.md 5.0 KB
- references/parameterized-tests.md 8.8 KB
- references/performance.md 12 KB
- references/snapshot-testing.md 10 KB
- references/test-doubles.md 12 KB
- references/vitest-features.md 11 KB
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.
- 8d ago First seen · 131 lines · 84 tokens per session scan A d477f683649a
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.
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.
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.
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.
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.
python-testing
Guidelines for writing and running tests in the Agent Framework Python codebase. Use this when creating, modifying, or running tests.
nemo-automodel-model-onboarding
Guide for onboarding new model architectures into NeMo AutoModel, including architecture discovery, implementation patterns, registration, and validation.