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/girijashankarj/cursor-handbookWrote 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/girijashankarj/cursor-handbook/mock-patterns)<a href="https://agentmods.dev/rules/girijashankarj/cursor-handbook/mock-patterns"><img src="https://agentmods.dev/badge/rules/girijashankarj/cursor-handbook/mock-patterns/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/girijashankarj/cursor-handbook/mock-patterns"><img src="https://agentmods.dev/badge/rules/girijashankarj/cursor-handbook/mock-patterns.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.00577 | $0.00577 |
| Opus 5.5 | $0.00231 | $0.00231 |
| Sonnet 5.5 | $0.00115 | $0.00115 |
| Haiku 4.5 | $0.00058 | $0.00058 |
Grade A, and why
mock-patterns 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 — 83 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Mock Patterns
Centralized Mock Infrastructure
tests/
├── mocks/
│ ├── services/ # Service mocks
│ │ ├── database.mock.ts
│ │ ├── cache.mock.ts
│ │ └── queue.mock.ts
│ ├── factories/ # Test data factories
│ │ ├── order.factory.ts
│ │ ├── user.factory.ts
│ │ └── product.factory.ts
│ ├── fixtures/ # Static test data
│ │ ├── orders.json
│ │ └── users.json
│ └── setup.ts # Global test setup
├── helpers/
│ ├── test-server.ts # Test server utilities
│ └── assertions.ts # Custom assertions
└── integration/
└── setup.ts # Integration test setup
Factory Pattern
// tests/mocks/factories/order.factory.ts
import { faker } from '@faker-js/faker';
interface OrderOverrides {
id?: string;
status?: string;
total?: number;
}
export function createOrder(overrides: OrderOverrides = {}) {
return {
id: overrides.id ?? faker.string.uuid(),
status: overrides.status ?? 'PENDING',
total: overrides.total ?? faker.number.float({ min: 1, max: 1000 }),
{{CONFIG.database.timestampFields.created}}: new Date().toISOString(),
{{CONFIG.database.timestampFields.updated}}: new Date().toISOString(),
{{CONFIG.database.softDeleteField}}: true,
...overrides,
};
}
export function createOrders(count: number, overrides: OrderOverrides = {}) {
return Array.from({ length: count }, () => createOrder(overrides));
}
Service Mock Pattern
// tests/mocks/services/database.mock.ts
export const mockDatabase = {
query: jest.fn(),
transaction: jest.fn(),
connect: jest.fn(),
disconnect: jest.fn(),
reset() {
this.query.mockReset();
this.transaction.mockReset();
this.connect.mockReset();
this.disconnect.mockReset();
}
};
Rules
- NEVER use real API endpoints in tests
- NEVER use real database connections in unit tests
- NEVER use real credentials in test fixtures
- Reset all mocks in
beforeEachorafterEach - Use factories for dynamic test data, fixtures for static data
- Keep mock implementations simple — only mock what's needed
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 · 83 lines · 577 tokens per session scan A 66b3fb45059e
mock-patterns is a cursor rule published in the GitHub repository girijashankarj/cursor-handbook (33 stars, last pushed 1mo ago), licensed MIT. It adds 577 tokens to every session, about $0.0023 per session on Opus 5.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-09-03.
Other cursor rules, from other repositories
jest
Jest: describe/it, matchers, mocking, async testing.
vitest
Vitest: unit testing, mocking, coverage, snapshot testing.
pytest
You are an expert in pytest testing. Follow these rules.
11-testing
Unit, integration, and E2E testing conventions.
refactor-test
Review and refactor generated unit tests for improved quality and coverage.
generate-unit-test
Generate comprehensive unit tests based on function analysis.