/waris-skill-library:warisskill-system-design-api-designfrom waris-skill-library
Use when designing or reviewing an API — REST endpoint shape, status codes, response format, pagination, error responses, or versioning strategy. Trigger when creating new endpoints, reviewing an existing API contract, or when choosing between REST and GraphQL for a new project. Applies at the single-service level — for how a service's internal business logic is structured, see warisskill-system-design-domain-modeling; for inter-service API contracts in a distributed system, see warisskill-system-design-distributed-patterns.
Ships in waris-skill-library. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
# Resources are nouns, plural, kebab-case
GET /api/users
GET /api/users/:id
POST /api/users
PATCH /api/users/:id
DELETE /api/users/:id
# Sub-resources for ownership
GET /api/users/:id/orders
# Verbs only for actions that don't map to CRUD
POST /api/orders/:id/cancel
No verb in the URL for CRUD operations. No versioned prefix (see Versioning below) until it's actually needed.
200 OK / 201 Created (with Location header) / 204 No Content
400 Bad Request — malformed request
401 Unauthorized — missing/invalid auth
403 Forbidden — authenticated, not authorized
404 Not Found
409 Conflict — duplicate/state conflict
422 Unprocessable Entity — semantically invalid data
429 Too Many Requests
500 Internal Server Error — never expose internals in the message
Never return 200 with a success: false body — the HTTP status code
carries that meaning; don't duplicate it in the payload.
Default response shape, always:
// Success
{ "data": { ... }, "meta": { ... }, "links": { ... } }
// Collection
{ "data": [...], "meta": { "total": 142, "page": 1, "per_page": 20 } }
// Error
{ "error": { "code": "validation_error", "message": "...", "details": [...] } }
Apply this consistently even for internal-only APIs — it costs nothing extra to set up and means pagination/metadata can be added later without a breaking response-shape change.
?page=2&per_page=20) for admin dashboards and
smaller datasets — simple, supports jump-to-page.?cursor=...&limit=20) for anything public-facing,
infinite scroll, or large/growing datasets — consistent performance,
stable under concurrent inserts.Field-level detail on validation failures, always machine-readable
(code) plus human-readable (message):
{
"error": {
"code": "validation_error",
"message": "Request validation failed",
"details": [{ "field": "email", "message": "Must be a valid email address", "code": "invalid_format" }]
}
}
No /v1/ prefix by default — don't pay that cost upfront. Introduce
versioning only when a real breaking change needs to go out while
existing consumers keep working. At that point, URL-based versioning
(/api/v2/...) is the default choice — most widely understood, simplest
to route.
warisskill-system-design-distributed-patterns instead.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub sodiqabdulwaris/waris-skill-library --plugin waris-skill-libraryOther plugins' skills for the same job
129 skills in this plugin
/api-and-interface-designGuides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints, defining type contracts between modules, or establishing boundaries between frontend and backend./browser-testing-with-devtoolsTests in real browsers via Chrome DevTools MCP. Use when building or debugging anything that runs in a browser. Use when you need to inspect the DOM, capture console errors, analyze network requests, profile performance, or verify visual output with real runtime data. Requires the chrome-devtools MCP server to be configured./