api-design-principles

Design REST and GraphQL APIs with versioning, pagination, and error handling patterns.

Updated Jun 12, 2026
One-click install
npx skills add https://github.com/bilacchi/agents-skills --skill api-design-principles-bilacchi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: api-design-principles
Source: https://github.com/bilacchi/agents-skills/tree/main/skills/api-design-principles
Command: npx skills add https://github.com/bilacchi/agents-skills --skill api-design-principles-bilacchi

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Designing consistent, maintainable REST and GraphQL APIs is difficult without established conventions for resources, errors, versioning, and pagination, leading to fragmented interfaces that frustrate consumers. ## Core Features & Use Cases - REST Design Guidance: Resource-oriented URL patterns, correct HTTP method and status code usage, pagination, filtering, rate limiting, and HATEOAS examples. - GraphQL Schema Patterns: Schema-first design with connections, input/payload mutations, DataLoader-based N+1 prevention, and deprecation strategies. - Review Assets: A pre-implementation checklist and a FastAPI template for bootstrapping consistent endpoints. - Use Case: When drafting a new public API, use the checklist and playbook to define resources, error formats, and versioning before writing any endpoint code. ## Quick Start Use the api-design-principles skill to review my proposed REST endpoints for a users and orders service and recommend improvements.

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 with proper pagination?▼

Use offset-based pagination with page and page_size parameters for simple cases, or cursor-based pagination for large datasets. Always include pagination metadata like total count and page numbers, enforce a maximum page size, and apply it to every collection endpoint.

How do I prevent N+1 queries in GraphQL?▼

Use the DataLoader pattern to batch and cache database requests per request cycle. A DataLoader collects all IDs requested during a tick and fetches them in a single query, eliminating per-field database round trips for relationships.

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

REST fits resource-oriented services with simple caching and clear HTTP semantics, while GraphQL suits clients needing flexible field selection and aggregated data from multiple sources. The skill covers both, including migration considerations between the paradigms.

What HTTP status codes should a REST API return?▼

Return 200 for successful reads and updates, 201 for creation, 204 for deletion, 400 for malformed requests, 401 for missing authentication, 403 for insufficient permissions, 404 for missing resources, 422 for validation errors, and 429 for rate limiting.

When should I not use this API design skill?▼

Avoid it when you only need framework-specific implementation help, when doing infrastructure work without API contracts, or when you cannot change or version public interfaces. It focuses on design decisions, not library-specific coding.