rest-conventions
Skill7 starsChanged 3 days agoMITView on GitHub
REST resource design for HTTP APIs: URLs, methods, status codes, errors. TRIGGER when: adding, renaming or reviewing an HTTP endpoint, route or controller; designing a URL, method or status code; a path contains a verb or `?action=`; user asks about REST or endpoint naming. SKIP when: the surface is deliberately not REST (gRPC, GraphQL, JSON-RPC, webhooks). Load `api-conventions` alongside.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- leroyguillaume/skillsword for word, first seen Nov 22, 2026
Other versions1 project uses a version of this.
Word for word · 1
- leroyguillaume/skills★ 7100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository54 other files it gives its agents.
- adr-conventionsSkill
- api-conventionsSkill
- architecture-conventionsSkill
- argocd-conventionsSkill
- ci-conventionsSkill
- config-conventionsSkill
- contributing-conventionsSkill
- councilSkill
- cryptography-conventionsSkill
- dependency-update-conventionsSkill
- diagram-conventionsSkill
- docker-conventionsSkill
- documentation-conventionsSkill
- frontend-conventionsSkill
- github-actions-conventionsSkill
- github-issue-conventionsSkill
- github-pr-conventionsSkill
- github-repo-settingsSkill
- gitlab-ci-conventionsSkill
- helm-conventionsSkill
- herdr-core-delegationSkill
- herdr-delegationSkill
- herdr-tui-delegationSkill
- kopf-conventionsSkill
- kubernetes-operator-conventionsSkill
- logging-conventionsSkill
- logo-conventionsSkill
- mise-conventionsSkill
- ollama-conventionsSkill
- openssf-conventionsSkill
- pr-conventionsSkill
- pre-commit-conventionsSkill
- project-metadata-conventionsSkill
- python-async-conventionsSkill
- python-conventionsSkill
- readme-conventionsSkill
- release-script-conventionsSkill
- release-supply-chain-conventionsSkill
- renovate-ci-conventionsSkill
- rust-build-conventionsSkill
- rust-conventionsSkill
- rust-http-conventionsSkill
- security-policy-conventionsSkill
- signal-handling-conventionsSkill
- sql-conventionsSkill
- starlight-conventionsSkill
- systemd-conventionsSkill
- system-user-conventionsSkill
- task-conventionsSkill
- terraform-conventionsSkill
- topic-splittingSkill
- ui-copy-conventionsSkill
- web-layout-conventionsSkill
- yaml-conventionsSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 7 are distinctive, and 4 are 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.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 102
Use the small set that carries information, and use it accurately:
- Very specific: line 104
200: read or update succeeded, body attached · 201 created, with a Location header pointing at the new member · 202 accepted, work … - Distinctive: line 128
All of it is query parameters on the collection, never a new path.
- Distinctive: line 200
Never put a verb, an action or a function name in a path.
- Very specific: line 201
Never use GET for anything that changes state, or give it a body.
- Very specific: line 202
Never return 200 with a failure in the body.
- Distinctive: line 203
Never mix singular and plural collection names in one API.
- Distinctive: line 204
Never return an unbounded collection.
- Very specific: line 205
Never encode a filter as a path segment (/users/active).
- Distinctive: line 206
Never ship an unversioned public API.
- Distinctive: line 207
Never make an identifier's format part of the contract.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
REST conventions
api-conventions owns what goes in the messages. This owns what the
URLs and methods are. Both apply to every HTTP endpoint.
The one rule everything else follows from
The path names a resource. The method is the verb.
A verb in a URL means the method has been reduced to a transport and the API
is RPC wearing REST's clothes. It is the single most common defect in a
hand-rolled HTTP surface, and it compounds: once /team/update exists,
/team/update-budget and /team/update-members follow within the month.
| Never | Always |
GET /getUser?id=7 | GET /users/7 |
GET /users/list, GET /listUsers | GET /users |
POST /users/create, POST /createUser | POST /users |
POST /users/update, POST /updateUser | PUT or PATCH /users/7 |
POST /users/delete, GET /deleteUser?id=7 | DELETE /users/7 |
GET /users/getByEmail?email=… | GET /users?email=… |
GET /users/active, GET /users/findActive | GET /users?status=active |
POST /api?action=updateUser | PATCH /users/7 |
GET /teams/7/getMembers | GET /teams/7/members |
The test: read the URL out loud with no method. If it still describes an
action, it is wrong. /users/7 is a thing; /getUser is an instruction.
Two shapes of URL, and only two
- A collection —
/teams. Plural noun. - A member —
/teams/{teamId}. The collection plus one identifier.
Everything else is one of those two hanging off another:
/teams/{teamId}/members is a collection, /teams/{teamId}/members/{userId}
is a member of it.
- Plural nouns, always.
/users, not/user— even when the collection usually holds one thing. Mixing/user/7and/teams/3in one API is a papercut on every call site forever. kebab-casefor multi-word segments:/billing-entities, never/billingEntitiesor/billing_entities. (Body fields arecamelCase— seeapi-conventions— the two casings are deliberate and unrelated.)- No trailing slash, no file extension.
/teams, not/teams/or/teams.json. Content type is negotiated with headers. - Stop at two levels of nesting.
/teams/{id}/membersis fine;/orgs/{id}/teams/{id}/members/{id}/keysis a URL nobody can build. Past two, make the deep thing a top-level collection and filter it:/keys?teamId=…. - Meta endpoints are exempt from the no-extension rule and from path
versioning (below): the OpenAPI document (
/openapi.json) and the docs UI (/docs) keep the fixed pathsapi-conventionsgives them, and the health/readiness probes keep fixed, unversioned paths of their own. - Identifiers are opaque. A client must never have to parse one, and the server must never make the format part of the contract.
Methods
| Method | Means | Safe | Idempotent | Typical success |
GET | Read. Never changes state — not "usually", never. | yes | yes | 200 |
POST | Create in a collection, or a non-idempotent operation | no | no | 201 + Location, 202 |
PUT | Replace the member with the body, wholesale | no | yes | 200 / 204, 201 if it created |
PATCH | Partial modification | no | no¹ | 200 / 204 |
DELETE | Remove the member | no | yes | 204, also when already gone |
¹ A PATCH can be made idempotent, but nothing guarantees it — do not rely on it.
GET never has side effects and never takes a body. A read that mutates
breaks every cache, proxy, retry and prefetch between client and server.
PUT is a full statement of desired state, not a patch. An absent field
means unset, not leave alone. That is what makes it idempotent, and
idempotence is what makes a client's retry safe — which is usually worth more
than the bytes PATCH saves. Prefer PUT whenever the client can reasonably
send the whole resource, and reach for PATCH when it genuinely cannot
(a large resource, a field-level permission split, a concurrent-editor
problem). If you ship PATCH, say in the docs which fields it accepts and
what omitting one means.
POST to the collection, never to the member, for creation: POST /teams
creates, POST /teams/7 is meaningless. When the client owns the identifier,
PUT /teams/{id} is the create — and it is the better shape, because the
retry is free.
Status codes
Use the small set that carries information, and use it accurately:
200read or update succeeded, body attached ·201created, with aLocationheader pointing at the new member ·202accepted, work happens later (return something the client can poll) ·204succeeded, deliberately no body.400malformed ·401not authenticated ·403authenticated, not allowed ·404no such resource (also the right answer for "exists but you may not know that") ·409conflict with current state ·422well-formed but semantically wrong — this is the one that tells a client to stop retrying ·429rate limited, withRetry-After.5xxthe server failed.502/504specifically when a dependency did, which is the difference between "your request is wrong" and "try again".
Never return 200 with an error inside. {"success": false} under a 200
defeats every generic client, every retry policy and every dashboard, and it is
the reason somebody eventually writes a wrapper that greps the body. The status
code is part of the contract, not decoration.
Distinguish "no" from "not now". A permanent refusal (4xx, minus 408,
425, 429) and a transient failure (5xx, timeouts) are read by different
retry logic, and conflating them either loops a client forever or drops work on
the floor.
Filtering, sorting, searching, pagination
All of it is query parameters on the collection, never a new path.
GET /teams?status=active®ion=eu&sort=-createdAt&page=2&perPage=50- Filters are named after the field they filter on.
- Sorting is one
sortparameter; prefix with-for descending. - Pagination is mandatory on every collection — the envelope and the
page/perPagecontract live inapi-conventions; do not restate them, and do not invent a second scheme beyond the cursor exception it allows. - A search that is genuinely more than filters (full-text, a query language)
still lives on the collection:
GET /teams?q=….
Actions that are genuinely not CRUD
The honest part. Some operations are verbs — cancel an order, rotate a key, block a team, retry a job, send an invitation — and forcing them into create/read/update/delete produces a worse API than admitting it. Three answers, in order of preference:
1. The action changes a state — model the state. Usually the best fix, and usually available.
PUT /orders/{orderId}/status {"status": "cancelled"}
PUT /teams/{teamId}/blocked true2. The action produces a record — model the record. Rotations, retries, invitations and refunds are things that happened, with a time and an author, and are usually worth being able to list afterwards.
POST /keys/{keyId}/rotations
POST /jobs/{jobId}/retries
POST /invitations {"teamId": "…", "email": "…"}3. Only when neither fits, a marked action endpoint — a POST on the
member, with the action as the last segment, and a note in the docs saying why
it is not a resource:
POST /orders/{orderId}/cancelThis is a considered exception, not the default. If a design produces more than
one or two of these, the resources are modelled wrong. And it never applies to
something that is plainly CRUD: POST /users/create has no excuse.
Errors, idempotency, versioning
One error shape for the whole API, on every failure, ideally
application/problem+json (RFC 9457): a stable machine-readable type or
code, a human title/detail, and the field paths when it is a validation
failure. A client must be able to write one error handler.
PUT and DELETE are idempotent by construction — keep them that way.
DELETE on something already gone answers 204, like the first call — never
a 404 or a 409, so a retry after a lost response is indistinguishable from
success. For a POST that a client must be able to retry safely, accept an
Idempotency-Key header and honour it.
Version in the path from the first endpoint: /v1/teams. It costs four
characters now and is impossible to retrofit later. Within a version, only
additive changes: new optional fields, new endpoints. Removing a field,
renaming one, tightening validation or changing a status code is a new version.
Clients must ignore unknown fields, and the docs must say so.
Never:
- Never put a verb, an action or a function name in a path.
- Never use
GETfor anything that changes state, or give it a body. - Never return
200with a failure in the body. - Never mix singular and plural collection names in one API.
- Never return an unbounded collection.
- Never encode a filter as a path segment (
/users/active). - Never ship an unversioned public API.
- Never make an identifier's format part of the contract.
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.

