contracts

contracts is a cursor rule for Cursor from louisbrulenaudet/monorepo-template. It costs 0 tokens per session (1,420 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/github.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/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.

agentmods 80×15 button for contracts

Your own site · 80×15
<a href="https://agentmods.dev/rules/louisbrulenaudet/monorepo-template/contracts"><img src="https://agentmods.dev/badge/rules/louisbrulenaudet/monorepo-template/contracts.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,420 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.01420
Opus 5.5 $0.00000 $0.00568
Sonnet 5.5 $0.00000 $0.00284
Haiku 4.5 $0.00000 $0.00142

Measured 15d ago against content hash beb2a2d470b8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-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 15d 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 · 58 lines

How it starts

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

Contract Rules

Zod 4 Mini (import * as z from "zod/mini") is the house style for @repo/dtos-common and app boundary validation, for tree-shakable Worker and SPA bundles. If a framework schema slot mandates another validator, use it only inside that slot. @repo/dtos-common holds shapes and validation only, no business logic.

Where a shape lives

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

  • Crosses a workspace boundary (wire, queue, binding, or imported by more than one app/package) → @repo/dtos-common, in its layer directory.
  • Used inside one app only (tool inputs, request/response envelopes, upstream payloads) → app-local, co-located and exported from the app's own DTO barrel. Promote it only when a second workspace needs it.
  • UI-only view model → app-local, but validate the raw wire payload with the shared schema before mapping it; a view model never replaces the wire contract.

The test is reach, not similarity: look-alike shapes that never cross the same boundary stay separate; a shape consumed on both sides of a boundary moves up. Never mix layers in one file (an HTTP response schema belongs in api/ even when an rpc/ shape looks similar).

Layer Import Shape rules Consumer validation
HTTP REST @repo/dtos-common/api JSON-safe types only (no Date on the wire) validator() in worker-api, fetchJsonWithSchema in front-app
RPC @repo/dtos-common/rpc service-binding shapes; may use z.coerce.date() or ISO strings and richer joined read models not exposed on public HTTP parse at the binding boundary before business logic
Queue @repo/dtos-common/queue durable job payloads; version carefully once several producers or consumers exist; …MessageSchema parse in handlers/message.ts (or equivalent)
Webhook @repo/dtos-common/webhook third-party event bodies; …EventSchema parse at the webhook-* route/handler entry, before handing off to business workers

Read the full file on GitHub · 58 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. 15d ago Changed beb2a2d470b8
  2. 23d ago Changed · -31 lines 856a680c6af6
  3. 27d ago Changed ce21987dc095
  4. 1mo 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 today), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 1,420 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.