api-endpoint
Skill2 starsChanged 3 months agoMITView on GitHub
Add or change a backend API endpoint on this product, keeping Pydantic as the single contract authority and regenerating the TypeScript client. Use when asked to add an endpoint, expose data to the frontend, change a request or response shape, or wire a new backend capability into a page.
We split this skill into the rules it gives an agent
6 rules. 0 are common, 3 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Read AGENTS.md first. The contract flows one way: Pydantic → OpenAPI → generated TS.
- Very specific: line 33
one per authorization case: no token → 401, wrong role → 403, wrong owner → 403/404 (per docs/SECURITY.md), correct → 2xx
- Very specific: line 42
Commit the frontend/src/generated/ diff as part of this change.
- Very specific: line 46
Never a hand-written interface, never a raw fetch().
- Distinctive: line 59
Never an exception string or SQL fragment.
- Distinctive: line 63
If the endpoint seems to need a queue, a cache, a second data store, or logic in the frontend — stop and propose it per the stop condition …
“Common” is measured: kept by at least 6 in 10 of the 4 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
Add an API endpoint
Read AGENTS.md first. The contract flows one way: Pydantic → OpenAPI → generated TS.
Nothing downstream is written by hand.
Steps
- Schemas — request and response models in
backend/app/schemas/. Declare types, ranges, lengths and enums here; validation is Pydantic's job, not the handler's. - Route —
backend/app/api/<resource>.py, registered on the router inmain.py. Keep it thin: parse, authorize, delegate, return. Always set an explicitresponse_modelso OpenAPI is accurate and internal fields can't leak. - Logic —
backend/app/services/<resource>.py. This is the testable seam. Business rules in a route handler are a defect. - Authorization — on the route, stated explicitly. Firebase established who; you decide may they. Never trust a user ID from the request body.
- Tests —
backend/tests/:- service behaviour (the happy path and the interesting edge)
- the route
- one per authorization case: no token → 401, wrong role → 403, wrong owner → 403/404
(per
docs/SECURITY.md), correct → 2xx
Regenerate
./scripts/generate-api-clientCommit the
frontend/src/generated/diff as part of this change. A schema change without a regenerated client is incomplete, andverify.shwill fail on the drift check.- Frontend — a TanStack Query hook in
frontend/src/api/using the generated types. Never a hand-written interface, never a rawfetch(). ./scripts/verify.sh
Conventions
- Plural noun resources:
/api/projects,/api/projects/{project_id}. - Verbs live in HTTP methods.
POST /api/projects/{id}/archiveis fine for a real state transition;POST /api/doProjectStuffis not. - List endpoints paginate by default, with a hard maximum page size. An unbounded list is an outage with a delay fuse.
- UTC ISO-8601 timestamps. IDs opaque to the frontend.
- Errors follow the contract in
docs/ARCHITECTURE.md: machine-readable code + safe message. Never an exception string or SQL fragment.
Stop
If the endpoint seems to need a queue, a cache, a second data store, or logic in the frontend —
stop and propose it per the stop condition in AGENTS.md.
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- nrjdalal/zerostarter★ 64same name
- Univers42/claude-deal-with-the-devil★ 4same name
- Univers42/harness42★ 4same name
- nrjdalal/inscope★ 3same name
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 repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- db-migrationSkill
- deploySkill
- featureSkill
- frontend-craftSkill
- frontend-pageSkill
- product-shapingSkill
- reviewSkill
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.

