api-design-patterns

Defines REST API conventions for naming, pagination, versioning, and OpenAPI specification.

Updated Sep 17, 2026
One-click install
npx skills add https://github.com/karenrebecag/spec-driven-standards --skill api-design-patterns-karenrebecag
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-design-patterns
Source: https://github.com/karenrebecag/spec-driven-standards/tree/main/plugins/standards/skills/api-design-patterns
Command: npx skills add https://github.com/karenrebecag/spec-driven-standards --skill api-design-patterns-karenrebecag

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Designing consistent REST APIs across teams is hard: endpoints drift in naming, pagination styles vary, error formats diverge, and versioning breaks clients. This Skill provides a single set of conventions covering resource naming, HTTP methods, status codes, error formats, pagination, filtering, versioning, headers, rate limiting, and OpenAPI spec authoring. ## Core Features & Use Cases - REST Conventions: Standard rules for plural resource naming, kebab-case URLs, correct HTTP method semantics, and consistent status codes. - Pagination & Filtering: Cursor-based pagination for large datasets, offset pagination for simple cases, plus filtering, sorting, and field selection patterns. - OpenAPI Spec Guidance: Spec-first development with shared schemas via $ref, examples per endpoint, and middleware validation. - Use Case: When building a new /orders endpoint, apply the conventions to define cursor pagination, a 201 response with a Location header, a standardized error envelope, and a versioned /api/v1 path. ## Quick Start Design a REST endpoint for managing orders following the API design conventions, including pagination, error format, and an OpenAPI snippet.

Frequently Asked Questions about api-design-patterns

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

FAQPage Schema
How do I design a REST API with proper resource naming?

Use plural nouns like /users and /orders, nest relationships up to two levels deep, and apply kebab-case for multi-word resources. Never put verbs in URLs; model actions as resources instead, such as POST /users/{id}/activation.

Cursor vs offset pagination: which should I use for a REST API?

Use cursor pagination for large or frequently changing datasets, encoding cursors as opaque base64 strings without exposing raw IDs. Use offset pagination only when the dataset is small and total count is cheap to compute.

What HTTP status codes should a REST API return?

Return 200 for reads and updates, 201 with a Location header for creation, 204 for deletes, 400 for validation errors, 401/403 for auth issues, 404 for missing resources, 409 for conflicts, 422 for semantic errors, and 429 with Retry-After for rate limits.

How do I version a REST API without breaking existing clients?

Use URL path versioning like /api/v1/users and never remove fields from a published version. Introduce new required fields only in a new version, deprecate old versions with a Sunset header and six-month notice, and support at most two active versions.

What should a REST API error response look like?

Return a consistent JSON envelope with an error object containing a code, message, and details array of field-level errors. Use stable error codes across the API and document every code in the API reference.

How do I handle rate limiting in a REST API?

Apply per-user, per-endpoint limits using a sliding window algorithm. Return 429 with a Retry-After header, include X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers, and exempt health check and auth endpoints.