Backend API Design

Installation
SKILL.md

Backend API Design

Workflow

  1. Name the consumer and the job-to-be-done. Client type (web, mobile, third party), call frequency, payload size, offline needs. These decide the shape more than style guides do.

  2. Model resources and state transitions, not CRUD verbs. Every mutation should be expressible as a transition with preconditions.

  3. Choose the style deliberately:

    Need Style
    Resource CRUD, cacheable, broad clients REST + JSON
    Aggregated views, many client shapes GraphQL (with persisted queries + depth limits)
    Low-latency internal, typed contracts gRPC / tRPC
    Fire-and-forget, long-running Async job API (202 + job resource + webhook)
  4. Fix the cross-cutting contract once: auth scheme, error envelope, pagination, filtering, sorting, idempotency, rate limits, timestamps (RFC 3339 UTC), money (integer minor units + currency), IDs (opaque strings, never auto-increment in public APIs).

  5. Write the spec (OpenAPI 3.1 / SDL) before implementation. Generate clients and tests from it.

  6. Define the compatibility policy and enforce it in CI.

Installs
–
First Seen
–