api-design
Skill0 starsChanged 32 days agoMITView on GitHub
Design clean, consistent HTTP APIs. Use when the user asks to design an endpoint, review an API contract, add a new route, define request/response shapes, write an OpenAPI spec, or decide on REST vs GraphQL vs RPC for a feature.
191 other projects use a version of this.
Adopted by
Most recently taken up by
- RostislavDugin/postgresustheir own version, first seen Nov 8, 2026
- Markssuave/Markssuave-Agent-skillstheir own version, first seen Nov 8, 2026
- Rojios/everything-claude-codetheir own version, first seen Nov 8, 2026
- ishandutta2007/Awesome-Claude-Skillstheir own version, first seen Nov 8, 2026
- databasus/databasustheir own version, first seen Nov 8, 2026
- lhbsaa/apex-unifiedtheir own version, first seen Nov 8, 2026
Used with
Projects with it also use db-design, everything-claude-code 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.
yuexueyuSkilldb-design
数据库工程师技能 - Schema设计、索引优化、并发安全、数据库审计。当你涉及数据库表/字段/索引/SQL/迁移/MCP数据库操作、建表改表、写查询时必须使用此技能。即使用户只是说"加个字段"或"查下数据",也应触发。
Also in 4 projects that use this
InfopibeSkilleverything-claude-code
Also in 9 projects that use this
mryeastcodeSkilleverything-claude-code-conventions
Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.
Also in 8 projects that use this
tpavanipradeepSkillnextjs-turbopack
Next.js 16+ and Turbopack — incremental bundling, FS caching, dev speed, and when to use Turbopack vs webpack.
Also in 15 projects that use this
Indium-AI-LabsSkilldata-pipeline-design
Design batch or incremental ETL and ELT pipelines and warehouse models: grain, partitioning, idempotent loads, late-arriving data, data quality tests, PII controls, and cost monitoring, before building them. Use when adding or changing a dbt model, warehouse table, scheduled transformation, or ingestion job. Not for transactional schema design (use the database-design skill) or event-sourced stores (use the event-sourcing-architecture skill).
Also in 3 projects that use this
thejordanleopoldSkillthird-party-integration
Use when integrating with external APIs, payment processors (Stripe), webhooks, or third-party services. Use when implementing API clients with authentication and rate limiting, handling webhooks with signature verification and idempotency, writing contract tests for external services, or isolating third-party dependencies behind adapters. Triggers: \"Stripe\", \"payment integration\", \"webhook\", \"third-party API\", \"external service\", \"API client\", \"integrate with\", \"signature verification\", \"idempotency key\".
Also in 3 projects that use this
Other versions191 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 191
- affaan-m/ECC★ 246ksame name
- databasus/databasus★ 9.3ksame name
- RostislavDugin/postgresus★ 9.3ksame name
- authgear/authgear-server★ 2.1ksame name
- xu-xiang/everything-claude-code-zh★ 1.9ksame name
- Aaronontheweb/dotnet-skills★ 1.2ksame name
- epam/ai-dial-chat★ 501same name
- loulanyue/awesome-claude-notes★ 272same name
- KbWen/agentic-os★ 229same name
- DevelopersGlobal/ai-agent-skills★ 216same name
181 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 repository68 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- accessibilitySkill
- api-versioningSkill
- authSkill
- background-jobsSkill
- cachingSkill
- capacity-planningSkill
- changelogSkill
- chaos-engineeringSkill
- ci-cdSkill
- circuit-breakerSkill
- claude-best-practicesSkill
- code-commentsSkill
- code-hygieneSkill
- code-reviewSkill
- code-structureSkill
- commit-styleSkill
- concurrency-and-lockingSkill
- database-transactionsSkill
- data-consistencySkill
- debug-infra-startupSkill
- debug-sessionSkill
- demo-video-creatorSkill
- demo-video-script-creatorSkill
- dependency-injectionSkill
- dependency-updateSkill
- disk-cleanupSkill
- distributed-tracingSkill
- dockerSkill
- env-configSkill
- env-setupSkill
- error-handlingSkill
- event-driven-architectureSkill
- feature-flagsSkill
- file-storageSkill
- graceful-shutdownSkill
- idempotencySkill
- input-validationSkill
- jars-engineering-blogsmithSkill
- jars-workshop-builderSkill
- licensingSkill
- loggingSkill
- memory-and-allocationsSkill
- migrate-dbSkill
- monitoringSkill
- multi-tenancySkill
- notificationsSkill
- openapiSkill
- paginationSkill
- perf-profileSkill
- pr-descriptionSkill
- query-optimizationSkill
- rate-limitingSkill
- refactorSkill
- releaseSkill
- runbook-writerSkill
- searchSkill
- secrets-auditSkill
- simplifySkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. 0 are common, 10 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 165 edited versions we read keep these.
10
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 17
Be boring: Use the HTTP method and status code the spec actually defines.
- Distinctive: line 36
Ask (or find in context):
- Very specific: line 61
No verbs in the URL (except action sub-routes): /users/{id}/activate, not /activateUser.
- Distinctive: line 62
No trailing slashes unless the existing API uses them.
- Very specific: line 91
Add minLength, maxLength, minimum, maximum, pattern, enum for every field that has a natural constraint.
- Distinctive: line 94
Never accept raw HTML, SQL, or executable content unless the endpoint exists specifically to process it, and even then sanitise it.
- Very specific: line 137
Never return a 200 with { "success": false }.
- Distinctive: line 141
Check whether the existing service uses API keys, JWT, OAuth 2, session cookies, or mTLS.
- Distinctive: line 161
Update the OpenAPI/Swagger file, or create one if none exists:
- Distinctive: line 171
All parameters with types and descriptions
- Distinctive: line 172
All possible response codes with example bodies
- Distinctive: line 176
Before implementation, share the spec with whoever will consume the API (or re-read it as if you are the caller):
- Distinctive: line 183
If the answer to any is "no", revise the spec.
“Common” is measured: kept by at least 6 in 10 of the 165 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 design
Design APIs that are easy to consume, hard to misuse, and consistent enough that a new developer can guess the next endpoint before reading the docs.
Ground rules
- Read what already exists. Grep for existing routes, OpenAPI/Swagger files, GraphQL schemas, or REST conventions before proposing anything new. New endpoints must fit the existing style.
- One resource, one URL. Each endpoint does one thing. An endpoint that "creates and also sends an email and optionally deletes the old one" is three jobs — split it.
- Be boring. Use the HTTP method and status code the spec actually defines. Do not invent new conventions when standard ones exist.
- Design the contract before writing the handler. Agree on the URL, method, request shape, and response shape first. The implementation follows the contract, not the other way around.
- Never break a published contract without versioning. Additive changes (new optional fields) are usually fine; removing or renaming fields is a breaking change.
Workflow
1. Understand the context
# Find existing routes
grep -rn "router\.\|app\.\|@app\.\|Route\|path=" src/ --include="*.py" --include="*.ts" --include="*.js"
# Find the OpenAPI or API description file
find . -name "openapi*.yaml" -o -name "openapi*.json" -o -name "swagger*.yaml" | head -5Ask (or find in context):
- What resource does this endpoint act on?
- Who calls it — a browser, a mobile client, another service?
- What authentication scheme is already in use?
- Does the project use REST, GraphQL, tRPC, gRPC, or something else?
2. Pick the right method and URL
For REST follow these conventions without deviation:
| Action | Method | URL |
| List a collection | GET | /resources |
| Get one item | GET | /resources/{id} |
| Create | POST | /resources |
| Full replace | PUT | /resources/{id} |
| Partial update | PATCH | /resources/{id} |
| Delete | DELETE | /resources/{id} |
| Sub-resource | GET/POST | /resources/{id}/sub |
| Non-CRUD action | POST | /resources/{id}/action-name |
URL rules:
- Lowercase, hyphen-separated words:
/payment-methods, not/paymentMethods. - Plural nouns for collections:
/orders, not/order. - No verbs in the URL (except action sub-routes):
/users/{id}/activate, not/activateUser. - No trailing slashes unless the existing API uses them.
- Resource nesting only one level deep:
/orders/{id}/itemsyes;/orders/{id}/items/{iid}/tags— flatten it.
3. Define the request shape
For every non-GET endpoint, define:
# Example in OpenAPI 3 style
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [name, email]
properties:
name:
type: string
minLength: 1
maxLength: 255
email:
type: string
format: email
additionalProperties: falseRules:
- Mark every field
requiredor optional explicitly. Implicit optionality hides bugs. - Add
minLength,maxLength,minimum,maximum,pattern,enumfor every field that has a natural constraint. additionalProperties: falseprevents clients from sending junk that gets silently ignored.- Never accept raw HTML, SQL, or executable content unless the endpoint exists specifically to process it, and even then sanitise it.
4. Define the response shape
Pick the right status code:
| Situation | Code |
| Successful GET, PATCH, PUT | 200 OK |
| Created resource | 201 Created + Location: /resources/{id} header |
| Accepted for async processing | 202 Accepted |
| Successful DELETE with no body | 204 No Content |
| Bad input (client error) | 400 Bad Request + error body |
| Missing or invalid credentials | 401 Unauthorized |
| Valid credentials, wrong permissions | 403 Forbidden |
| Resource not found | 404 Not Found |
| Method not allowed | 405 Method Not Allowed |
| Conflict (duplicate, state mismatch) | 409 Conflict |
| Validation failed | 422 Unprocessable Entity |
| Server error | 500 Internal Server Error |
Return consistent error bodies:
{
"error": {
"code": "VALIDATION_FAILED",
"message": "name is required",
"fields": { "name": "required" }
}
}Return consistent success bodies. For collections, include pagination metadata:
{
"data": [...],
"meta": { "total": 84, "page": 2, "pageSize": 20 }
}Never return a 200 with { "success": false }. Use the status code.
5. Handle auth and permissions
- Check whether the existing service uses API keys, JWT, OAuth 2, session cookies, or mTLS. Match it — do not introduce a second auth scheme.
- Authorisation belongs in the handler or a middleware, never in the URL
(
/admin/usersis a smell — use middleware to check roles). - Return
401when identity is missing or invalid,403when the identity is known but not allowed. Never swap them.
6. Design for change
Before finalising:
- Could a field name be mistaken for another? Rename it.
- Could a required field become optional later without a breaking change? Make it optional now.
- Is the response returning more data than the caller needs? Consider a
fieldsquery param or a dedicated summary shape. - Does the endpoint need to be called in a loop? Consider a batch variant.
- Will the resource list grow unbounded? Add cursor- or offset-based pagination from day one.
7. Document it
Update the OpenAPI/Swagger file, or create one if none exists:
# Validate an OpenAPI file
npx @redocly/cli lint openapi.yamlAt minimum, each endpoint needs:
- A
summary(one sentence) - A
descriptionfor any non-obvious behaviour - All parameters with types and descriptions
- All possible response codes with example bodies
8. Review the contract
Before implementation, share the spec with whoever will consume the API (or re-read it as if you are the caller):
- Can you build a client from this spec alone, without reading the implementation?
- Are the error codes specific enough to act on?
- Would a new developer guess the next endpoint correctly?
If the answer to any is "no", revise the spec.
Common mistakes to avoid
| Mistake | Correct approach |
Tunnelling everything through POST /api/do | Use resource URLs and the right method |
Returning 500 for validation errors | Return 400 or 422 with field details |
Swallowing auth errors as 404 to "hide" resources | Return 403; hiding is security theatre |
| Nesting resources three levels deep | Flatten: expose the leaf resource directly |
| Mutable resource IDs | IDs are permanent; if a slug changes, keep an alias |
| Skipping pagination on list endpoints | Every collection endpoint needs pagination |
| Returning the whole record after every mutation | Return the updated record or 204; let the client decide if it needs to re-fetch |
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.

