api-contract-design
Skill1 starsChanged 49 days agoMITView on GitHub
Design the contract between services or between client and server — protocol choice (REST/GraphQL/gRPC), versioning strategy, error-response contract, and backward-compatibility rules. Use whenever designing a new API, reviewing one for a breaking-change risk, or asked to add a field/endpoint to an existing API. Sits between database design and frontend/client design — the boundary contract itself, not either side's internals.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- OugeX/dsh-web-dev-modetheir own version, first seen Nov 1, 2026
- chadixearth/graphylooptheir own version, first seen Oct 13, 2026
- dathuynh1108/agent-skillstheir own version, first seen Oct 11, 2026
- LeonxLJX/web-engineer-skillstheir own version, first seen Sep 3, 2026
- 05-deepak-patidar/claude-skillstheir own version, first seen Jul 7, 2026
- MohOneX/claude-opus-skillstheir own version, first seen Jun 6, 2026
Used with
Projects with it also use testing-strategy.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
BlockSkilltesting-strategy
Guidelines for writing effective tests in this project
Also in 3 projects that use this
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- 05-deepak-patidar/claude-skills★ 4same name
- dathuynh1108/agent-skills★ 4same name
- chadixearth/graphyloop★ 3same name
- LeonxLJX/web-engineer-skills★ 0same name
- MohOneX/claude-opus-skills★ 0same name
- OugeX/dsh-web-dev-mode★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository32 other files it gives its agents.
- agent-system-designSkill
- architecture-designSkill
- architecture-optimizationSkill
- ci-speedupSkill
- code-handoffSkill
- cross-ai-handoffSkill
- crypto-storage-auditSkill
- database-designSkill
- dataset-sourcingSkill
- distributed-debuggerSkill
- embedded-constrained-codingSkill
- freedom-to-operate-analysisSkill
- frontend-architectureSkill
- github-masterSkill
- idea-finderSkill
- ieee-paper-drafterSkill
- memory-leak-hunterSkill
- ml-model-selectionSkill
- ml-security-auditSkill
- mobile-platform-architectureSkill
- observability-designSkill
- patent-drafterSkill
- patent-novelty-evaluatorSkill
- performance-optimizationSkill
- project-scaffoldingSkill
- researcher-evaluatorSkill
- researcherSkill
- safety-compliance-scopingSkill
- scale-refactorSkill
- secure-code-reviewSkill
- slow-query-optimizerSkill
- test-architectSkill
The file
Files
API Contract Design
Most API problems that look like "the frontend and backend disagree" are actually a contract that was never made explicit, and both sides guessed compatibly for a while until they didn't. This skill makes the contract explicit before code on either side depends on an assumption.
Step 1 — Choose the protocol by requirement, not habit
- REST — resource-oriented access with good cacheability, when the access pattern maps cleanly to a fixed set of resources and standard HTTP semantics fit.
- GraphQL — when clients genuinely need flexible, partial data shapes and over-fetching/under-fetching with a fixed REST shape is a real, current problem — not by default because it's more flexible in theory.
- gRPC — for internal service-to-service calls where performance, strong typing, and/or streaming matter more than human-readability or broad client compatibility. State the actual reason for the choice — "REST because that's what we always use" is not a decision, it's an unexamined default.
Step 2 — Decide versioning strategy up front
URI versioning, header versioning, or schema evolution via additive-only changes — pick one and state the deprecation policy alongside it: how long old versions stay supported, and how consumers are notified before a version is retired. A versioning strategy decided after the first breaking change is needed is a strategy decided too late.
Step 3 — Design the error contract as a first-class part of the API
A consistent error shape across every endpoint, with machine-readable error codes separate from human-readable messages (clients should branch on the code, not parse the message string). Keep client-error and server-error semantics distinct and consistent regardless of transport, so callers can reliably distinguish "you sent something wrong" from "we failed, retry might help."
Step 4 — Classify every change as additive or breaking, explicitly
Additive changes (a new optional field, a new endpoint) are safe without a version bump. Removing or renaming a field, changing a field's type, or changing existing behavior is breaking and requires either a version bump or a formal deprecation cycle. Before shipping any API change, state which category it falls into — this single habit prevents most accidental breaking changes that "seemed small."
Step 5 — State idempotency explicitly for every mutating operation
Retries are a fact of life in any distributed system — a client or a network layer will eventually retry a request that actually succeeded. State explicitly which operations are idempotent and by what mechanism (an idempotency key, or a naturally idempotent operation like "set to value X" versus "increment by 1"). An operation with no stated idempotency behavior will eventually double-apply somewhere.
Output
# API contract: [service/boundary]
## Protocol choice and why
## Versioning strategy + deprecation policy
## Error contract (shape, code taxonomy)
## Endpoints: method, request/response schema, idempotency, and whether each is additive or breaking relative to the prior contractDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

