rest-api-design
Installation
SKILL.md
REST API Design
API designed for the developer-client. KISS, standard vocabulary, predictable shapes — expose what clients need, not the internal data model.
Non-negotiables (never omit from an answer)
422= schema/type invalid;400= valid body but illegal operation (insufficient balance, already shipped);409= state collision (concurrent edit, duplicate). Name all three when choosing one.- State-changing side effects (payments, orders, sends) must take
Idempotency-Key; replay the stored response, cache 2xx/4xx, allow retry on 5xx. - Every error body must carry a machine-readable
error_code, a humanmessageand field-level details for validation. - Creation returns
201+Location:; delete returns204; never2xxon error. - Lists are paginated from day one; filter/sort/expand fields are whitelisted server-side.
Workflow
- Identify resources — nouns, plural, ≤2 levels of nesting
- Map operations to HTTP verbs + status codes (table below)
- Define pagination / filter / error envelope / auth upfront, not retrofitted
- Document with copy-paste-ready
curlexamples per endpoint