api-conventions
Skill7 starsChanged 2 days agoMITView on GitHub
HTTP/JSON API payloads in any language: DTOs, JSON casing, pagination, OpenAPI docs. TRIGGER when: adding or changing an endpoint, handler, route, controller or DTO/schema type; returning a list from an endpoint; designing a JSON body, params or an OpenAPI spec; user asks about API contracts, serialisation, casing or pagination. SKIP when: no request/response surface is touched, or the surface is not JSON over HTTP (gRPC, GraphQL, JSON-RPC). Load `rest-conventions` alongside for URLs and methods.
17 other projects use a version of this.
Adopted by
Most recently taken up by
- willdady/platypustheir own version, first seen Nov 25, 2026
- leroyguillaume/skillsword for word, first seen Nov 22, 2026
- RichardMcQuiston01/unofficial-claude-skill-examplestheir own version, first seen Nov 16, 2026
- LeanMeanCleanApps/CleanLambdaFunctiontheir own version, first seen Nov 15, 2026
- LeanMeanCleanApps/CleanWebApitheir own version, first seen Nov 15, 2026
- LeanMeanCleanApps/CleanGraphQLApitheir own version, first seen Nov 15, 2026
Used with
Projects with it also use add-a-use-case, branches-and-pull-requests and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
LeanMeanCleanAppsSkilladd-a-use-case
How to add a command or query to the Application layer as a vertical slice (request, handler, validator, tests) using source-generated Mediator. Use when adding a new feature, a new query, or a new write operation.
Also in 5 projects that use this
LeanMeanCleanAppsSkillbranches-and-pull-requests
Branch naming (feature/, fix/, chore/), how labels and release notes follow from the branch, the pull request template, and how changes get merged in the template repository. Use when creating a branch, writing a commit or opening a pull request.
Also in 5 projects that use this
- +10 more from LeanMeanCleanApps
Other versions17 projects use a version of this.
Word for word · 1
- leroyguillaume/skills★ 7100% same
Edited · 0
None found.
Wrote their own version · 16
- mx-space/core★ 569same name
- LeanMeanCleanApps/CleanMinimalApi★ 401same name
- TheDecipherist/claude-code-mastery-project-starter-kit★ 337same name
- willdady/platypus★ 133same name
- maxyeh0817/Forge★ 34same name
- LeanMeanCleanApps/CleanGraphQLApi★ 13same name
- harness-studio/harness-studio★ 9same name
- LeanMeanCleanApps/CleanWebApi★ 4same name
- CodeWithBehnam/cc-docs★ 2same name
- LeanMeanCleanApps/CleanModelContextProtocol★ 2same name
6 more not listed
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
- 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
- rest-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
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 38
Prefer to make the rule unbreakable by construction: keep the (de)serialisation capability off the domain types themselves (e.g.
“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API conventions
Applies to every JSON-over-HTTP surface, in any language or framework. The language skills restate the mechanics (which validation crate, which serde attribute) where they need to be concrete.
This skill owns what goes in the messages. rest-conventions owns the
URLs and methods — the path names a resource, the method is the verb, and
no endpoint is called /list or /update. Both apply to every HTTP endpoint.
- Never bind a domain, entity, or persistence model directly to a request or response body. Domain / ORM / database structs stay behind the boundary; they must not be (de)serialised at the wire.
- For every endpoint, define dedicated DTOs named after the operation —
CreateXRequest/UpdateXRequestfor inputs andXResponsefor outputs (using the language's idiomatic casing). One DTO per request and per response; do not reuse a domain type "because the fields happen to match", and do not share one DTO across create and update. - Validate at the DTO layer (e.g. the
validatorcrate in Rust, Pydantic in Python) and convert explicitly between DTOs and domain models (From/Into, a mapper, etc.). A handler's job is exactly: deserialise the request DTO → validate → map to a domain model → call the domain/repository layer → map the result into a response DTO. - Prefer to make the rule unbreakable by construction: keep the
(de)serialisation capability off the domain types themselves (e.g. do not
derive
Serialize/Deserializeon entities) so binding one to the wire fails to compile. - This keeps the wire contract decoupled from internal models: renaming a column or restructuring an entity never silently changes the public API.
- All JSON body fields are
camelCase, regardless of the language's native casing. Apply it at the serialisation layer, not by renaming each field: in Rust put#[serde(rename_all = "camelCase")]on every request/response DTO (schemarshonours it, so the OpenAPI schema matches the wire). Path and query parameters arecamelCasetoo —{jobId},?teamId=— so a name reads the same in the URL and in the body. - Name foreign-key fields consistently as
<entity>_id(→<entity>Idon the wire):creator_id,game_id— never a mix likecreated_byalongsidegame_id. The referenced entity's own identifier staysid. Pick the suffix convention once and apply it to every reference field. - Group endpoints into named categories so the generated reference is
navigable: tag every operation (OpenAPI
tag/ the framework's equivalent) and declare the tags up front with a description and a deliberate order (e.g.Authentication, then the main resources). No operation ships untagged. - Serve the OpenAPI document from the application itself, at
/openapi.json. It is generated from the code by the framework (aidein Rust, FastAPI's own generator in Python, …), never hand-written, and no copy is committed to the repository — a generated file that can only ever be a stale duplicate of what the process already publishes is not worth the upkeep. - Render that document with Scalar at
/docs, and with nothing else. The path and the tool are both fixed, in every language and framework: a reader who knows one of our APIs knows where the reference is on all of them. Whatever documentation UI the framework bundles gets switched off so it cannot drift from Scalar or squat the path — in FastAPI that isdocs_url=Noneandredoc_url=Noneon the application, then a route of your own on/docs. - Load Scalar from its CDN, at an exact version
(
https://cdn.jsdelivr.net/npm/@scalar/api-reference@<x.y.z>, the latest release resolved when you write it —npm view @scalar/api-reference version— never from memory), not from a build vendored into the service, which moves only when the library bundling it does (check which Scalar build theaideversion in use ships). An unpinned URL serves whatever was published last: the page changes, or breaks, with no change to the service, and two deploys of one commit render differently. The trade-off is that/docsneeds egress from the reader's browser — the service itself never calls out for it, and/openapi.jsonanswers regardless — which is the right side of the bargain for a docs page. /docsis a page, not an operation: keep it out of the document (in FastAPI,include_in_schema=False), so it never shows up in a generated client or in the tool set an MCP layer derives from the spec.- Always paginate list endpoints — never return an unbounded collection.
Any endpoint that returns a collection takes pagination parameters and caps
how much it returns. The repository/data-layer method that backs it must
likewise never materialise the whole table in memory: it either takes a limit
or returns a stream that the boundary consumes (e.g.
sqlx's.fetch()), applying the page size as it goes. Pagination of the wire contract is non-negotiable regardless of which the data layer uses. Use offset/limit pagination on the wire:- Query params
page(1-based) andperPage(camelCase on the wire). The boundary maps them tolimit = perPage,offset = (page - 1) * perPagefor the data layer. - Enforce a default and a hard maximum
perPage(e.g. default 50, max 100): clamp/validate at the DTO layer so a client can never request an unbounded page. Missing params fall back to the defaults. - Return a paginated envelope, not a bare array:
{ "items": [...], "page": 1, "perPage": 50, "total": 1234 }(totalbeing the number of rows matching the request's filters, across all pages) so clients can compute the page count. - Offset/limit is the default; reach for cursor/keyset pagination only when a specific endpoint has deep-pagination or stable-ordering needs that offset can't meet, and say why.
- Query params
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.

