api-design
Skill8 starsChanged 2 months agoMITView on GitHub
REST API conventions covering URL structure, HTTP methods, status codes, pagination, filtering, error responses, and versioning. Use when designing or reviewing REST API endpoints, adding routes, or standardizing API error handling.
191 other projects use a version of this, 2 of them edited.
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 · 2
- edjchapman/claude-code-config★ 816% same
- halflength-ampleness75/claude-code-recipes★ 2100% same
Wrote their own version · 189
- 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
179 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 repository5 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- git-workflowSkill
- react-patternsSkill
- testing-strategySkill
- typescript-strictSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 165 edited versions we read keep these.
3
Distinctive
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 54
Use the correct status code.
- Distinctive: line 86
Use a consistent error format across all endpoints:
- Distinctive: line 118
Use cursor-based pagination for large datasets, offset-based for simple cases.
“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
REST API conventions: URL structure, HTTP methods, status codes, pagination, filtering, error responses, and versioning.
URL Structure
- Use nouns, not verbs -- the HTTP method provides the verb
- Use plural resource names --
/users,/orders,/products - Use kebab-case for multi-word resources --
/order-items, not/orderItems - Nest resources to show relationships -- max 2 levels deep
- Use query parameters for filtering, not path segments
# Good
GET /api/v1/users
GET /api/v1/users/123
GET /api/v1/users/123/orders
POST /api/v1/users
PATCH /api/v1/users/123
DELETE /api/v1/users/123
# Bad
GET /api/v1/getUsers
GET /api/v1/user/123
POST /api/v1/users/123/orders/456/items/789/notes # too deeply nestedHTTP Methods
| Method | Purpose | Idempotent | Request Body | Success Code |
| GET | Read resource(s) | Yes | No | 200 |
| POST | Create resource | No | Yes | 201 |
| PUT | Replace resource entirely | Yes | Yes | 200 |
| PATCH | Partial update | No* | Yes | 200 |
| DELETE | Remove resource | Yes | No | 204 |
*PATCH is not guaranteed idempotent, but should be designed to be when possible.
Rules
- GET requests must be safe -- no side effects, no state changes
- POST for creation -- return the created resource with
Locationheader - Use PATCH over PUT -- partial updates are more practical than full replacement
- DELETE should be idempotent -- deleting a non-existent resource returns 204, not 404
Status Codes
Use the correct status code. When in doubt, refer to this table:
Success (2xx)
| Code | Meaning | When to Use |
| 200 | OK | Successful GET, PUT, PATCH |
| 201 | Created | Successful POST that creates a resource |
| 204 | No Content | Successful DELETE, or PUT/PATCH with no response body |
Client Errors (4xx)
| Code | Meaning | When to Use |
| 400 | Bad Request | Malformed JSON, invalid field values, validation errors |
| 401 | Unauthorized | Missing or invalid authentication |
| 403 | Forbidden | Authenticated but lacks permission |
| 404 | Not Found | Resource does not exist |
| 409 | Conflict | Duplicate resource, state conflict |
| 422 | Unprocessable Entity | Valid JSON but fails business rules |
| 429 | Too Many Requests | Rate limit exceeded |
Server Errors (5xx)
| Code | Meaning | When to Use |
| 500 | Internal Server Error | Unexpected server failure |
| 502 | Bad Gateway | Upstream service failure |
| 503 | Service Unavailable | Server overloaded or in maintenance |
Error Responses
Use a consistent error format across all endpoints:
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed.",
"details": [
{
"field": "email",
"message": "Must be a valid email address.",
"code": "INVALID_FORMAT"
},
{
"field": "age",
"message": "Must be at least 18.",
"code": "MIN_VALUE"
}
]
}
}Rules
- Always include a machine-readable error code --
VALIDATION_ERROR,NOT_FOUND,RATE_LIMITED - Include a human-readable message -- suitable for developer debugging
- Never expose internal errors -- no stack traces, SQL queries, or file paths in production
- Field-level errors in
detailsarray -- for validation errors, specify which field failed
Pagination
Use cursor-based pagination for large datasets, offset-based for simple cases.
Offset-based (simple)
GET /api/v1/users?page=2&per_page=25
Response:
{
"data": [ ... ],
"pagination": {
"page": 2,
"per_page": 25,
"total": 150,
"total_pages": 6
}
}Cursor-based (scalable)
GET /api/v1/users?limit=25&cursor=eyJpZCI6MTAwfQ
Response:
{
"data": [ ... ],
"pagination": {
"limit": 25,
"has_more": true,
"next_cursor": "eyJpZCI6MTI1fQ"
}
}Rules
- Default page size: 25, max: 100 -- prevent clients from requesting unlimited data
- Always return pagination metadata -- clients need to know if there are more pages
- Use cursor-based for real-time data or large tables -- offset-based breaks with concurrent writes
Filtering and Sorting
# Filter by field values
GET /api/v1/users?status=active&role=admin
# Date ranges
GET /api/v1/orders?created_after=2025-01-01&created_before=2025-12-31
# Search
GET /api/v1/products?q=keyboard
# Sort (prefix with - for descending)
GET /api/v1/users?sort=created_at
GET /api/v1/users?sort=-updated_at
# Combine everything
GET /api/v1/orders?status=shipped&sort=-created_at&page=1&per_page=25Rules
- Use
snake_casefor query parameter names - Support multiple sort fields --
?sort=-created_at,name - Validate all filter parameters -- return 400 for unknown fields
- Document allowed filter fields per endpoint
Request and Response Conventions
- Use
snake_casefor all JSON keys --created_at,first_name,order_id - Use ISO 8601 for dates --
2025-06-15T14:30:00Z - Use UUIDs or opaque strings for IDs -- avoid exposing auto-increment integers
- Wrap collections in a
datakey --{ "data": [...] }, not a bare array - Include
created_atandupdated_atin all resources - Use
nullfor absent optional fields -- don't omit them entirely
{
"data": {
"id": "usr_a1b2c3d4",
"email": "user@example.com",
"first_name": "Jane",
"last_name": "Doe",
"role": "admin",
"avatar_url": null,
"created_at": "2025-06-15T14:30:00Z",
"updated_at": "2025-06-15T14:30:00Z"
}
}Versioning
- Use URL path versioning --
/api/v1/,/api/v2/ - Increment the major version only for breaking changes
- Support the previous version for at least 6 months after deprecation
- Return a
Deprecationheader on deprecated endpoints - Document migration guides between versions
Authentication
- Use Bearer tokens in the
Authorizationheader --Authorization: Bearer <token> - Never pass tokens in query parameters -- they end up in server logs
- Return 401 for missing/invalid tokens, 403 for insufficient permissions
- Include rate limit headers --
X-RateLimit-Limit,X-RateLimit-Remaining,X-RateLimit-Reset
Anti-patterns
- Verbs in URLs -- use HTTP methods instead
- Returning 200 with error body -- use proper status codes
- Nested resources deeper than 2 levels -- flatten with query parameters
- Inconsistent naming -- pick
snake_caseorcamelCaseand stick with it - Missing pagination on list endpoints -- always paginate collections
- Exposing internal IDs -- use prefixed opaque IDs like
usr_,ord_,prod_
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.

