api-design

Designs HTTP API contracts covering URLs, methods, status codes, pagination, and versioning.

Updated Aug 3, 2026
One-click install
npx skills add https://github.com/m-de-graaff/skills --skill api-design-m-de-graaff
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: api-design
Source: https://github.com/m-de-graaff/skills/tree/main/skills/api-design
Command: npx skills add https://github.com/m-de-graaff/skills --skill api-design-m-de-graaff

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Inconsistent API design creates breaking changes, confused clients, and endpoints that return 200 for failures. This Skill provides concrete rules for designing HTTP endpoints so every URL, status code, response shape, and error format follows a coherent contract that clients can rely on. ## Core Features & Use Cases - Resource and Method Conventions: Enforces plural kebab-case nouns, one-level nesting, correct use of GET/POST/PUT/PATCH/DELETE, and the new QUERY method (RFC 10008) for structured reads. - Status Codes and Error Shapes: Maps each outcome to the right status code (400 vs 422, 403 vs 404, 409 conflicts) and defines a stable error envelope with machine-readable codes and field-level details. - Pagination, Filtering, and Versioning: Guides cursor vs offset pagination, allowlisted filter/sort fields, rate-limit headers, and path-based versioning with Sunset-based retirement. - Use Case: When adding a new endpoint like POST /api/v1/team-members, use this Skill to decide the URL shape, validate input with a schema, return 201 with a Location header, and produce a consistent 422 validation error body. ## Quick Start Ask the AI to design or review a REST endpoint for creating and listing team members, including status codes, pagination, and error responses.

Frequently Asked Questions about api-design

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design a REST API endpoint with correct status codes?▼

Use plural kebab-case resource URLs and match status codes to outcomes: 200 for reads, 201 with a Location header for creation, 204 for deletes, 400 for malformed requests, 422 for validation failures, and 409 for state conflicts. Never return 200 with a success flag in the body.

What is the difference between 400 and 422 status codes?▼

400 means the request could not be parsed, such as malformed JSON or a missing required parameter. 422 means the request parsed successfully but the values failed semantic validation. If you only use one, pick 400 and stay consistent because clients branch on it.

Should I use cursor or offset pagination for a list endpoint?▼

Use cursor pagination for feeds, large or actively-written tables, and public APIs, since offset skips and duplicates rows when items are inserted mid-pagination. Offset is acceptable for admin tables under roughly 10k rows where users expect page numbers. Always cap the limit server-side.

When does an API change require a new version?▼

A new version is needed for breaking changes: removing or renaming a field, narrowing a type, changing a status code or error code for an existing condition, or making an optional parameter required. Adding fields, optional parameters, or endpoints is not breaking and needs no new version.

What is the HTTP QUERY method and should I use it?▼

QUERY (RFC 10008) is a safe, idempotent, cacheable method for reads whose parameters are too structured for a URL, like nested boolean filters. Browser fetch cannot send it yet, so accept QUERY alongside POST on the same endpoint rather than requiring it.

What are the limitations of this API design guidance?▼

It covers only the wire contract: URLs, methods, status codes, and response shapes. It does not address handler internals, persistence, caching, or background work, and it does not cover GraphQL, gRPC, or security vulnerability review.