ardurai/god-skill-suite/god-api-design

Claude Code and agent skill by ardurai/god-skill-suite

Trust tier 3
  • community
  • ext:[{"type":"plugin","description":"Custom plugin integration"}]
Source check pending

Checking that the SKILL.md file is still in the repository.

God-level API design skill covering REST (Richardson Maturity Model, HTTP semantics, status codes, versioning, pagination, filtering, HATEOAS), GraphQL (schema design, resolvers, N+1 problem, DataLoader, subscriptions, federation), gRPC (Protocol Buffers, service definitions, streaming types, deadlines, interceptors), AsyncAPI and event-driven API design, API security (OAuth 2.0, OIDC, JWT, API keys, mTLS), API contracts (OpenAPI 3.1, Protobuf), API testing (contract testing with Pact, integration testing, fuzz testing), API gateway patterns, rate limiting, idempotency, and API versioning strategies. A bad API is a permanent scar on an organization — it cannot be unshipped.

Install

npx vskill@latest install ardurai/god-skill-suite/god-api-design

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as ardurai/god-skill-suite/god-api-design.

God-Level API Design

A bad API is a permanent scar on an organization. It cannot be unshipped. Every decision you make at design time will be paid for in maintenance costs, client rewrites, and support tickets for years. Design like it matters — because it does.

Researcher-Warrior Mindset

You are not here to make something that "works." You are here to make something that is correct, durable, and comprehensible to every engineer who will ever interact with it. Before you write a single endpoint, you read the spec. You read the RFC. You look at what Stripe, Twilio, and GitHub did and why. Then you make deliberate decisions, not cargo-culted ones.

Anti-hallucination rules for this domain:

  • Never invent HTTP status codes. Only use codes defined in RFC 7231, RFC 6585, RFC 4918, and RFC 8470.
  • Never invent OAuth 2.0 flows. The four canonical flows are defined in RFC 6749. PKCE is in RFC 7636.
  • Never describe JWT validation without listing ALL required checks (algorithm, expiry, issuer, audience, signature).
  • When citing a spec (OpenAPI, JSON:API, RFC 7807), cite the actual spec version number.
  • If you are unsure whether a behavior is defined or implementation-specific, say so explicitly.

1. Richardson Maturity Model

The Richardson Maturity Model (RMM) describes four levels of REST API maturity. Most APIs call themselves REST but live at Level 1 or Level 2. True REST (Level 3 with HATEOAS) is rarely implemented but worth understanding.

Level 0 — The Swamp of POX (Plain Old XML / JSON)

One URI, one HTTP method (always POST), all operations encoded in the body. This is SOAP. This is XML-RPC. This is wrong.

http
POST /api HTTP/1.1
Content-Type: application/json
{"action": "getUser", "id": "123"}

Problem: no HTTP semantics, no caching, no idempotency, no discoverability.

Level 1 — Resources

Multiple URIs, but still only POST. Resources exist as concepts but HTTP verbs carry no meaning.

http
POST /users/123 HTTP/1.1
{"action": "update", "name": "Alice"}

Better: resources are named. Worse: still ignoring the entire HTTP protocol.

Level 2 — HTTP Verbs + Status Codes (Where most "REST" APIs live)

Correct use of GET/POST/PUT/PATCH/DELETE. Correct status codes. This is the minimum acceptable level for production APIs.

http
GET /users/123 HTTP/1.1
→ 200 OK
PATCH /users/123 HTTP/1.1
{"name": "Alice"}
→ 200 OK
DELETE /users/123 HTTP/1.1
→ 204 No Content
Level 3 — HATEOAS (Hypermedia As The Engine Of Application State)

Responses include links to valid next actions. Clients navigate the API by following links, not by hardcoding URLs. Used by GitHub's v3 API (Link headers for pagination), HAL, and JSON:API.

json
{
"id": "123",
"name": "Alice",
"_links": {
"self": {"href": "/users/123"},
"orders": {"href": "/users/123/orders"},
"deactivate": {"href": "/users/123/deactivate", "method": "POST"}
}
}

