rust-http-conventions
Skill7 starsChanged 2 days agoMITView on GitHub
Rust HTTP stack: `axum` + `aide`, `schemars`, `validator`. TRIGGER when: editing a Rust HTTP handler, router, extractor or DTO; adding an endpoint to a Rust service; wiring `axum`, `aide`, `schemars`, Scalar or `validator`; OpenAPI from Rust; user asks about multipart, body limits or input validation in Rust. SKIP when: no HTTP surface (`rust-conventions`), or language-agnostic API design (`api-conventions`).
1 other project uses a version of this.
Adopted by
Most recently taken up by
- leroyguillaume/claudeword for word, first seen Nov 29, 2026
Other versions1 project uses a version of this.
Word for word · 1
- leroyguillaume/claude★ 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
- rest-conventionsSkill
- rust-build-conventionsSkill
- rust-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
8 rules. About 0 are common, 1 is distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 47
Never expose an HTTP API without aide: no bare axum::Router for an API, no hand-written OpenAPI.
- Very specific: line 49
Never use a web framework other than axum.
- Very specific: line 50
Never hand-roll input validation (bespoke validate() methods returning Result<(), String>, ad-hoc field checks scattered through handlers) …
- Very specific: line 63
Call aide::generate::extract_schemas(true) once before building the router so types are emitted as reusable #/components/schemas $refs.
- Very specific: line 67
Document path/query parameters with named structs (Path<GamePath>, not Path<Uuid> / Path<(Uuid, Uuid)>).
- Very specific: line 91
Add an example to a request/response schema with #[schemars(extend("example" = serde_json::json!({...})))] — the auto-generated placeholder …
- Very specific: line 94
Keep infrastructure endpoints (liveness/health probe, metrics, …) out of the OpenAPI document: register them with plain route(...), not …
- Distinctive: line 98
If the API has authentication, document it in OpenAPI: register the scheme once
≈ “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
Rust HTTP/API conventions
Applies on top of rust-conventions (language and tooling) and
api-conventions (wire contract: dedicated DTOs, camelCase JSON, pagination,
tagged operations, the OpenAPI document at /openapi.json rendered by Scalar at
/docs). This skill is the Rust-specific stack and its wiring.
Always:
- Every HTTP server / API uses the same stack, always:
axum+aide— no exceptions. Never expose a bareaxum::Routerfor an API: build the router withaide'sApiRouter(drop-in foraxum), and document every endpoint. - Generate the OpenAPI document with
aide(itsApiRouterdrop-in foraxum) andschemars(deriveJsonSchemaon every request/response DTO).api-conventionssays where it is served and what renders it. - Validate deserialised input (request DTOs, config payloads, …) with the
validatorcrate (derive API), not hand-rolled checks. Put#[derive(Validate)]on the input struct, use the built-in field validators (length,range,email,url,nested, …) where they fit, and#[validate(custom(function = path::to::fn))]for domain-specific rules — the function takes&Tand returnsResult<(), validator::ValidationError>, and invalidator≥ 0.19functionis a bare path, not a string literal. Callvalue.validate()?at the edge (e.g. theaxumhandler) and provide aFrom<validator::ValidationErrors>for your error type so it maps to a422. Keep cross-entity / database-backed checks (e.g. "this id must belong to that parent") in the repository/service layer;validatorcovers field-level shape only. Add it withcargo add validator --features derive. - Pass the graceful-shutdown future from
rust-conventionstoaxum::serve(..).with_graceful_shutdown(shutdown_signal()).
Never:
- Never expose an HTTP API without
aide: no bareaxum::Routerfor an API, no hand-written OpenAPI. Every endpoint is documented. - Never use a web framework other than
axum. - Never hand-roll input validation (bespoke
validate()methods returningResult<(), String>, ad-hoc field checks scattered through handlers) when thevalidatorderive can express it, and never pull in another validation crate whenvalidatorfits.
aide wiring, learned the hard way
Most of these surface as a cryptic OperationHandler bound failure, or as an
endpoint that compiles and documents nothing.
- Enable the
aidefeaturesaxum, axum-json, macros— the baseaxumfeature does not makeaxum::JsonanOperationInput/Output, so withoutaxum-jsonno JSON handler satisfiesOperationHandler. - Call
aide::generate::extract_schemas(true)once before building the router so types are emitted as reusable#/components/schemas$refs. - Implement
aide::OperationOutput(a no-optype Inner = ()is enough) for your error type soResult<_, AppError>is a valid documented return. - Document path/query parameters with named structs (
Path<GamePath>, notPath<Uuid>/Path<(Uuid, Uuid)>);aidederives parameter names from the struct fields, so bare/tuple extractors document no parameters. Give those structs#[serde(rename_all = "camelCase")]sojob_idbinds and documents as the{jobId}the route declares. - The
(StatusCode, Json<T>)tuple documents no response; declare the success status of creates explicitly withpost_with(handler, |op| op.response::<201, Json<XxxResponse>>()). - Pin the
schemarsversionaidere-exports (the versionaidedepends on:cargo tree -i schemars) and add itschrono04/uuid1features forDateTime/Uuidfields. OperationInputforQuery<T>is behindaide'saxum-queryfeature. A handler takingQuery<_>fails theOperationHandlerbound (cryptically) until you enable it, so the feature set is usuallyaxum, axum-json, axum-query, macros. A custom extractor likewise needs a (no-op)impl OperationInput.- For file uploads, take axum's
Multipartextractor (multipart/form-data, one field per file → supports several files in one request). Enableaxum-multipartonaide: it providesMultipart'sOperationInput(else theOperationHandlerbound fails) and turns on axum'smultipartfeature itself. axum's default request body limit is only 2 MiB, far too small for PDFs — raise it per route withpost_with(handler, …).layer(DefaultBodyLimit::max(N))(aide'sApiMethodRouterhas.layer, so the limit stays scoped to the upload route rather than the whole API). - Add an
exampleto a request/response schema with#[schemars(extend("example" = serde_json::json!({...})))]— the auto-generated placeholder ("string",null) reads poorly in Scalar. - Keep infrastructure endpoints (liveness/health probe, metrics, …) out of
the OpenAPI document: register them with plain
route(...), notapi_route(...). The documented surface is the product API, not the ops plumbing. - If the API has authentication, document it in OpenAPI: register the
scheme once
and require it per protected operation withrouter.finish_api_with(&mut api, |t| { t.security_scheme( "BearerAuth", aide::openapi::SecurityScheme::Http { scheme: "bearer".into(), bearer_format: Some("JWT".into()), description: None, extensions: Default::default(), }, ) })op.security_requirement("BearerAuth"). Leave public operations (login, public reads) without a requirement. This makes Scalar show the lock icon and a token input.
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.

