- Contract — Prefer an explicit contract (OpenAPI or equivalent) before wide client use; keep it in sync with implementation.
- Errors — Stable machine-readable
code(or similar); humanmessage; includerequestIdwhere available. Avoid leaking stack traces to clients. - Pagination — Cursor +
limit; document maxlimit; returnnextCursoror page metadata consistently. - Idempotency —
POSTthat allocates or charges: support idempotency keys or dedupe strategy; document behavior. - Versioning — Prefer URL prefix (
/v1/...) or clear deprecation policy; avoid silent breaking changes. - Validation — Validate at the boundary; reject with 400 + structured field errors when helpful.
When editing route/view/handler entrypoints (paths depend on framework—e.g. **/routes/**, **/handlers/**, **/controllers/**, **/views/**, **/api/**):
- Prefer explicit validation and clear request/response shapes at the edge.
- Keep behavior aligned with the contract bullets above.
openapi-contract-node— Contract-first workflow in this pack (Node-oriented; mirror the same steps on other stacks).api-breaking-change— When contracts or clients must move together.release-readiness— API and operational readiness before ship.