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/jestgit 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.00978 | $0.00978 |
| Opus 5 | $0.00489 | $0.00489 |
| Sonnet 5 | $0.00196 | $0.00196 |
| Haiku 4.5 | $0.00098 | $0.00098 |
Grade A, and why
jest 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 — 48 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Jest Cursor Rules
You are an expert in Jest testing (v29+). Follow these rules:
Structure
- One test file per source file:
user.service.ts→user.service.test.ts. Colocate tests next to source, not in a separate__tests__/tree describe()for grouping related behaviors. Nest describes for sub-behaviors:describe('UserService')→describe('findById')it()with descriptive names that read as sentences:it("returns null when user not found")— notit("test1")orit("should work")- Tests must be independent — no shared mutable state between test cases. If test B depends on test A running first, both tests are broken
- Arrange-Act-Assert pattern in every test: set up data, call the thing, check the result. One logical assertion per test (multiple
expectcalls checking one behavior is fine)
Matchers
.toBe()for primitives and reference equality..toEqual()for deep equality on objects/arrays —.toBe({a:1})fails because it's a different object reference.toMatchObject()for partial matching — don't over-specify with.toEqual()when you only care about 3 of 10 fields. Less brittle when the shape changes.toThrow()requires wrapping in a function:expect(() => fn()).toThrow()notexpect(fn()).toThrow()— this is the #1 gotcha.toHaveBeenCalledWith(expect.objectContaining({...}))for partial argument matching on mocks.toMatchInlineSnapshot()over.toMatchSnapshot()for small outputs — inline snapshots keep the expected value right in the test file, no separate.snapfile to maintain
Mocking
jest.fn()for standalone mock functions.jest.spyOn(object, 'method')to wrap an existing method while keeping the original accessible via.mockRestore()jest.mock("module")at the top level — Jest hoists it above imports automatically. Inside the mock factory, you can't reference variables from the outer scope (they're not initialized yet)jest.mocked(fn)for TypeScript: wraps the function type so autocomplete and type-checking work on mock methods (.mockReturnValue,.mockResolvedValue)jest.clearAllMocks()inbeforeEach— resets call counts and return values.jest.restoreAllMocks()also undoesspyOnreplacements. Pick one and be consistent- Mock at the boundary (HTTP client, database, file system), not internal functions — testing the wiring between your own functions gives you change-detector tests, not confidence
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 · 48 lines · 978 tokens per session scan A 8ace8a931584
jest is a cursor rule published in the GitHub repository nedcodes-ok/cursor-doctor (9 stars, last pushed 5mo ago), licensed MIT. It adds 978 tokens to every session, about $0.0049 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.