一键导入
api-design-rest
When creating or extending an HTTP API for client consumption.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
When creating or extending an HTTP API for client consumption.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
When improving read performance and reducing database load.
When designing loosely coupled systems that react to state changes asynchronously.
When setting up telemetry, debugging distributed systems, or standardizing application output.
When addressing slow application endpoints, high database CPU usage, or standardizing data access patterns.
When designing how a system recovers from and reports failures.
When asynchronously reviewing peer code before merging into the main branch.
| name | api-design-rest |
| description | When creating or extending an HTTP API for client consumption. |
| version | 2.0.0 |
| category | backend |
| tags | ["backend","api","rest","http"] |
| skill_type | architecture |
| author | skiLLM |
| license | MIT |
| compatible_agents | ["claude-code","cursor","copilot","codex"] |
| estimated_context_tokens | 1600 |
| dangerous | false |
| requires_review | false |
| security_level | safe |
| dependencies | ["error-handling-architecture"] |
| triggers | ["api","endpoint","rest","http","resource"] |
| permissions | {"filesystem":{"read":true,"write":true},"network":{"outbound":false},"shell":{"execute":false}} |
| input_requirements | ["existing API codebase or new service structure"] |
| output_contract | ["lowercase URLs","status codes used semantically","RFC 7807 errors","versioned endpoints"] |
| failure_conditions | ["using verbs in URLs","HTTP 200 for failures","nesting deeper than 2 levels"] |
| last_updated | "2026-05-15T00:00:00.000Z" |
REST APIs MUST be intuitive, predictable, and semantically correct. This skill ensures APIs use HTTP methods correctly, communicate errors clearly via standard formats, and maintain consistency across resources so clients can interact with them reliably without surprise behavior.
/users/{id}/orders ONLY)limit and offset (or cursor-based pagination)/v1/ prefix or header-based versioning from day oneGET /getUsers)GET /getUsers, POST /createOrder (use nouns + HTTP methods){ status: 'error' } payload (use 4xx/5xx status codes)/companies/{id}/departments/{id}/employees/{id}/tasks (use max 2 levels)/api/users without versioning path for future breaking changestype, title, detail, statuslimit and offset parameters/v1/users or header-based)/user-profiles not /userProfiles)type, title, detail, status, instance)limit, offset, total in collection response envelope/v1/ URL prefix or API-Version: 1.0 headerlimit=999999999)❌ Anti-pattern (Verbs in URL, wrong status codes, deep nesting, no pagination):
GET /api/getUsers HTTP/1.1
HTTP/1.1 200 OK
{
"status": "error",
"message": "User not found"
}
GET /api/companies/123/departments/456/employees/789/tasks/assignToUser HTTP/1.1
✅ Correct pattern (Nouns, semantic status, proper nesting, paginated):
GET /v1/users?limit=20&offset=0 HTTP/1.1
HTTP/1.1 200 OK
{
"data": [...],
"pagination": {
"limit": 20,
"offset": 0,
"total": 150
}
}
GET /v1/users/123 HTTP/1.1
HTTP/1.1 404 Not Found
{
"type": "https://api.example.com/errors/resource-not-found",
"title": "Resource Not Found",
"detail": "The requested user does not exist",
"status": 404,
"instance": "/v1/users/123"
}
GET /v1/users/123/orders?limit=10&offset=0 HTTP/1.1