Real-world verdict: Level 3 is theoretically correct but operationally rare. Most mature APIs (Stripe, Twilio) live at Level 2 with excellent documentation. Don't let perfect be the enemy of good — but understand what you are trading away.


2. HTTP Semantics — Correct Method Use

MethodSafeIdempotentBody AllowedCommon Use
GETYesYesNo (technically allowed, discouraged)Retrieve resource
HEADYesYesNoCheck existence/metadata without body
OPTIONSYesYesNoCORS preflight, capability discovery
POSTNoNoYesCreate resource, trigger action
PUTNoYesYesReplace resource entirely
PATCHNoNo*YesPartial update
DELETENoYesNo (allowed, discouraged)Delete resource

*PATCH idempotency depends on the patch document format. JSON Patch (RFC 6902) operations like add may not be idempotent. JSON Merge Patch (RFC 7396) typically is.

Safe means the request has no intended side effects. Clients and intermediaries (proxies, CDNs) can cache and prefetch safe requests.

Idempotent means calling it N times produces the same result as calling it once. Critical for retry logic. PUT /users/123 with the same body is safe to retry. POST /orders creates a new order each time — use idempotency keys.

Misuse patterns to eliminate:

  • GET /users/delete/123 — never encode actions in GET URLs
  • POST /users/123/update — PATCH exists for a reason
  • POST /getUser — you have GET, use it
  • Using PUT when you mean PATCH (PUT replaces the entire resource; PATCH modifies fields)

3. HTTP Status Codes — Full Production Reference

2xx Success
CodeNameWhen to Use
200OKSuccessful GET, PATCH, PUT with response body
201CreatedSuccessful POST that created a resource. Include Location header pointing to the new resource.
202AcceptedRequest received and will be processed asynchronously. Return a job/task resource URL.
204No ContentSuccessful DELETE or action with no response body. Do NOT return 200 with empty body.
206Partial ContentRange request fulfilled (file downloads, chunked responses)
207Multi-StatusBatch operation where individual items have different statuses. Body contains per-item status.

202 pattern (async operations):

json
HTTP/1.1 202 Accepted
Location: /jobs/abc123
{
"job_id": "abc123",
"status": "pending",
"status_url": "/jobs/abc123"
}

207 pattern (batch imports):

json
HTTP/1.1 207 Multi-Status
{
"results": [
{"id": "1", "status": 200, "data": {...}},
{"id": "2", "status": 422, "error": {"code": "invalid_email"}}
]
}
3xx Redirection
CodeNameWhen to Use
301Moved PermanentlyResource has moved. Clients SHOULD update bookmarks. Method MAY change to GET.
302FoundTemporary redirect. Method MAY change to GET. Prefer 307 or 308 for APIs.
304Not ModifiedConditional GET — resource unchanged since If-Modified-Since / If-None-Match.
307Temporary RedirectRedirect preserving the original HTTP method. Use for API temporary redirects.
308Permanent RedirectRedirect preserving method, permanently. Use for API moves that preserve POST/PUT semantics.
4xx Client Errors
CodeNameWhen to Use
400Bad RequestMalformed request syntax, invalid JSON. Generic catch-all for bad input.
401UnauthorizedMissing or invalid authentication credentials. Include WWW-Authenticate header.
403ForbiddenAuthenticated but not authorized. Don't return 404 to hide resource existence unless privacy requires it.
404Not FoundResource does not exist. Also used to hide forbidden resources when privacy is required.
405Method Not AllowedHTTP method not supported on this endpoint. Include Allow header with supported methods.
409ConflictState conflict — optimistic locking failure, duplicate resource creation, constraint violation.
410GoneResource existed but is permanently deleted. Use over 404 when the deletion is intentional and permanent.
415Unsupported Media TypeClient sent Content-Type the server can't process.
422Unprocessable EntityRequest is well-formed but semantically invalid (validation errors, business rule violations).
429Too Many RequestsRate limit exceeded. MUST include Retry-After header.

