contracts

contracts is a cursor rule for Cursor from louisbrulenaudet/monorepo-template. It costs 0 tokens per session (1,665 once invoked), scanned A, original, Apache-2.0.

Rules for defining and sharing data shapes with Zod 4 and Zod Mini, libraries for checking that data has the expected structure. They explain where shared and app-specific schemas belong in a multi-package repository.

In plain words
What is it for?
Use them when creating or changing DTOs, enums, request and response data, or schemas shared across applications and packages.
Why use it?
They prevent different parts of the codebase from duplicating or disagreeing about the same data format. This makes changes to API, queue, and webhook data safer and easier to maintain.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/. Also seen: mentions AGENTS.md.

Good fit Use them when creating or changing DTOs, enums, request and response data, or schemas shared across applications and packages.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/louisbrulenaudet/monorepo-template/contracts
Install

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.

Clone the repo
git clone --depth 1 https://github.com/louisbrulenaudet/monorepo-template

Made for: Cursor.

Wrote 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.

agentmods badge for contracts

README.md
[![agentmods](https://agentmods.dev/badge/rules/louisbrulenaudet/monorepo-template/contracts.svg)](https://agentmods.dev/rules/louisbrulenaudet/monorepo-template/contracts)
Your own site
<a href="https://agentmods.dev/rules/louisbrulenaudet/monorepo-template/contracts"><img src="https://agentmods.dev/badge/rules/louisbrulenaudet/monorepo-template/contracts.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,665 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01665
Opus 5 $0.00000 $0.00833
Sonnet 5 $0.00000 $0.00333
Haiku 4.5 $0.00000 $0.00167

Measured 8d ago against content hash 75e1b0fe6148, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

contracts 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 8d 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.

.cursor/rules/contracts/contracts.mdc · 89 lines

How it starts

The opening of the file, as written. The whole thing — 89 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Contract Rules

Zod 4 with Zod Mini (import * as z from "zod/mini") is the house style for @repo/dtos-common and app boundary validation. Prefer Mini for tree-shakable Worker and SPA bundles. Only @repo/dtos-common/api is in package.json exports today. src/rpc/, src/queue/, and src/webhook/ are scaffolds - add the matching exports entry when the first schema in that layer lands (see packages/dtos-common/AGENTS.md). If a framework schema slot mandates another validator, use that validator only inside that slot and keep the rest of the app on Zod Mini.

Where a shape lives

A shape has exactly one owner. Its home is the narrowest scope that still contains every consumer - define it there once and import it everywhere else; never copy it across a boundary.

  • Does it cross a boundary between two workspaces (travels over the wire, queue, binding, or is imported by more than one app/package)? → it belongs in @repo/dtos-common under the matching layer subdirectory (api/, rpc/, queue/, webhook/). Layer notes and consumer expectations are below.
  • Is it used inside a single app only (tool inputs, request/response envelopes, upstream payloads)? → keep it app-local, co-located with that app and exported from the app's own DTO barrel. Do not promote it to the shared package until a second workspace actually needs it.
  • Is it a UI-only view model that never leaves the front end? → keep it app-local too - but the raw wire payload it is built from must still be validated with the shared schema before you map it into the view model. Local view models describe UI state; they never replace the wire contract.

The test for "shared vs local" is reach, not similarity: two shapes that happen to look alike but never cross the same boundary stay separate; a shape consumed on both sides of a boundary moves up to the shared package.

Do not mix layers in one file - e.g. an HTTP response schema belongs in api/, not rpc/, even if fields look similar.

Read the full file on GitHub · 89 lines

Changes

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.

  1. 8d ago First seen · 89 lines · 0 tokens per session scan A 75e1b0fe6148

Subscribe to this mod's changes

contracts is a cursor rule published in the GitHub repository louisbrulenaudet/monorepo-template (19 stars, last pushed 7d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 1,665 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.