public-api-contract

public-api-contract is a cursor rule for Cursor from kaminari-ad/mcp. It costs 0 tokens per session (1,063 once invoked), scanned A, original, MIT.

A project rule for changes to a public web API, meaning an interface that other software depends on. It requires the API, its documentation, and its MCP tools to be updated together.

In plain words
What is it for?
Use it when adding, removing, or changing API routes, fields, errors, permissions, limits, or validation rules.
Why use it?
It prevents users and connected tools from relying on outdated descriptions or data formats after an API change.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when adding, removing, or changing API routes, fields, errors, permissions, limits, or validation rules.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/kaminari-ad/mcp/public-api-contract
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/kaminari-ad/mcp

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 public-api-contract

README.md
[![agentmods](https://agentmods.dev/badge/rules/kaminari-ad/mcp/public-api-contract/github.svg)](https://agentmods.dev/rules/kaminari-ad/mcp/public-api-contract)
Your own site
<a href="https://agentmods.dev/rules/kaminari-ad/mcp/public-api-contract"><img src="https://agentmods.dev/badge/rules/kaminari-ad/mcp/public-api-contract/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 public-api-contract

Your own site · 80×15
<a href="https://agentmods.dev/rules/kaminari-ad/mcp/public-api-contract"><img src="https://agentmods.dev/badge/rules/kaminari-ad/mcp/public-api-contract.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,063 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.01063
Opus 5.5 $0.00000 $0.00425
Sonnet 5.5 $0.00000 $0.00213
Haiku 4.5 $0.00000 $0.00106

Measured today against content hash 26285f9f2b83, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

public-api-contract 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 today.

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/public-api-contract.mdc · 68 lines

How it starts

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

Public API Contract — docs + MCP move with it

The public contract has three surfaces that must change together: the /api/v1 routes (api/src/app/*/presentation/api/), the docs corpus (api/content/docs/, published at kaminari.ad/docs), and the MCP server (mcp/, @kaminari-ad/mcp). A v1 change that lands alone rots the other two: kaminari.ad/docs keeps publishing the old contract, and MCP's generated zod parsers go stale and start rejecting real responses at the boundary — the mcp CHANGELOG's "parser-drift phase 1" records 8 of 82 tools broken in prod by exactly that drift.

What counts as a public-API change

Change Contract change?
New / removed / renamed /api/v1 route Yes
Field added, removed, or renamed on a v1 *Request / *Response DTO Yes
New or removed enum value reachable through a v1 DTO Yes
New or changed error code (main/_exception_handlers.py::_APP_ERROR_CODE) Yes
Changed auth, required_permission, pagination, or quota behaviour of a v1 route Yes
Changed semantics of an existing v1 field — units, default, nullability, validation Yes
New config key accepted inside a v1 request body (e.g. the combo-rule match_scope) Yes
/api/internal, /api/admin, /api/service, /api/webhooks, /healthz only No
Refactor with byte-identical /openapi.json (renamed private helper, moved use case) No
Fix that makes a route obey its already-documented contract No — docs are already right

In doubt: diff /openapi.json before and after. Non-empty diff = contract change.

Required updates per surface

Surface What to update Ships in
api/ v1 route + DTO The code. Docstrings and Field(description=...) generate /openapi.json — keep them true. api MR
api/content/docs/ The articles covering the surface: developers/ (REST, webhooks, OAuth, MCP), getting-started/quickstart-api.md, plus platform/ + ui-reference/ when the UI exposes the same concept. Add a dated entry to resources/release-notes.md for anything an integrator must react to. same api MR
mcp/ Regenerate src/shared/api/{openapi,zod-schemas}.ts (make gen-api-types). Then the tool input schema + .describe() text, the parser in src/infrastructure/api/parsers/, tool-registry.ts and the ## Tools list in README.md for a new/removed tool, CHANGELOG.md. separate mcp MR

Read the full file on GitHub · 68 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. today First seen · 68 lines · 0 tokens per session scan A 26285f9f2b83

Subscribe to this mod's changes

public-api-contract is a cursor rule published in the GitHub repository kaminari-ad/mcp (0 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,063 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-11-05.