api-design
Use when an API contract is designed or changed: a new endpoint or resource, how its errors and pages are returned, a field to add or remove, or a version to…
от crewforth★ 26 звёзд на GitHub
Установить api-design в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
API Design
Trigger phrases: "api design", "api contract", "api versioning", "openapi", "swagger", "rest contract", "breaking api change", "response shape", "response format", "endpoint returns", "error format"
Goal: a contract the consumer can predict and that can evolve without breaking. Once published, a public API is a commitment; a breaking change is expensive. Stack-agnostic (REST as the baseline; GraphQL/gRPC follow similar principles).
Checklist
- Resource names are consistent (plural nouns, a single
kebab/camelstyle), resources not verbs - Correct HTTP semantics: GET (side-effect free) · POST · PUT/PATCH · DELETE; correct status code
- A uniform error model: machine-readable code + human message + (if any) field details
- A clear versioning strategy (URL
/v1or header); a breaking change means a new version - Pagination/filtering/sorting defined and consistent on large collections
- Backward compatibility: adding a field is additive; removing a field or changing its meaning is breaking → version
- Idempotency (for POST/payment-like cases) supported via a key when needed: the key, its atomic claim and
the answers to a replay are in
references/idempotency.md - The contract is documented in OpenAPI; example request/response present (coordinate with
docs-writer)
How
- Model the resource — a noun not a verb:
POST /orders(✓),POST /createOrder(✗). - Status codes: 200/201/204 · 400 validation · 401/403 authorization · 404 · 409 conflict · 422 · 429 · 5xx. Use them meaningfully.
- Error contract — every error has the same shape:
No stack trace / internal detail leakage (overlaps with{ "code": "ORDER_NOT_FOUND", "message": "Order not found", "details": [] }security-scan). - Versioning: additive changes in the same version; breaking (remove/rename a field / add a required field) →
/v2. - Collection: pagination (cursor or offset), filter/sort parameters; a consistent envelope.
- Write the contract — OpenAPI/schema; with examples. Wire the change to
docs-writer, and if breaking torelease/CHANGELOG.
Breaking vs additive
| Additive (safe) | Breaking (needs a version) |
|---|---|
| Add an optional field/endpoint | Remove / rename a field |
| A new optional parameter | Add a required parameter |
| A new enum value (if the consumer is tolerant) | Change a type/meaning, change a status code |
Observable behaviour is the contract, not only the documented fields: someone depends on the error text, the order of a list, the default page size and how long a call takes. Changing one of those is breaking for them; say it in the changelog like a field change.
Retiring a version or a field
Announce it with a date (a changelog line, and the Sunset header of RFC 8594 on every response that uses it),
keep it working until that date, measure who still calls it, tell those callers by name, and remove it only after
the date with nobody left on it. A removal with no date, or before the measurement, is a breaking change by surprise.
Invariant rules
- A public API is a commitment — a breaking change is not made silently; version + announcement.
- Consistency > local cleverness — a single naming/error/pagination pattern across the whole API.
- The error model is uniform and machine-readable.
- No internal detail leakage — a stack trace / DB error does not go to the consumer.
- The contract is documented — OpenAPI + example; at design time, not after the code.
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/idempotency.md
FAQ
Что делает скилл api-design?
Use when an API contract is designed or changed: a new endpoint or resource, how its errors and pages are returned, a field to add or remove, or a version to cut without breaking a consumer.
Как установить скилл api-design?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл 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…