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.
npx agentmods add rules/usrrname/cursorrules/vitest-best-practices-autogit clone --depth 1 https://github.com/usrrname/cursorrulesWhat 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 | $0.00000 | $0.00905 |
| Opus 5 | $0.00000 | $0.00452 |
| Sonnet 5 | $0.00000 | $0.00181 |
| Haiku 4.5 | $0.00000 | $0.00090 |
Grade A, and why
vitest-best-practices-auto 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 2d 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 — 101 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Vitest Unit Testing Best Practices
This rule enforces and suggests best practices when writing Vitest unit tests to ensure reliable, maintainable, and expressive test suites.
Critical Rules
- Tests must use clear and descriptive names (
it/teststrings). - Use "Arrange, Act, Assert" pattern for writing unit tests.
- Use
describeblocks to group related tests logically. - Use
beforeEach/afterEachfor shared setup/teardown instead of duplicating code. - Cleanup side-effects using
vi.resetAllMocks()orvi.restoreAllMocks(). - Prefer
vi.fn()orvi.spyOn()over manually created stubs. - Avoid global state – never rely on test execution order.
- For asynchronous code, always
awaitpromises and/or useexpect.assertions(n). - Do not snapshot complex objects blindly; snapshot only stable, meaningful output.
- Use
vi.useFakeTimers()cautiously and always restore real timers withvi.useRealTimers()afterwards. - Do not disable tests with
test.skip/it.skip; instead, fix or remove them. - Keep test files co-located with source or in a dedicated
__tests__folder. - Ensure each test has at least one
expectcall (or uses.resolves/.rejects). - Prefer explicit assertions over implicit truthiness checks.
filters:
Match Vitest test files
- type: file_extension pattern: "\.(test|spec)\.(js|ts|jsx|tsx)$"
Warn if test title is non-descriptive (too short)
- type: content pattern: "\b(?:it|test)\((?:'|")\s*[A-Za-z0-9]{1,10}\s*(?:'|")"
Prevent skipped tests
- type: content pattern: "\b(?:it|test|describe)\.skip\("
Ensure at least one expect‡ per test block (heuristic)
- type: content pattern: "\b(?:it|test)\([^)]{(?:(?!expect).)}$"
actions:
Suggest more descriptive titles
- type: suggest
message: |
Test titles should be descriptive. Use behaviour-driven phrases, e.g.
it('renders submit button when form is valid', ...).
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.
- 2d ago First seen · 101 lines · 905 tokens per session scan A 9a210c8318b2
vitest-best-practices-auto is a cursor rule published in the GitHub repository usrrname/cursorrules (10 stars, last pushed 4mo ago), licensed ISC. It costs nothing until one of its globs matches a file; then it loads 905 tokens. 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-31.
Other cursor rules, from other repositories
07-testing
Cursor rule "07-testing" from orbitalsonic/AndroidPilot, covering testing, architecture, prefer, unit testing and scope.
refactor-test
Review and refactor generated unit tests for improved quality and coverage.
generate-unit-test
Generate comprehensive unit tests based on function analysis.
extract-functions
Extract and analyze functions from source code for unit test generation.
code-optimization
Guidelines for optimizing duplicate and poorly structured code.
implementation-workflow
Required plan-first workflow for any implementation request (steps 1–5).