design-endpoint
Skill1 starsChanged 2 months agoMITView on GitHub
Design a REST (or RPC) endpoint before implementing — resource and verb, request/response shape, status codes, pagination, filtering, idempotency, versioning under a v1/ folder, and auth. Use when adding an API, when asked to "design the endpoint / API", or before writing a NestJS controller.
In this repository73 other files it gives its agents.
- AGENTS.mdAGENTS.md
- bigquery-analyticsSkill
- cache-invalidationSkill
- mongo-aggregationSkill
- mongo-modelingSkill
- postgres-aggregationSkill
- postgres-indexingSkill
- redis-coordinationSkill
- redis-patternsSkill
- review-querySkill
- code-migrationSkill
- cut-releaseSkill
- data-migrationSkill
- deploy-serviceSkill
- hotfixSkill
- rollbackSkill
- design-eventSkill
- design-schemaSkill
- evolve-contractSkill
- scaffold-nestjs-moduleSkill
- scaffold-projectSkill
- incident-responseSkill
- investigate-bugSkill
- on-callSkill
- postmortemSkill
- audit-skillsSkill
- distill-review-styleSkill
- write-skillSkill
- debug-with-tracesSkill
- define-alertsSkill
- instrument-serviceSkill
- evaluate-dependencySkill
- grillSkill
- handoffSkill
- orientSkill
- phased-deliverySkill
- spikeSkill
- to-questionnaireSkill
- write-adrSkill
- write-prdSkill
- devops-pr-reviewSkill
- go-backend-pr-reviewSkill
- nestjs-backend-pr-reviewSkill
- python-backend-pr-reviewSkill
- react-frontend-pr-reviewSkill
- bisectSkill
- break-couplingSkill
- dead-code-sweepSkill
- deslopifySkill
- extract-moduleSkill
- rebase-cleanSkill
- resolve-merge-conflictsSkill
- split-commitSkill
- tddSkill
- wait-whatSkill
- wide-renameSkill
- bullmqSkill
- kafkaSkill
- sqs-consumerSkill
- audit-dependenciesSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 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.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 47
Every endpoint states its authz rule — not just "authenticated" but "allowed to touch *this* resource" (no IDOR).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Design an endpoint
Design the contract first — it's the expensive thing to change later
(design/evolve-contract).
Shape
- Resource, not action —
POST /users/:id/deactivationsoverPOST /users/:id/deactivatewhere it's natural; pragmatic RPC-style verbs are fine for genuine operations. Be consistent within the service. - Verb semantics —
GETsafe + idempotent,PUT/DELETEidempotent,POSTnot.PATCHfor partial update with a defined merge semantics. - Request body — a DTO with validation (
class-validatorfor NestJS). Reject unknown fields or ignore them — pick one and document it.snake_caseat the wire layer, don't mix. - Response — return the resource (or the entity) directly; don't wrap every response in a new envelope class just for this endpoint. Consistent error shape across the service.
- Status codes —
200/201/204,400(validation),401vs403,404,409(conflict / idempotency),422(semantic),429. Don't invent. - Idempotency — for non-idempotent
POSTthat a client may retry, accept anIdempotency-Keyand dedup.
Collections
- Pagination — cursor/keyset for anything that grows (
?cursor=…&limit=…), notoffset. Return the next cursor. Cap and defaultlimit. - Filtering / sorting — a small allowlist of fields, documented. Don't accept arbitrary query expressions.
- Sparse fields / expansion — only if there's a real need.
Versioning & rollout
- Live under
v1/from day one (NestJS:v1/controllers,v1/dto,v1/services). A breaking change becomesv2/, not an edit — seedesign/evolve-contract. - New public route → added to the RBAC / gateway allowlist in all envs, loop in the platform owner, before it ships.
Auth
- Every endpoint states its authz rule — not just "authenticated" but "allowed to touch this resource" (no IDOR).
- Rate limit where abuse is possible.
Output
The path + verb, the request DTO, the response shape, the status codes, the authz
rule, pagination/filter design. Then hand to
design/scaffold-nestjs-module to build it.
Anti-patterns
- ❌ A new response-wrapper class per endpoint.
- ❌
offsetpagination on a growing collection. - ❌ Arbitrary query-language filters.
- ❌ Inventing status codes, or
200for everything. - ❌ No
v1/, so the first breaking change has nowhere to go. - ❌ Authz that only checks "logged in".
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.

