design-api
Skill9 starsChanged 42 days agoMITView on GitHub
Design REST and GraphQL APIs: naming, versioning, error shapes, auth. Use when "design an API", "create endpoints", "structure my API responses", "plan API architecture", "REST vs GraphQL", or "API contract".
6 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- foryouself83/harness-tiertheir own version, first seen Oct 13, 2026
- videojs/video.jstheir own version, first seen Oct 8, 2026
- kensaurus/cursor-kenjiedited, first seen Oct 1, 2026
- RndmCodeGuy20/ordnancetheir own version, first seen Aug 25, 2026
- fabianmagrini/skillstheir own version, first seen May 10, 2026
- wachawo/claude-skillstheir own version, first seen May 5, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- kensaurus/cursor-kenji★ 968% same
Wrote their own version · 5
- videojs/video.js★ 40ksame name
- foryouself83/harness-tier★ 10same name
- fabianmagrini/skills★ 1same name
- RndmCodeGuy20/ordnance★ 0same name
- wachawo/claude-skills★ 0same 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 repository163 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/approved-plan-execution.mdcCursor rule
- .cursor/rules/skill-workflows.mdcCursor rule
- .cursor/rules/verification-before-completion.mdcCursor rule
- llms.txtllms.txt
- audit-accessibilitySkill
- audit-agent-speedSkill
- audit-analyticsSkill
- audit-auth-flowsSkill
- audit-backend-architectureSkill
- audit-bundle-sizeSkill
- audit-cicdSkill
- audit-codemod-safetySkill
- audit-code-qualitySkill
- audit-code-reviewSkill
- audit-db-schemaSkill
- audit-doctrineSkill
- audit-env-paritySkill
- audit-fe-apiSkill
- audit-gate-logicSkill
- audit-i18nSkill
- audit-infra-costSkill
- audit-langfuse-llmSkill
- audit-llm-securitySkill
- audit-monetization-iapSkill
- audit-payment-systemSkill
- audit-performanceSkill
- audit-realworldSkill
- audit-registry-listingSkill
- audit-resilienceSkill
- audit-responsiveSkill
- audit-securitySkill
- audit-skill-conflictsSkill
- audit-ui-statesSkill
- audit-uiux-design-systemSkill
- audit-ux-journeysSkill
- audit-uxSkill
- backend-db-performanceSkill
- backend-error-handlingSkill
- backend-observabilitySkill
- backend-patternsSkill
- backend-realtimeSkill
- burndown-fullSkill
- complete-everythingSkill
- data-pipelineSkill
- data-visualizationSkill
- debug-errorSkill
- debug-fe-be-integrationSkill
- debug-sentry-monitorSkill
- deploy-npmSkill
- deploy-verifySkill
- design-canvasSkill
- design-emailSkill
- design-frontendSkill
- design-generative-artSkill
- design-mobile-firstSkill
- design-motionSkill
- design-prdSkill
- design-systemSkill
- design-themeSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
1
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
- Distinctive: line 49
Use Supabase MCP to understand existing data structure:
- Very specific: line 67
Use Grep to search for similar endpoints already implemented:
“Common” is measured: kept by at least 6 in 10 of the 6 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 Skill
Degree of freedom: MIXED. Resource model, error shape, and REST vs
GraphQL [HIGH freedom]; pre-design docs/schema/grep
[LOW freedom — run exactly].
Design clean, consistent, and developer-friendly APIs.
How to reason
- Survey — existing docs, schema, and similar endpoints
- Model — resources, relations, REST vs GraphQL
- Contract — paths, statuses, error shape, auth, pagination
- Check — naming matches this repo; no duplicate endpoint
Worked example
Survey:
ordershasuser_id; noGET /users/:id/orders; clients useuseQuery. Model: order is a nested user resource, not a/getUserOrdersRPC. Contract:GET /users/:id/orders→{ data, meta }; shared{ error: { code, message, details } }. Check: plural kebab-case; list paginated; 401/404/422 only from the status table.
Self-critique before reporting
- Pre-design stated — docs, schema, and similar endpoints were checked out loud
- One error shape — every failure uses
{ error: { code, message, details } } - Lists paginate — no unbounded
GET /resources - Right owner — live 4xx/5xx repro →
debug-fe-be-integration; product scope still fuzzy →design-prd
Pre-design checks [LOW freedom — run exactly]
Before designing any API:
1. Check Existing API Documentation
- The running backend's docs route (
/api-docs,/docs,/swagger,/openapi.json) - The repo's API README or naming-conventions doc (grep
namingunderdocs/andsrc/api/)
2. Verify Database Schema
Use Supabase MCP to understand existing data structure:
-- Check table schema
SELECT column_name, data_type, is_nullable
FROM information_schema.columns WHERE table_name = 'your_table';
-- Check enum values
SELECT enum_range(NULL::your_enum_name);
-- Check foreign keys
SELECT tc.constraint_name, kcu.column_name, ccu.table_name AS foreign_table
FROM information_schema.table_constraints tc
JOIN information_schema.key_column_usage kcu ON tc.constraint_name = kcu.constraint_name
JOIN information_schema.constraint_column_usage ccu ON tc.constraint_name = ccu.constraint_name
WHERE tc.table_name = 'your_table' AND tc.constraint_type = 'FOREIGN KEY';3. Check for Existing Endpoints
Use Grep to search for similar endpoints already implemented:
Grep: "router.get|router.post" to find existing route patterns
Grep: "useQuery|useMutation" to find existing frontend integrations4. Verification Statement (REQUIRED)
Before designing, state:
"Pre-design check:
- Existing API docs reviewed: [YES/NO]
- Database schema verified: [tables/enums checked]
- Similar endpoints found: [list or none]
- Naming conventions confirmed: [YES/NO]"REST API Design [HIGH freedom]
URL Structure
GET /resources # List
GET /resources/:id # Get one
POST /resources # Create
PUT /resources/:id # Replace
PATCH /resources/:id # Update
DELETE /resources/:id # DeleteNaming Conventions
| Do | Don't |
/users | /getUsers, /user-list |
/users/:id | /user/:id, /users/get/:id |
/users/:id/orders | /getUserOrders |
| Plural nouns | Verbs, singular |
| kebab-case | camelCase, snake_case |
Examples
GET /users # List users
GET /users/123 # Get user 123
GET /users/123/orders # User's orders
GET /users/123/orders/456 # Specific order
POST /users/123/orders # Create order for userRequest/Response Format [LOW freedom — run this shape]
Request Body
{
"name": "John Doe",
"email": "john@example.com",
"role": "admin"
}Successful Response
{
"data": {
"id": "123",
"name": "John Doe",
"email": "john@example.com",
"createdAt": "2024-01-15T10:30:00Z"
}
}List Response (with pagination)
{
"data": [
{ "id": "1", "name": "John" },
{ "id": "2", "name": "Jane" }
],
"meta": {
"total": 100,
"page": 1,
"perPage": 20,
"totalPages": 5
}
}Error Response
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid input data",
"details": [
{ "field": "email", "message": "Invalid email format" },
{ "field": "name", "message": "Name is required" }
]
}
}HTTP Status Codes [LOW freedom — use this table]
Success (2xx)
| Code | When to Use |
200 OK | GET, PUT, PATCH success |
201 Created | POST created new resource |
204 No Content | DELETE success, no body |
Client Errors (4xx)
| Code | When to Use |
400 Bad Request | Invalid request body |
401 Unauthorized | Not authenticated |
403 Forbidden | Authenticated but not allowed |
404 Not Found | Resource doesn't exist |
409 Conflict | Resource conflict (duplicate) |
422 Unprocessable | Validation failed |
429 Too Many | Rate limited |
Server Errors (5xx)
| Code | When to Use |
500 Internal Error | Unexpected server error |
502 Bad Gateway | Upstream service failed |
503 Unavailable | Service temporarily down |
Query Parameters
Filtering
GET /users?role=admin
GET /users?role=admin&status=active
GET /orders?createdAfter=2024-01-01Sorting
GET /users?sort=name # Ascending
GET /users?sort=-createdAt # Descending (prefix with -)
GET /users?sort=role,-name # Multiple fieldsPagination
GET /users?page=2&perPage=20
GET /users?offset=40&limit=20
GET /users?cursor=abc123 # Cursor-basedField Selection
GET /users?fields=id,name,email
GET /users?include=orders,profileVersioning
URL Path (Recommended)
GET /v1/users
GET /v2/usersHeader
GET /users
Accept: application/vnd.api+json;version=2Authentication
Bearer Token
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...API Key
X-API-Key: your-api-key
# or
?apiKey=your-api-keyCommon Patterns
Bulk Operations
POST /users/bulk
{
"create": [{ "name": "John" }, { "name": "Jane" }],
"update": [{ "id": "1", "name": "Updated" }],
"delete": ["2", "3"]
}Search
POST /users/search
{
"query": "john",
"filters": { "role": "admin" },
"sort": { "field": "name", "order": "asc" }
}Actions (non-CRUD)
POST /orders/123/cancel
POST /users/123/verify-email
POST /payments/123/refundAPI Design Checklist [LOW freedom — do not skip]
Consistency
- Consistent naming conventions
- Consistent response format
- Consistent error format
- Consistent pagination
Usability
- Intuitive URLs
- Clear documentation
- Meaningful error messages
- Sensible defaults
Security
- Authentication required
- Authorization checked
- Input validation
- Rate limiting
Performance
- Pagination for lists
- Field selection available
- Efficient queries
- Caching headers
Documentation Template
## Create User
Create a new user account.
**Endpoint:** `POST /users`
**Authentication:** Required (Bearer token)
**Request Body:**
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| name | string | Yes | User's full name |
| email | string | Yes | Valid email address |
| role | string | No | User role (default: "user") |
**Response:** `201 Created`
\`\`\`json
{
"data": {
"id": "123",
"name": "John Doe",
"email": "john@example.com",
"role": "user",
"createdAt": "2024-01-15T10:30:00Z"
}
}
\`\`\`
**Errors:**
- `400` - Invalid request body
- `409` - Email already exists
- `422` - Validation failedDoes 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.

