backend-api-design
Use when the user asks about REST API design, designing REST endpoints, URL and resource naming, HTTP methods and status codes, pagination, filtering or error…
от j4flmao★ 47 звёзд на GitHub
Установить backend-api-design в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Backend API Design
Purpose
Design consistent, production-grade REST or GraphQL APIs. Every endpoint must follow the same conventions for URLs, requests, responses, errors, and pagination.
Agent Protocol
Trigger
Exact user phrases: "API design", "REST API", "GraphQL schema", "endpoint design", "API conventions", "URL structure", "HTTP methods", "response format", "API versioning", "pagination", "design an endpoint", "API contract".
Input Context
Before activating, verify:
- The resource or feature being designed is known.
- The tech-spec for the feature exists or the user has described the resource.
- The chosen API style (REST/GraphQL) is known. If not, ask: "REST or GraphQL?"
Output Artifact
No file output unless the user requests it. Produces endpoint specifications as text.
Response Format
For each endpoint:
{method} {path}
Auth: {required/optional/none}
Request: {schema reference}
Response 2xx: {schema reference}
Errors: {list of error codes}
For a full API design, group by resource:
## {resource}
{list of endpoints}
No preamble. No postamble. No explanations. No filler/hedging/transitions. Compress output. No explanations of REST principles.
Completion Criteria
- All resources follow the naming conventions below.
- Every endpoint has: method, path, auth requirement, request schema, response schema, error codes.
- List endpoints are paginated.
- Response envelope is consistent across all endpoints.
- Error responses follow the standard format.
- No verbs in URL paths.
Max Response Length
Per endpoint: 6 lines. Per resource: unlimited.
Architecture Decision Trees
REST vs GraphQL Decision Tree
What is the primary client type?
├── Public API with many consumers
│ ├── REST — broadest compatibility, cache-friendly, CDN-friendly
│ └── GraphQL only if clients need flexible data shapes
├── Single-page application (SPA)
│ ├── REST + BFF — simpler, more performant, better caching
│ └── GraphQL — if client needs to compose multiple resources
├── Mobile application
│ ├── REST + BFF — smaller payloads, server-controlled shapes
│ └── GraphQL — if network round-trips are the bottleneck
└── Service-to-service (internal)
├── REST — simple, familiar, good enough
└── gRPC — if latency-critical or streaming needed
Resource Modeling Decision Tree
Is it a thing (noun)?
├── Yes → Is it a top-level resource?
│ ├── Yes → /v1/{resources}
│ └── No → Is it always accessed through a parent?
│ ├── Yes → /v1/{parents}/{parentId}/{children}
│ └── No → Top-level resource with query filter
└── No → Is it an action (verb)?
├── Yes → POST /v1/{resources}/{id}/{action}
└── No → Neither — reconsider modeling
Pagination Strategy Decision Tree
Is the data real-time (new items inserted frequently)?
├── Yes → Cursor-based pagination — stable across insertions
└── No → Is the dataset small (<10K rows)?
├── Yes → Offset-based pagination — simpler, skip+limit
└── No → Do users need random page access?
├── Yes → Offset-based with keyset pagination fallback
└── No → Cursor-based pagination — best performance
Consistency Model Decision Tree
Is immediate consistency required?
├── Yes → Synchronous writes, read-after-write guaranteed
│ └── Use REST with strong consistency patterns
└── No → Can the client tolerate stale data?
├── Yes → Eventual consistency, cache-friendly
│ └── Use GraphQL with stale-while-revalidate
└── No → Strong consistency within bounded context
└── Use REST with version vectors / ETags
Workflow
Step 1: Choose API Style
REST: default for CRUD-heavy services with clear resources. GraphQL: when clients need flexible data shapes or multiple resources in one request. gRPC: when performance-critical, streaming, or polyglot service mesh.
Step 2: Design REST Resources
GET /v1/{resources} -> list (paginated)
GET /v1/{resources}/{id} -> single
POST /v1/{resources} -> create
PUT /v1/{resources}/{id} -> full replace
PATCH /v1/{resources}/{id} -> partial update
DELETE /v1/{resources}/{id} -> delete
// Sub-resources
GET /v1/{parents}/{parentId}/{children}
// Actions (when CRUD does not fit)
POST /v1/{resources}/{id}/{action}
Example: POST /v1/orders/{id}/cancel
// Search
POST /v1/{resources}/search
GET /v1/search?q={query}&type={resourceType}
Step 3: Naming Rules
- Plural nouns: /users, /orders, /products. Never singular: /user.
- kebab-case for multi-word: /order-items, /shipping-addresses.
- No verbs in CRUD paths: /users not /getUsers.
- Query parameters for filtering: ?status=active&sort=-createdAt.
- Version prefix: /v1/, /v2/. Never remove a version once released.
Step 4: Response Envelope
Every response uses this exact structure:
{
"data": { "id": "uuid", ... },
"meta": {
"requestId"
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/api-design-advanced.md
- references/api-design-documentation.md
- references/api-design-fundamentals.md
- references/api-design-performance.md
- references/api-design-security.md
- references/api-documentation-portal.md
- references/api-error-handling.md
- references/api-pagination-filtering.md
- references/api-testing-contract-testing.md
- references/graphql-conventions.md
- references/rest-conventions.md
FAQ
Что делает скилл backend-api-design?
Use when the user asks about REST API design, designing REST endpoints, URL and resource naming, HTTP methods and status codes, pagination, filtering or error formats. Produces endpoint contracts with conventions. Not for the response envelope (use backend-api-response) or versioning (use backend-api-versioning).
Как установить скилл backend-api-design?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл backend-api-design запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…