API Design
Skill3 starsChanged 8 months agoMITView on GitHub
Design or review an HTTP or library API for clarity, evolvability and honest failure. Use when adding an endpoint, designing an interface, or reviewing one.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- justanesta/claude-code-resourcestheir own version, first seen Jan 20, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- justanesta/claude-code-resources★ 2same 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 repository6 other files it gives its agents.
- Code ReviewSkill
- Data CleaningSkill
- DebuggingSkill
- Incident ReportSkill
- Release NotesSkill
- Technical WritingSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
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
- Distinctive: line 26
Every optional field is a combination someone will send.
- Very specific: line 29
Prefer one required field with an enum over several optional booleans.
- Distinctive: line 39
Every error needs three things: a status code with the right *class* (4xx the caller's fault, 5xx yours), a stable machine-readable code, …
- Distinctive: line 71
Ask, in order: What breaks if a field is added?
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
API Design
An API is a promise about the future. Almost every design decision is really a question about what will be hard to change later, and the ones that hurt are rarely the ones that felt hard at the time.
Name things after what they mean to the caller
The caller does not know your table names or your internal states. An endpoint
called /api/v1/user_profile_aggregate_view leaks a schema decision into a
contract you cannot change without a version bump. /users/{id}/profile says the
same thing and survives the schema being rewritten.
Same for parameters. include_deleted is honest; mode=2 is a note to yourself.
Make illegal states unrepresentable
Every optional field is a combination someone will send. Three optional booleans are eight cases, and you will handle four of them.
Prefer one required field with an enum over several optional booleans. Prefer
separate endpoints over one endpoint with a type parameter that changes which
other fields are required — the second shape cannot be validated or typed.
Errors are part of the interface
An API that returns 500 for a validation failure is an API whose callers cannot distinguish "I sent something wrong" from "you are broken", so they retry the first and give up on the second — exactly backwards.
Every error needs three things: a status code with the right class (4xx the
caller's fault, 5xx yours), a stable machine-readable code, and a message that
says what to do. {"error": "invalid_date_range", "message": "start must be
before end"} is actionable. {"error": "Bad Request"} is not.
Design for the second version now
Three cheap decisions that avoid a breaking change later:
- Return an object, not an array.
{"items": [...]}can grow anext_cursor; a bare array cannot. - Paginate from the start. Any list that can grow will. Retrofitting pagination is a breaking change; shipping it unused is one field.
- Accept unknown fields, ignore them. A client sending a field from a newer version should not get a 400.
Idempotency where it costs something
Any operation with a side effect will be retried — by a client, a proxy, a queue,
a person double-clicking. PUT and DELETE should be naturally idempotent.
POST that charges money or sends mail needs an idempotency key, and the answer
"we will handle duplicates later" means duplicates in production.
Say no to the convenience parameter
The request to add ?expand=orders,items,customer always arrives. It turns one
endpoint into a query language, makes response size unbounded, and makes caching
impossible. Two round trips are usually fine. If they genuinely are not, that is
a distinct endpoint with a documented shape.
Reviewing an existing API
Ask, in order: What breaks if a field is added? What does a caller do with each error? Which combination of optional fields is untested? What is the largest possible response? Which operation is not safe to retry?
See references/versioning.md when the change is not backwards compatible.
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.

