This skill should be used when the user needs to "design the API", do "endpoint design", pin down a "request/response shape", choose a "pagination" strategy (cursor vs offset), add an "idempotency key" to a write, plan "API versioning", an "error contract", or pick between "REST vs gRPC vs GraphQL" or "WebSocket vs polling". Use it whenever a design has reached the interface — the concrete request, response, primary access path, and how clients page, retry, and version — even if the user only said "the boxes talk to each other".
npx skills add https://github.com/proyecto26/system-design-skills --skill api-design
Define the contract between clients and a service: the exact request and response
shapes, how callers page through data, how retried writes stay safe, how errors
are reported, and how the contract evolves. Get this vague and the rest of the
diagram is guesswork (GUIDE #8) — a "NoSQL box" or "user service" solves nothing
until you can write the request, the response, and the key it hits.
The design has named services and a datastore, and you now need the *interface*:
what a client sends, what it gets back, how it fetches the next page, how it
retries a payment without double-charging, and how a v1 client survives a v2
deploy. Reach here the moment someone says "fetch the feed" or "store the post"
without a shape.
Before requirements and scale are pinned — the protocol choice depends on
read/write ratio and latency target, not taste (→ requirements-scoping,
back-of-the-envelope). Don't reach for gRPC, GraphQL, or streaming because they
sound modern; a plain REST/JSON endpoint is the cheapest contract that meets most
constraints, and naming a fancier protocol you don't need is a YAGNI red flag.
Internal data-access keys and partition design live in data-storage; this skill
designs the *external* contract that mirrors them.
request → many results (streaming)? This picks the protocol.
need their own optimized path (→ back-of-the-envelope).
naturally idempotent (PUT/DELETE) vs not (POST that creates/charges)?
strict versioning) vs your own apps (ship together)?
and fewer round trips; browsers favor cacheable HTTP.
Protocol / style (pick per call shape)
for public, cacheable, browser-friendly APIs.
streaming. Use for internal service-to-service traffic where latency and schema
contracts matter.
when many clients need different shapes of the same graph and over/under-fetching
on REST hurts.
server must push updates (chat, presence, live feeds) — see the polling tier below.
third-party event delivery.
Server-push tier (when clients need fresh data)
efficiency for push and increasing connection cost. Start at polling; escalate
only when a number (update frequency, fanout) forces it.
Pagination
changing datasets.
?offset=40&limit=20. Use only for small, mostly-static,jump-to-page lists.
Idempotency — client sends an Idempotency-Key on unsafe writes; the server
dedupes retries. This skill owns the key contract (see Interface sketch).
Versioning — URI (/v2/...), header (Accept: application/vnd.x.v2+json), or
additive/never-break. Prefer additive; reserve a new version for breaking changes.
| Option | What it solves | What it worsens | Change it when |
|---|---|---|---|
| REST/JSON | Universal, cacheable, simple, tooling everywhere | Over/under-fetch; chatty for graphs; weak typing | Field-shaping pain → GraphQL; internal latency → gRPC |
| gRPC/RPC | Compact, typed, fast, native streaming | Not browser-native; needs proxy; opaque to HTTP caches | Public/browser clients need it → REST gateway |
| GraphQL | One round trip, client picks fields | Caching/rate-limiting hard; expensive queries (N+1); server complexity | Few fixed shapes (REST simpler) or query cost unbounded |
| WebSocket/SSE | True server push, low-latency updates | Stateful connections, harder to scale/LB, reconnection logic | Updates are infrequent → long-poll; one-way only → SSE |
| Cursor pagination | Stable under inserts; O(1) per page at any depth | Opaque token; no random page jump; needs sort key | Users must jump to page N of a static set → offset |
| Offset pagination | Trivial; arbitrary page jumps | Drift/dupes on insert; deep offsets scan & slow | Set grows or mutates → cursor |
| Idempotency keys | Safe retries; no double-charge | Server must store keys + dedupe; key TTL/scope to define | Op is naturally idempotent (PUT/DELETE) → may skip |
| URI versioning | Explicit, cache/log-visible, easy to route | Version sprawl; clients pinned forever | Changes are additive → no new version needed |
The contract decides how badly a client *amplifies* an incident.
double-execute; clients retrying in lockstep stampede a recovering service.
Idempotency keys make retries safe; the backoff/jitter that *paces* them is owned
by resilience-failure. Surface 429 + Retry-After so well-behaved clients slow down.
and discard rows — a cheap-looking endpoint becomes a full-table scan under a
crawler. Cursor pagination keeps every page O(page-size).
that fans out → one request exhausts memory/CPU. Cap page size, depth, and
complexity at the contract.
reconnect storm after a deploy can exhaust file descriptors and load-balancer
slots. Plan reconnect with jitter and connection limits.
client at once — the loudest self-inflicted outage. Make changes additive;
deprecate behind a version.
Monitor: error-rate by status class (4xx vs 5xx), p99 latency per endpoint,
retry/idempotency-replay rate, page-depth distribution, open connection count, and
per-version traffic (to know when an old version can be retired).
retry safety, client diversity, and latency/payload budget (see *Clarify
first*). No contract before these are known.
REST/JSON; escalate to gRPC (internal latency/typing), GraphQL (many field
shapes), or a push tier (server must push) only when an input forces it.
Default pagination to cursor; reserve offset for small, static, jump-to-page sets.
to retry, POST not), define the Idempotency-Key contract and its TTL, fix a
stable error envelope, and pick a versioning policy (additive by default).
depth/complexity, and payload size; plan reconnect-with-jitter and connection
limits for push; surface 429 + Retry-After. Confirm a v1 client survives a
v2 deploy.
pages-per-session, and update-frequency × fanout; use these to confirm the
protocol and poll-vs-push choice (→ back-of-the-envelope).
then map to its managed gateway (see *Choosing a provider*).
Change it when…` table with one row per choice you made here (e.g. the
option, its store, its failure policy); the last column is a concrete trigger
(a number or observable signal). Then name what breaks first.
Do
Idempotency-Key on every non-idempotent write and bound its TTL.Don't
resilience-failure / data-storage.Estimate before choosing: requests/s per endpoint, average and max response size,
page size × pages-per-session (drives read load), and update frequency × fanout
(decides poll vs push). A few rules of thumb that flip a decision: a binary
protocol (protobuf) commonly cuts payload several-fold over JSON, and compression
helps again before the wire — both matter most on mobile/high-latency links where
round trips dominate. Polling at interval T for N clients is N/T requests/s
of mostly-empty answers; once that approaches the push tier's connection budget,
switch to SSE/WebSocket. Cap page size (and GraphQL depth/complexity) so worst-case
response cost is bounded, and keep an idempotency key's stored window bounded
(e.g. 24h) so the dedupe table doesn't grow without limit. For the canonical
latency/QPS/payload reference figures, go to back-of-the-envelope — don't restate
its tables here.
Make the contract concrete. A read with cursor pagination and an error envelope:
GET /v1/users/{id}/posts?limit=20&cursor=eyJ0cyI6MTciLCJpZCI6Ijk5In0
200 OK
{ "data": [ { "id": "p_881", "created_at": "...", "text": "..." } ],
"next_cursor": "eyJ0cyI6...", // null when no more pages
"has_more": true }
# error envelope — stable shape across every endpoint
4xx/5xx
{ "error": { "code": "rate_limited", "message": "…", "request_id": "req_…",
"retryable": true } }
An idempotent write (this skill's owned contract):
POST /v1/payments
Idempotency-Key: 9f1c-… (client-generated UUID, unique per logical operation)
{ "amount": 4200, "currency": "usd", "source": "card_…" }
# Server: first request with a key → execute, store (key → response) for a TTL.
# Retry with same key → return the stored response, do NOT re-execute.
# Same key + different body → 422 (key reuse conflict).
Mirror the response shape to the access pattern: cursor encodes the partition/sort
key the store pages on (PK/SK design is owned by data-storage). Pick verbs by
safety — GET (safe), PUT/DELETE (idempotent), POST (not), so retries are correct
by construction.
Default to the generic recipe above. If the user names a cloud, read
references/providers/<provider>.md for the managed-service mapping,
quotas/limits, and provider-specific trade-offs. If no file exists for that
provider, the generic recipe is the answer.
To visualize the request/response path, the cursor-paging loop, or an
idempotent-retry sequence (client → gateway → service → store, with the replay
branch), use the in-plugin architecture-diagram skill — do not embed Mermaid
here. A one-line ASCII sketch inline is fine for quick reasoning.
data-storage — *depends on* it: the request/response and cursor shapes mirror its primary key and access patterns (sharding/partitioning lives there); design them together.resilience-failure — *pairs with* it: it owns retries/backoff/jitter, timeouts, and rate limiting, while idempotency keys (owned here) are what make those retries safe.consistency-coordination — *pairs with* it when a retried or concurrent write must not violate an invariant; CAP/quorum theory lives there.messaging-streaming — *alternative to* synchronous request/response when the contract is async events or webhooks.system-design — *feeds into* this: the orchestrator routes here at the interface step.references/deep-dive.md — protocol mechanics (HTTP verbs/status discipline, gRPC streaming modes, GraphQL query-cost limits), cursor-token construction, the full idempotency-key state machine, versioning/deprecation strategy, and error-contract design. Read when designing the contract in detail.references/providers/{generic,aws,azure,gcp}.md — API-gateway / managed-endpoint mappings, limits that change a decision, and pitfalls per environment.Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling
Take proyecto26/api-design from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.