409 vs 422:

  • 409: The request is valid but conflicts with current state ("user with this email already exists")
  • 422: The request itself has semantic errors ("email field is not a valid email format")
5xx Server Errors
CodeNameWhen to Use
500Internal Server ErrorUnhandled exception. Never leak stack traces in production.
502Bad GatewayUpstream service returned invalid response.
503Service UnavailableServer is overloaded or down for maintenance. Include Retry-After.
504Gateway TimeoutUpstream service timed out.

503 pattern (maintenance/overload):

http
HTTP/1.1 503 Service Unavailable
Retry-After: 120
Content-Type: application/problem+json
{
"type": "https://api.example.com/errors/service-unavailable",
"title": "Service Unavailable",
"detail": "The service is temporarily unavailable. Please retry after 120 seconds."
}

4. Error Response Format — RFC 7807 Problem Details

Never invent your own error format. RFC 7807 (Problem Details for HTTP APIs) is the standard. Use it.

json
HTTP/1.1 422 Unprocessable Entity
Content-Type: application/problem+json
{
"type": "https://api.example.com/errors/validation-error",
"title": "Validation Error",
"status": 422,
"detail": "The request body contains invalid fields.",
"instance": "/requests/abc123",
"errors": [
{
"field": "email",
"message": "Must be a valid email address",
"code": "invalid_format"
},
{
"field": "age",
"message": "Must be at least 18",
"code": "below_minimum"
}
]
}

Required fields: type (URI identifying the error type), title (human-readable), status (HTTP status code as integer).

Optional but recommended: detail (specific instance detail), instance (URI of the specific occurrence), domain-specific extension members.

The type URI SHOULD be a real URL that resolves to documentation about the error. This forces you to document your errors.


5. REST Resource Design

Naming Rules
  • Nouns, not verbs: /users, not /getUsers
  • Plural: /users, not /user
  • Lowercase with hyphens: /user-profiles, not /userProfiles
  • Hierarchy for containment: /users/123/orders/456
  • Avoid deep nesting beyond 2 levels: /users/123/orders is fine. /users/123/orders/456/items/789/details is a design smell — create a flat resource with filtering instead.
Filtering, Sorting, Pagination

Filtering:

GET /orders?status=shipped&created_after=2024-01-01
GET /orders?filter[status]=shipped&filter[user_id]=123 ← JSON:API style

Pick a consistent convention and document it. JSON:API's filter[field] is self-documenting.

Sorting:

GET /users?sort=created_at ← ascending
GET /users?sort=-created_at ← descending (prefix minus)
GET /users?sort=-created_at,name ← multiple fields

Pagination — Cursor vs Offset:

Offset pagination (?page=3&per_page=20):

  • Simple to implement
  • Breaks when records are inserted/deleted during pagination (items skip or duplicate)
  • O(N) database query cost as page number increases (OFFSET 10000 scans 10000 rows)
  • Never use for large, frequently-changing datasets

Cursor pagination (?after=eyJpZCI6MTIzfQ==):

  • Cursor is an opaque encoded pointer to the last item seen (typically base64-encoded JSON)
  • Stable — insertions/deletions don't corrupt the page
  • O(1) with proper index — WHERE id > cursor_id LIMIT 20
  • No random access (can't jump to page 50) — acceptable for most use cases
  • Use cursor pagination for any dataset over ~10,000 rows or any real-time feed

Cursor response pattern:

json
{
"data": [...],
"pagination": {
"next_cursor": "eyJpZCI6MTIzfQ==",
"prev_cursor": "eyJpZCI6MTAwfQ==",
"has_next": true,
"has_prev": true
}
}

Partial Response (Field Selection):

GET /users/123?fields=id,name,email

Reduces payload size. Important for mobile clients. GraphQL solves this more elegantly — one reason to reach for GraphQL when field-selection is a first-class requirement.


6. API Versioning Strategies

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Extension points

  • pluginCustom plugin integration

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/ardurai/god-skill-suite/god-api-design/badge)](https://verified-skill.com/skills/ardurai/god-skill-suite/god-api-design)

Something wrong with this skill or its page? Tell us.