api-design-principles

Design REST and GraphQL APIs using resource-oriented patterns, pagination, and versioning conventions.

Updated Apr 6, 2026
One-click install
npx skills add https://github.com/QT-7274/dotfiles --skill api-design-principles-qt-7274
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: api-design-principles
Source: https://github.com/QT-7274/dotfiles/tree/main/api-design-principles
Command: npx skills add https://github.com/QT-7274/dotfiles --skill api-design-principles-qt-7274

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Designing consistent, maintainable APIs is hard: teams struggle with inconsistent naming, wrong HTTP semantics, missing pagination, N+1 query problems in GraphQL, and breaking changes that frustrate API consumers. ## Core Features & Use Cases - REST Design Guidance: Resource-oriented URL structures, correct HTTP method semantics, status codes, pagination, filtering, rate limiting, and versioning strategies. - GraphQL Schema Patterns: Schema-first design, Relay cursor pagination, DataLoader-based N+1 prevention, input/payload mutation patterns, and deprecation workflows. - Ready-to-Use Resources: A production-style FastAPI template, a comprehensive pre-implementation checklist, and worked code examples in Python and GraphQL SDL. - Use Case: When reviewing a new endpoint specification, apply the checklist to verify status codes, pagination metadata, error formats, and authentication handling before implementation begins. ## Quick Start Ask the AI to review your API endpoint design or draft a REST or GraphQL schema for your resource model using this skill.

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 RESTful API with proper HTTP methods?▼

Use plural nouns for resources like /api/users and map CRUD operations to HTTP methods: GET for retrieval, POST for creation, PUT for full replacement, PATCH for partial updates, and DELETE for removal. Return 201 for successful creation and 204 for deletions.

REST vs GraphQL: which should I use for my API?▼

REST suits resource-oriented services with standard CRUD operations and simple caching, while GraphQL lets clients request exactly the fields they need through a single typed endpoint. GraphQL requires DataLoaders to avoid N+1 queries and complexity limits to prevent expensive queries.

How do I fix the N+1 query problem in GraphQL?▼

Use the DataLoader pattern to batch and cache database requests per request cycle. A DataLoader collects all IDs requested during field resolution and fetches them in a single query, mapping results back to the original order.

What API versioning strategy should I choose?▼

URL versioning like /api/v1/users is recommended because it is explicit and easy to route. Header versioning keeps URLs clean but is less visible, while query parameter versioning is easy to test but can be forgotten by clients.

Should I use cursor-based or offset-based pagination?▼

Use cursor-based pagination (Relay-style with edges and pageInfo) for large or frequently changing datasets and infinite scroll interfaces. Offset pagination with page and page_size parameters is simpler and works well for small, stable collections.

What are common REST API design mistakes to avoid?▼

Common pitfalls include using verbs in URLs, ignoring HTTP semantics like making POST idempotent, inconsistent error formats, missing rate limits, deep resource nesting beyond two levels, and mirroring the database schema directly in the API structure.