awesome-api-design
Skill12 starsChanged 2 months agoMITView on GitHub
Designs or reviews an HTTP API's shape before code: resources, versioning, pagination, idempotency, filtering. Use when asked to design an API or an endpoint.
In this repository48 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- awesome-accessibility-auditSkill
- awesome-agents-md-generatorSkill
- awesome-architecture-auditSkill
- awesome-bug-fixSkill
- awesome-claims-auditSkill
- awesome-code-cleanupSkill
- awesome-code-docsSkill
- awesome-code-explainerSkill
- awesome-code-review-feedbackSkill
- awesome-code-review-jurySkill
- awesome-code-reviewSkill
- awesome-code-standardsSkill
- awesome-content-campaignSkill
- awesome-content-image-adapterSkill
- awesome-content-publisherSkill
- awesome-content-repurposeSkill
- awesome-content-voiceSkill
- awesome-copywritingSkill
- awesome-database-auditSkill
- awesome-dependency-auditSkill
- awesome-dependency-upgradeSkill
- awesome-design-docSkill
- awesome-document-styleSkill
- awesome-error-standardsSkill
- awesome-git-author-rewriteSkill
- awesome-git-commit-planSkill
- awesome-git-history-rebuildSkill
- awesome-git-history-resetSkill
- awesome-git-history-salvageSkill
- awesome-grammar-checkSkill
- awesome-humanize-enSkill
- awesome-landing-auditSkill
- awesome-leak-auditSkill
- awesome-logging-standardsSkill
- awesome-pentestSkill
- awesome-performance-auditSkill
- awesome-regression-sweepSkill
- awesome-root-causeSkill
- awesome-security-auditSkill
- awesome-seo-auditSkill
- awesome-skills-purgeSkill
- awesome-slop-auditSkill
- awesome-style-mimicSkill
- awesome-test-writingSkill
- awesome-translate-ru-enSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 7 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
Do not activate to define the error envelope's fields or retry classification (awesome-error-standards owns that contract) or to audit …
- Distinctive: line 35
When reviewing an existing design, walk the same decisions as findings:
- Very specific: line 38
No verbs in resource paths except modeled state transitions.
- Distinctive: line 39
Every list endpoint paginated from day one — retrofitting pagination is a breaking change.
- Distinctive: line 40
Every mutation idempotent-by-key or documented as naturally idempotent.
- Distinctive: line 62
Run the design review checklist above against your own output — a finding in your own design gets fixed before delivery, not shipped with a …
- Distinctive: line 63
Every contract decision names the consumer consequence it buys.
- Distinctive: line 65
Every mutation in the design answers the retry question (idempotency key or naturally idempotent — stated which).
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API Design
Shape an HTTP API so its consumers can build against it for years without a breaking surprise. The contract is the product: URLs, methods, payloads, errors, and evolution rules are decided here, deliberately — everything left implicit becomes an accidental contract the first client depends on.
When to Activate
- "Design the API for X", "review this API design / OpenAPI spec", "how should we version / paginate / handle retries".
- A design doc needs its API section made concrete (awesome-design-doc hands off here).
- A new endpoint is being added to an existing API and must match its conventions.
Do not activate to define the error envelope's fields or retry classification (awesome-error-standards owns that contract) or to audit implemented handlers for vulnerabilities (awesome-security-audit).
Work Process
- Inventory the incumbent conventions and the project's own words — an existing API's casing, id format, pagination style, and envelope win over any guideline here: consistency within one API beats global best practice. Only a new API starts from the defaults below. Read the recorded decisions (existing ADRs) and the project's glossary (
CONTEXT.md, a domain doc, or the terms its code and tests already use) before naming a single resource: a path is a public, long-lived name, and one that renames a concept the codebase already has costs every reader a translation. - Model resources, not procedures — nouns with identity and lifecycle (
/orders/{id}), actions as state transitions on them (POST /orders/{id}/cancelwhen a pure verb is unavoidable — never/doCancelOrder). Nest at most one level deep; deeper hierarchies become query filters (/comments?post_id=…), because every nesting level hardcodes an ownership assumption into every client URL. - Decide the evolution rules before v1 ships — additive changes (new optional field, new endpoint) go in place; anything breaking (remove/rename/retype a field, tighten validation) only ever creates a new version. Publish that taxonomy with the API so consumers know what is safe to ignore. Evolve by layering — a redesigned abstraction ships beside the old one and existing integrations keep working until their owners move; deprecation is announced with a sunset window, never enforced by an in-place change.
- Design list endpoints for growth — opaque cursor pagination (encode the
(sort_key, id)position, returnhas_more+next_cursorin a list envelope) over offset, which skips and duplicates rows under concurrent writes and dies on deep pages. Filtering and sorting are an allowlist of named parameters over indexed fields, never a pass-through to the query layer. - Make unsafe methods retry-safe — mutations accept an
Idempotency-Key; same key + same body replays the stored response, same key + different body is 409. Without it, every client retry is a potential duplicate side effect. (Retry classification and the envelope format: awesome-error-standards.) - Specify concurrency and partial updates — updates that can conflict get optimistic concurrency (
ETag+If-Match, 409 with the current version on mismatch); PATCH semantics are declared (merge-patch vs replace), and an empty PATCH is rejected, not silently a no-op. - Write the contract down as the source of truth — an OpenAPI/schema document that generates or validates the implementation, not prose that drifts from it. Ids are opaque and prefixed (
ord_…), timestamps ISO 8601 UTC, money integer minor units with currency, enums closed with a documented default for unknown values on the consumer side.
Design review checklist
When reviewing an existing design, walk the same decisions as findings:
- Naming and casing consistent across every endpoint; no mixed
camelCase/snake_casepayloads. - No verbs in resource paths except modeled state transitions; no RPC-style
/getXendpoints beside REST resources. - Every list endpoint paginated from day one — retrofitting pagination is a breaking change.
- Every mutation idempotent-by-key or documented as naturally idempotent.
- Error responses reference one stable envelope (awesome-error-standards) — not per-endpoint improvisation.
- Versioning and deprecation policy stated; no "we'll decide when we break something".
- Webhooks the API sends are treated as public surface: signed, versioned, redeliverable — same contract discipline as endpoints.
- Nothing in the response a client shouldn't see: internal ids, flags, or fields leaking through by serializer default.
Output Format
API Design — <scope> — <date>
Contract decisions:
- <area: resources | versioning | pagination | idempotency | concurrency> — <decision> — <the consumer consequence it buys>
...
Spec: <OpenAPI/schema skeleton or diff, when producing one>
Deviations from incumbent conventions: <each with its justification, or "none">
Open questions: <decisions needing the user, with a recommended default each>Self-check before delivering
- Run the design review checklist above against your own output — a finding in your own design gets fixed before delivery, not shipped with a caveat.
- Every contract decision names the consumer consequence it buys; "because best practice" is not a justification — delete or justify.
- Step 1 has evidence: name the incumbent spec, routes, or client code actually inspected. Defaults applied to an API that has conventions is the failure mode.
- Every mutation in the design answers the retry question (idempotency key or naturally idempotent — stated which); every list endpoint answers the growth question.
- Each open question carries a recommended default; a bare question pushes the design work back to the reader.
Anti-patterns
| Anti-pattern | Instead |
| Offset pagination on a growing table | Opaque cursor over an indexed sort key |
| Breaking change hidden as a "fix" | New version; the old shape never changes under a client |
| Per-endpoint error shapes | One envelope, one shared client-side parser |
| Sequential integer ids in URLs | Opaque prefixed ids; sequence leaks volume and invites enumeration |
PUT that silently drops unknown fields | Declared PATCH semantics; strict validation with named rejections |
| Prose spec that trails the implementation | Machine-readable contract that generates or gates the code |
| Designing for the first client's screen | Resources model the domain; view composition belongs to the client |
Does 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.

