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/prisma-next/no-contract-data-patching-in-testsgit clone --depth 1 https://github.com/prisma/prisma-nextWhat 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.
This is a copy
100% identical to no-contract-data-patching-in-tests — 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 — 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/prisma-next (420 stars, last pushed 7d ago), 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. It is 100% identical to no-contract-data-patching-in-tests, differing in 0 lines, and is treated as a copy.
Other cursor rules, from other repositories
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
coolify-ai-docs
Master reference to all Coolify AI documentation in .ai/ directory.
typescript
Changes to these high-fan-out internals can affect every message, delta, element, or rerun. Keep work in them minimal, and benchmark changes with representative stress-test apps.
python_lib
Tips and guidelines specific to the development of the Streamlit Python library, not applicable to scripts and e2e tests.
specs
This directory contains product and tech specs for Streamlit features.