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/prisma/orm/no-contract-data-patching-in-testsgit clone --depth 1 https://github.com/prisma/ormWhat 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.00000 | $0.00822 |
| Opus 5 | $0.00000 | $0.00411 |
| Sonnet 5 | $0.00000 | $0.00164 |
| Haiku 4.5 | $0.00000 | $0.00082 |
Grade A, and why
no-contract-data-patching-in-tests 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.
Copies of this mod
1 near-identical copy found in the catalogue:
- no-contract-data-patching-in-tests — 100% identical, 0 lines differ
How it starts
The opening of the file, as written. The whole thing — 71 lines — stays where its author put it; the contents beside it link to each section on GitHub.
No Contract Data Patching in Tests
Rule
Never, under any circumstances, patch or hand-author raw contract data structures in tests. This is a HARD rule — hard as obsidian — not a guideline, suggestion, or default you may trade away under time pressure. Use real emitted fixtures. If a test really has to generate a contract at runtime, it may only generate it from a high-level representation made with a user-facing authoring surface (contract builder DSL, PSL) — never by writing, or worse, patching, the raw contract data structure.
A hand-built object literal that "happens" to match the contract shape is not a contract — it is a bag of random data that incidentally coincides with a real contract today and will diverge tomorrow given the velocity of this repo. Tests built on it are vacuous.
No cast-smuggling
Constructing a contract value at runtime and forcing it through the type system with as unknown as FrameworkContract<...>, as unknown as Contract, blindCast/castAs, or any equivalent escape is strictly forbidden — that cast is the tell that you are hand-authoring raw contract data. Do not refactor unrelated as casts to blindCast/castAs to slip such a value past review. There is no acceptable variant of this workaround.
If you cannot satisfy this rule
Stop. A workaround is never acceptable — it invalidates the rest of the work and is treated as a total failure of the task, not a partial success.
- Working unattended: stop and fix whatever prevents you from satisfying the rule (e.g. add the missing emitted fixture, or extend the authoring surface) before continuing.
- Working interactively: stop and flag it to the operator.
Why
Patched contracts drift from anything the emitter can produce: they skip authoring-time validation, encode shapes no user can reach, and silently keep passing when the real contract format changes. Tests then assert behavior for contracts that cannot exist.
Don't
// ❌ WRONG: spreading/overriding raw contract internals
const contract = withPatchedDomainModels(getTestContract(), (models) => ({
...models,
Project: {
...project,
relations: {
...project.relations,
related: { ...related, through: { ...related.through, targetColumns: ['tenant_id'] } },
},
},
}));
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 · 71 lines · 0 tokens per session scan A de74833197ce
no-contract-data-patching-in-tests is a cursor rule published in the GitHub repository prisma/orm (47,587 stars, last pushed today), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 822 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
playwright-e2e
Playwright E2E testing configuration for AI agents.
react-components
Rules for writing React components in this project.
state-management
Rules for Redux state management.
server-patterns
Rules for server-side Express code.
project
AI Phone Agent — TypeScript voice backend (Twilio + Amazon Connect).
typescript-style
TypeScript style — prefer arrow functions and consistent callbacks.