api-design-principles

Guide REST and GraphQL API design with versioning, pagination, and error handling.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/nksrentas/ai-stash --skill api-design-principles-nksrentas
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-design-principles
Source: https://github.com/nksrentas/ai-stash/tree/main/skills/api-design-principles
Command: npx skills add https://github.com/nksrentas/ai-stash --skill api-design-principles-nksrentas

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

Guides the creation of intuitive REST and GraphQL APIs with solid versioning, consistency, and developer experience.

Core Features & Use Cases

  • RESTful & GraphQL Foundations: Resource-oriented endpoints and schema-first GraphQL design.
  • Versioning & Documentation: Clear version paths and developer docs for long-term maintenance.
  • Error Handling & Observability: Consistent error formats and observability patterns.

Quick Start

Propose a versioned REST endpoint for a new dataset API, outlining path, methods, and response shapes.

Frequently Asked Questions about api-design-principles

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

FAQPage Schema
How do I design a REST API that follows versioning best practices?

REST API versioning establishes long-term compatibility through clear version paths in URLs or headers, paired with consistent endpoint design. Use URI-based versioning (e.g., `/v1/`, `/v2/`) or header-based approaches, document deprecation timelines, and maintain backward compatibility across major versions to reduce developer friction.

What are the key differences between REST and GraphQL API design?

REST uses resource-oriented endpoints with fixed response shapes; GraphQL uses schema-first design where clients request exactly the fields needed. REST scales through versioning and caching; GraphQL reduces over-fetching and under-fetching. Choose REST for simple, cacheable resources; GraphQL for complex queries and flexible client requirements.

How should I structure error handling across my API?

Consistent error handling includes standardized HTTP status codes, uniform error response formats with descriptive messages, and clear error documentation. Use schemas to define error objects, include request IDs for observability, and document which errors each endpoint can return so clients handle failures predictably.

What pagination patterns work best for large datasets in APIs?

Pagination patterns include offset-limit (simple, cursor-prone to gaps), cursor-based (stable, efficient), and keyset pagination (scalable). Select based on dataset size and sort stability. Document page size limits, default behavior, and whether sorting affects cursors to guide client implementation.

Do I need API documentation beyond the schema definition?

Yes. Schema definitions alone do not cover authentication flows, rate limits, error scenarios, or use-case examples. Developer documentation should include quick-start guides, endpoint walkthroughs, authentication/authorization patterns, and code samples to reduce integration time and support burden.

How do authentication and authorization fit into API design?

Authentication verifies identity (API keys, OAuth, JWT); authorization controls what authenticated users can access. Design APIs with clear scopes or permissions, document token formats and expiration, use consistent header conventions, and provide observability into access denials to help developers debug permission issues.