celestial-skills / rest-api-design-engineering
AGENTS.md1 starsChanged 18 days agoApache-2.0View on GitHub
Design resources, status codes, errors and pagination deliberately and write them down first, so clients can integrate once and keep working as the API evolves.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository182 other files it gives its agents.
- skills/accessibility-audit-engineering/AGENTS.mdAGENTS.md
- skills/angular-app-engineering/AGENTS.mdAGENTS.md
- skills/aspnet-core-api-engineering/AGENTS.mdAGENTS.md
- skills/chrome-extension-engineering/AGENTS.mdAGENTS.md
- skills/ci-cd-pipelines-engineering/AGENTS.mdAGENTS.md
- skills/code-review-engineering/AGENTS.mdAGENTS.md
- skills/compose-android-app-engineering/AGENTS.mdAGENTS.md
- skills/context-engineering-engineering/AGENTS.mdAGENTS.md
- skills/database-migrations-engineering/AGENTS.mdAGENTS.md
- skills/dbt-analytics-engineering/AGENTS.mdAGENTS.md
- skills/dependency-supply-chain-engineering/AGENTS.mdAGENTS.md
- skills/deprecation-and-removal-engineering/AGENTS.mdAGENTS.md
- skills/design-tokens-to-code-engineering/AGENTS.mdAGENTS.md
- skills/django-app-engineering/AGENTS.mdAGENTS.md
- skills/end-to-end-testing-engineering/AGENTS.mdAGENTS.md
- skills/expo-react-native-app-engineering/AGENTS.mdAGENTS.md
- skills/fastapi-service-engineering/AGENTS.mdAGENTS.md
- skills/fastify-api-engineering/AGENTS.mdAGENTS.md
- skills/feature-flags-engineering/AGENTS.mdAGENTS.md
- skills/flutter-app-engineering/AGENTS.mdAGENTS.md
- skills/framework-upgrades-engineering/AGENTS.mdAGENTS.md
- skills/git-workflow-engineering/AGENTS.mdAGENTS.md
- skills/go-http-service-engineering/AGENTS.mdAGENTS.md
- skills/graphql-api-engineering/AGENTS.mdAGENTS.md
- skills/incident-response-engineering/AGENTS.mdAGENTS.md
- skills/incremental-implementation-engineering/AGENTS.mdAGENTS.md
- skills/internationalisation-engineering/AGENTS.mdAGENTS.md
- skills/kubernetes-helm-engineering/AGENTS.mdAGENTS.md
- skills/laravel-app-engineering/AGENTS.mdAGENTS.md
- skills/launch-readiness-engineering/AGENTS.mdAGENTS.md
- skills/llm-features-and-evals-engineering/AGENTS.mdAGENTS.md
- skills/marketing-site-engineering/AGENTS.mdAGENTS.md
- skills/nestjs-service-engineering/AGENTS.mdAGENTS.md
- skills/nextjs-app-engineering/AGENTS.mdAGENTS.md
- skills/nuxt-app-engineering/AGENTS.mdAGENTS.md
- skills/observability-engineering/AGENTS.mdAGENTS.md
- skills/privacy-by-design-engineering/AGENTS.mdAGENTS.md
- skills/python-ml-service-engineering/AGENTS.mdAGENTS.md
- skills/rails-app-engineering/AGENTS.mdAGENTS.md
- skills/react-web-app-engineering/AGENTS.mdAGENTS.md
- skills/release-and-versioning-engineering/AGENTS.mdAGENTS.md
- skills/requirements-interview-engineering/AGENTS.mdAGENTS.md
- skills/rust-axum-service-engineering/AGENTS.mdAGENTS.md
- skills/rust-cli-tool-engineering/AGENTS.mdAGENTS.md
- skills/safe-refactoring-engineering/AGENTS.mdAGENTS.md
- skills/secure-code-review-engineering/AGENTS.mdAGENTS.md
- skills/source-grounded-development-engineering/AGENTS.mdAGENTS.md
- skills/spec-before-code-engineering/AGENTS.mdAGENTS.md
- skills/spec-driven-development-engineering/AGENTS.mdAGENTS.md
- skills/spring-boot-service-engineering/AGENTS.mdAGENTS.md
- skills/sveltekit-app-engineering/AGENTS.mdAGENTS.md
- skills/swiftui-ios-app-engineering/AGENTS.mdAGENTS.md
- skills/systematic-debugging-engineering/AGENTS.mdAGENTS.md
- skills/task-breakdown-engineering/AGENTS.mdAGENTS.md
- skills/tauri-desktop-app-engineering/AGENTS.mdAGENTS.md
- skills/technical-documentation-engineering/AGENTS.mdAGENTS.md
- skills/terraform-infrastructure-engineering/AGENTS.mdAGENTS.md
- skills/test-first-development-engineering/AGENTS.mdAGENTS.md
- skills/threat-modelling-engineering/AGENTS.mdAGENTS.md
- skills/typescript-library-engineering/AGENTS.mdAGENTS.md
- The first 60 shown.
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 25
Use one naming convention for fields across the API (for example camelCase) and ISO 8601 UTC timestamps.
- Distinctive: line 26
Never return 200 with an error in the body.
- Distinctive: line 29
Never remove or change the meaning of a field within a major version.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md 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
AGENTS.md — REST API design
Design resources, status codes, errors and pagination deliberately and write them down first, so clients can integrate once and keep working as the API evolves.
How to do it
- Model the resources — Name the nouns the client works with (orders, line-items, refunds) as plural collection paths with stable ids: /orders, /orders/{orderId}. Nest only for true ownership and no deeper than one level. Express actions that do not fit CRUD as sub-resources (POST /orders/{id}/cancellation).
- Write the contract first — Describe the endpoints in an OpenAPI document before implementing: methods, request and response schemas, required fields, examples, error responses and auth. Review the contract with a consumer before writing handlers.
- Use methods and status codes precisely — GET reads and is safe; PUT replaces and is idempotent; PATCH partially updates; DELETE removes and is idempotent; POST creates or triggers. Return 200 with a body, 201 with a Location header on create, 204 with no body, 400 for malformed input, 401 unauthenticated, 403 forbidden, 404 not found, 409 conflict, 422 validation failure, 429 rate limited.
- Return one error shape everywhere — Use a single machine-readable error format, such as application/problem+json with type, title, status, detail and a field-level errors array. Include a stable error code clients can branch on and a request id for support.
- Paginate every list — Never return an unbounded collection. Use cursor pagination for large or changing data (limit plus an opaque next cursor), set a default and maximum page size, and document the sort order.
- Make writes safe to retry — Accept an Idempotency-Key header on POST endpoints that create or charge. Store the key with the response for a fixed window and replay the original response on repeat; return 409 if the same key arrives with a different body. Use ETags with If-Match for optimistic concurrency on updates.
- Plan for change without breaking clients — Adding optional fields and new endpoints is non-breaking. Removing or renaming fields, tightening validation or changing meaning is breaking: ship it under a new major version (path /v2 or a version header), run both, announce a deprecation date with Deprecation and Sunset headers, and remove only after usage drops.
- Test the contract — Validate real responses against the OpenAPI schema in CI and run a breaking-change diff between the main branch contract and the pull request.
Checklist (before a pull request)
- An OpenAPI document describes every changed endpoint with examples
- Paths are plural nouns with stable ids and at most one level of nesting
- Each endpoint returns the documented status codes and one error shape
- Every list endpoint is paginated with a maximum page size
- Create and charge endpoints accept an idempotency key
- The breaking-change check passes or a new major version is introduced
- Responses are validated against the schema in tests
Rules
- Use one naming convention for fields across the API (for example camelCase) and ISO 8601 UTC timestamps. (Mixed conventions force every client to special-case fields.)
- Never return 200 with an error in the body; the status code must reflect the outcome. (Clients, proxies and monitoring all rely on status codes.)
- Authorise every request against the resource being accessed and return 404 rather than 403 when revealing existence would leak data. (Sequential or guessable ids invite enumeration.)
- Cap page sizes and support conditional GET with ETags. (Unbounded lists and repeated full downloads overload both server and client.)
- Never remove or change the meaning of a field within a major version. (Clients you cannot see will break silently.)
Checks
| Gate | Tool | Threshold | When |
| Contract check | OpenAPI linter + breaking-change diff | 0 lint errors; no breaking changes against main without a new major version | Every pull request that changes the API |
Generated from the Celestial engineering practice “REST API design”.
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.

