api-design
Skill4 starsChanged 40 days agoMITView on GitHub
REST API design best practices: resource naming, versioning, error handling, pagination, HATEOAS, rate limiting, OpenAPI documentation. Trigger: API design, REST API, endpoint, OpenAPI, RESTful, API versioning, or API documentation.
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 repository18 other files it gives its agents.
- changelog-maintenanceSkill
- code-mentorSkill
- create-readmeSkill
- database-designSkill
- dockerSkill
- frontend-design-anti-slopSkill
- frontend-engineeringSkill
- git-commitSkill
- github-essentialsSkill
- java-junitSkill
- java-springbootSkill
- java-springboot-testingSkill
- latexSkill
- solution-designSkill
- ui-componentsSkill
- update-readmeSkill
- vault-tech-noteSkill
- web-mvcSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 165 edited versions we read keep these.
0
Distinctive
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
- Very specific: line 151
Use springdoc-openapi (springdoc-openapi-starter-webmvc-ui for Boot 3+):
“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
When to Use
- Designing a new REST API
- Reviewing or refactoring existing endpoints
- Defining error responses, pagination, or versioning strategy
- Writing OpenAPI/Swagger documentation
- Implementing HATEOAS or rate limiting
Instructions
1. Resource Naming
| Pattern | Example | Notes |
GET /resources | GET /users | List collection |
POST /resources | POST /users | Create (return 201 + Location header) |
GET /resources/:id | GET /users/42 | Single resource |
PUT /resources/:id | PUT /users/42 | Full replace |
PATCH /resources/:id | PATCH /users/42 | Partial update |
DELETE /resources/:id | DELETE /users/42 | Delete |
GET /resources/:id/subresources | GET /users/42/orders | Sub-collection |
POST /resources/:id/subresources | POST /users/42/orders | Create sub-resource |
Rules:
- Plural nouns, not verbs:
/usersnot/getUsers - Consistent casing:
kebab-caseorsnake_case, not mixed - Nest by ownership, not by convenience: max 2 levels deep
- Verbs only for actions that are not CRUD:
POST /orders/42/cancel
2. Versioning
| Strategy | How | Pros | Cons |
| URI path | GET /v1/users | Explicit, cacheable, easy to route | URL pollution on breaking changes |
| Header | Accept: application/vnd.myapp.v1+json | Clean URLs, content negotiation | Harder to discover, caching complexity |
| Query param | GET /users?version=1 | Easy to test | Pollutes query space, not cache-friendly |
Recommendation: URI path for public APIs, header for internal/microservices.
3. Error Handling (RFC 9457 / application/problem+json)
HTTP/1.1 422 Unprocessable Entity
Content-Type: application/problem+json
{
"type": "https://api.example.com/errors/order/invalid-status",
"title": "Invalid order status transition",
"status": 422,
"detail": "Cannot transition order 42 from 'shipped' to 'pending'.",
"instance": "/orders/42",
"timestamp": "2025-05-31T10:30:00Z"
}Always use consistent error envelope. Map HTTP status codes semantically:
| Code | When |
| 400 | Malformed request body / validation error |
| 401 | Missing or invalid authentication |
| 403 | Authenticated but not authorized |
| 404 | Resource not found |
| 409 | Conflict (duplicate, stale version) |
| 422 | Unprocessable entity (business rule violation) |
| 429 | Rate limited |
| 500 | Unexpected server error (never leak details) |
Never return 5xx for client errors or 4xx for server faults.
4. Pagination
Cursor-based (preferred for large datasets):
GET /users?cursor=eyJpZCI6NDJ9&limit=20
{
"data": [...],
"pagination": {
"next": "eyJpZCI6NjJ9",
"limit": 20
}
}Offset-based (acceptable for small/admin datasets):
GET /users?page=1&size=20
{
"data": [...],
"pagination": {
"page": 1,
"size": 20,
"total": 150,
"total_pages": 8
}
}5. HATEOAS
Guide clients via links in responses — they don't hardcode URLs:
GET /orders/42
{
"id": 42,
"status": "pending",
"_links": {
"self": { "href": "/orders/42" },
"cancel": { "href": "/orders/42/cancel", "method": "POST" },
"pay": { "href": "/orders/42/pay", "method": "POST" }
}
}Spring Boot: org.springframework.boot:spring-boot-starter-hateoas
6. Rate Limiting
| Strategy | How | Best for |
| Token bucket | Fixed rate, burst allowed | General purpose |
| Sliding window | Rolling time window | Strict rate enforcement |
| Leaky bucket | Smooth output rate | Queue processing |
Response headers:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 42
X-RateLimit-Reset: 1717142400OpenAPI / SpringDoc
Use springdoc-openapi (springdoc-openapi-starter-webmvc-ui for Boot 3+):
@Operation(summary = "List all users", description = "Returns paginated list of active users")
@ApiResponse(responseCode = "200", description = "Users found")
@ApiResponse(responseCode = "401", description = "Unauthorized")
@GetMapping
public ResponseEntity<Page<UserResponse>> listUsers(
@Parameter(description = "Cursor for pagination") @RequestParam(required = false) String cursor
) { ... }Annotate every endpoint — don't rely on auto-generated names.
Anti-Patterns
/apiprefix on every route —api.example.comor gateway takes care of it- Nested resources beyond 3 levels —
/a/1/b/2/c/3/d/4is unreadable; use query params - Returning 200 with error in body — use correct HTTP status codes
- Leaking stack traces in production responses — use
@ControllerAdviceto sanitize - Breaking existing clients without versioning or migration window
/getAllUsers— REST uses HTTP methods, not verbs in the URL
Commands
# Generate OpenAPI spec at runtime
curl localhost:8080/v3/api-docs | jq .
# OpenAPI UI
open http://localhost:8080/swagger-ui.htmlDoes 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.

