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.
git clone --depth 1 https://github.com/Renvia-code/best-cursor-rulesWrote 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/rules/renvia-code/best-cursor-rules/vitest)<a href="https://agentmods.dev/rules/renvia-code/best-cursor-rules/vitest"><img src="https://agentmods.dev/badge/rules/renvia-code/best-cursor-rules/vitest/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.
<a href="https://agentmods.dev/rules/renvia-code/best-cursor-rules/vitest"><img src="https://agentmods.dev/badge/rules/renvia-code/best-cursor-rules/vitest.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.00000 | $0.01844 |
| Opus 5.5 | $0.00000 | $0.00738 |
| Sonnet 5.5 | $0.00000 | $0.00369 |
| Haiku 4.5 | $0.00000 | $0.00184 |
Grade A, and why
vitest 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 1mo 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 — 354 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Vitest Best Practices
Overview
| Aspect | Recommendation |
|---|---|
| Runner | Vitest |
| UI Testing | @testing-library/react |
| Mocking | vi.mock, vi.fn |
| Coverage | c8 or istanbul |
Configuration
vitest.config.ts
import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import path from 'path'
export default defineConfig({
plugins: [react()],
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./tests/setup.ts'],
include: ['**/*.{test,spec}.{ts,tsx}'],
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
exclude: ['node_modules/', 'tests/setup.ts'],
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
})
Test Setup
// tests/setup.ts
import '@testing-library/jest-dom'
import { cleanup } from '@testing-library/react'
import { afterEach, vi } from 'vitest'
// Cleanup after each test
afterEach(() => {
cleanup()
})
// Mock window.matchMedia
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: vi.fn().mockImplementation((query) => ({
matches: false,
media: query,
onchange: null,
addListener: vi.fn(),
removeListener: vi.fn(),
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
})),
})
Test Structure
Basic Test File
import { describe, it, expect, beforeEach, vi } from 'vitest'
describe('MyFunction', () => {
beforeEach(() => {
// Setup before each test
})
it('should do something', () => {
const result = myFunction(input)
expect(result).toBe(expectedOutput)
})
it('should handle edge case', () => {
expect(() => myFunction(null)).toThrow('Invalid input')
})
})
Component Testing
import { describe, it, expect } from 'vitest'
import { render, screen, fireEvent } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { Button } from '@/components/Button'
describe('Button', () => {
it('renders with text', () => {
render(<Button>Click me</Button>)
expect(screen.getByRole('button', { name: 'Click me' })).toBeInTheDocument()
})
it('calls onClick when clicked', async () => {
const user = userEvent.setup()
const handleClick = vi.fn()
render(<Button onClick={handleClick}>Click me</Button>)
await user.click(screen.getByRole('button'))
expect(handleClick).toHaveBeenCalledTimes(1)
})
it('is disabled when disabled prop is true', () => {
render(<Button disabled>Click me</Button>)
expect(screen.getByRole('button')).toBeDisabled()
})
})
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.
- 1mo ago First seen · 354 lines · 0 tokens per session scan A b884b53028ea
vitest is a cursor rule published in the GitHub repository Renvia-code/best-cursor-rules (13 stars, last pushed 10mo ago), licensed CC0-1.0. It costs nothing until one of its globs matches a file; then it loads 1,844 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-30.
Other cursor rules, from other repositories
jest-unit-testing-cursorrules-prompt-file
Cursor rules for Jest development with unit testing.
python-cursorrules-prompt-file-best-practices
Cursor rules for Python development with best practices integration.
go
Idiomatic Go rules. Explicit error handling, interface-based design, context-first concurrency.
rails-cursorrules-prompt-file
Cursor rules for Rails development with basic setup.
testing-patterns
Testing patterns and best practices for PRPM codebase with Vitest.
rule-01
This is test rule number in the large package scalability test.