api-design-principles

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

1|Updated Mar 13, 2026
One-click install
npx skills add https://github.com/dominionism/Noesis --skill api-design-principles-dominionism
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: api-design-principles
Source: https://github.com/dominionism/Noesis/tree/main/assets/skills/api-design-principles
Command: npx skills add https://github.com/dominionism/Noesis --skill api-design-principles-dominionism

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Designing consistent, scalable APIs is hard: teams struggle with inconsistent naming, missing pagination, poor error formats, N+1 query problems in GraphQL, and unplanned versioning that breaks clients. This Skill provides concrete REST and GraphQL design patterns, code templates, and review checklists to produce well-structured APIs. ## Core Features & Use Cases - REST Design Patterns: Resource-oriented endpoints, HTTP method semantics, pagination and filtering, HATEOAS links, and standardized error responses with correct status codes. - GraphQL Design Patterns: Schema-first development, Relay-style cursor pagination, DataLoader-based N+1 prevention, input/payload mutation patterns, and deprecation strategies. - Ready-to-Use Resources: A FastAPI REST template, a GraphQL schema design reference, and a comprehensive pre-implementation review checklist. - Use Case: When designing a new users API, apply the resource-oriented endpoint patterns, add cursor or offset pagination, standardize error responses, and run the checklist before implementation to catch missing rate limits, auth checks, or documentation gaps. ## Quick Start Use the api-design-principles skill to review my planned /api/users endpoints and generate a paginated FastAPI implementation with proper error handling.

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 pagination and filtering?▼

Use plural noun endpoints like GET /api/users with query parameters for page, page_size, status, and search. Return a paginated response containing items, total, page, page_size, and pages so clients can navigate collections.

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

Use DataLoader to batch relationship queries into single database calls. Register loaders per request context, such as an orders-by-user loader, so nested fields fetch data for many parents in one query instead of one query per parent.

Should I use REST or GraphQL for my API?▼

REST fits resource-oriented CRUD with simple caching and clear HTTP semantics. GraphQL fits clients needing flexible field selection and aggregated data, but requires DataLoaders, query depth limits, and complexity analysis to stay performant.

What HTTP status codes should a REST API return?▼

Return 200 for successful GET/PATCH/PUT, 201 for POST creation, 204 for DELETE, 400 for malformed requests, 401 for missing auth, 403 for insufficient permissions, 404 for missing resources, 422 for validation errors, and 429 for rate limiting.

How do I version an API without breaking existing clients?▼

Use URL versioning like /api/v1/users, header versioning via the Accept header, or query parameters. In GraphQL, prefer evolving the schema with the @deprecated directive instead of removing fields, giving clients a gradual migration path.

Why does cursor pagination outperform offset pagination?▼

Cursor pagination encodes a position token so results stay consistent when rows are inserted or deleted during traversal. Offset pagination can skip or duplicate items on changing data and degrades on large datasets, making cursors better for infinite scroll.