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/nedcodes-ok/cursor-doctor/vitestgit clone --depth 1 https://github.com/nedcodes-ok/cursor-doctorWhat 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.00647 | $0.00647 |
| Opus 5 | $0.00324 | $0.00324 |
| Sonnet 5 | $0.00129 | $0.00129 |
| Haiku 4.5 | $0.00065 | $0.00065 |
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 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 — 57 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Vitest Cursor Rules
You are an expert in Vitest testing. Follow these rules:
Test Structure
- Colocate test files with source: utils.ts → utils.test.ts (same directory)
- Use describe blocks to group related tests by function or behavior
- Test names describe expected behavior: it('returns empty array when no items match filter')
- Follow AAA pattern: Arrange, Act, Assert — separated by blank lines
- One assertion per test when possible, multiple only for closely related checks
Assertions
- Use expect().toBe() for primitives, expect().toEqual() for objects/arrays
- Use expect().toStrictEqual() when you care about undefined properties and class instances
- Use expect().toMatchObject() for partial object matching
- Use expect().toThrowError('message') to test error cases — always check the message
- Prefer specific matchers: .toContain(), .toHaveLength(), .toHaveProperty() over generic .toBe(true)
Mocking
- Use vi.mock('module') at the top of the file for module mocks
- Use vi.fn() for function mocks, vi.spyOn() when you need the original implementation
- Reset mocks in beforeEach or use { clearMocks: true } in vitest config
- Type mocks properly: vi.mocked(myFunction) to get typed mock instance
- Mock at the boundary (API calls, file system), not internal functions
Async Testing
- Use async/await in test functions — no done callbacks
- Use vi.useFakeTimers() and vi.advanceTimersByTime() for timer-dependent code
- Call vi.useRealTimers() in afterEach when using fake timers
- Use vi.waitFor() for testing async state changes
Coverage
- Configure coverage in vitest.config.ts: coverage: { provider: 'v8', reporter: ['text', 'html'] }
- Set coverage thresholds: statements: 80, branches: 80, functions: 80
- Exclude test files, configs, and type files from coverage
- Focus coverage on business logic, not framework glue code
Snapshot Testing
- Use toMatchInlineSnapshot() over toMatchSnapshot() — review changes in-place
- Snapshot simple serializable output only — not DOM trees or large objects
- Update snapshots intentionally with --update, never blindly
- Use expect().toMatchFileSnapshot() for large expected outputs
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 · 57 lines · 647 tokens per session scan A 8fb1b16596a3
vitest is a cursor rule published in the GitHub repository nedcodes-ok/cursor-doctor (9 stars, last pushed 5mo ago), licensed MIT. It adds 647 tokens to every session, about $0.0032 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-31.
Other cursor rules, from other repositories
java
Modern Java: records, sealed classes, streams, virtual threads.
javascript
Modern JavaScript: ES2023+, async patterns, common traps.
accessibility
Accessibility: semantic HTML, ARIA, keyboard navigation, testing.
cross-tool-config
Cross-tool AI config: what transfers between Cursor, Claude Code, Copilot, Windsurf, Gemini, and Codex.
angular
Angular: signals, standalone components, RxJS patterns.
django
Django: models, views, ORM best practices.