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/nedcodes-ok/cursor-doctorWrote 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/nedcodes-ok/cursor-doctor/vitest)<a href="https://agentmods.dev/rules/nedcodes-ok/cursor-doctor/vitest"><img src="https://agentmods.dev/badge/rules/nedcodes-ok/cursor-doctor/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/nedcodes-ok/cursor-doctor/vitest"><img src="https://agentmods.dev/badge/rules/nedcodes-ok/cursor-doctor/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.00647 | $0.00647 |
| Opus 5.5 | $0.00259 | $0.00259 |
| Sonnet 5.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 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.
This is a copy
100% identical to vitest — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
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.
- 1mo 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 7mo ago), licensed MIT. It adds 647 tokens to every session, about $0.0026 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 100% identical to vitest, differing in 0 lines, and is treated as a copy.
Other cursor rules, from other repositories
jest
Jest: describe/it, matchers, mocking, async testing.
pytest
You are an expert in pytest testing. Follow these rules.
vitest
Vitest: unit testing, mocking, coverage, snapshot testing.
webdriver-management
Selenium WebDriver lifecycle management — driver factory, explicit waits, browser options, and teardown.
test-patterns
Selenium pytest test patterns — data-driven tests, fixtures, error handling, and performance checks.
api-testing
Cypress network interception and API testing patterns (cy.intercept, service mocking, request/response validation).