api-design-principles

Provide REST and GraphQL API design guidance for resource modeling, versioning, and error handling.

5|Updated Aug 23, 2025
One-click install
npx skills add https://github.com/camoneart/claude-code --skill api-design-principles
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-design-principles
Source: https://github.com/camoneart/claude-code/tree/main/skills/api-design-principles
Command: npx skills add https://github.com/camoneart/claude-code --skill api-design-principles

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Designing robust, scalable, and developer-friendly APIs (REST or GraphQL) is challenging and critical for successful software. This Skill provides a comprehensive guide to proven design principles and patterns, ensuring your APIs are maintainable and delightful to use.

Core Features & Use Cases

  • RESTful Design Patterns: Covers resource collection, pagination, error handling, and HATEOAS.
  • GraphQL Design Patterns: Guides on schema design, resolver implementation, and N+1 problem prevention with DataLoader.
  • Best Practices & Pitfalls: Highlights common mistakes and provides strategies for versioning, authentication, and performance.
  • Use Case: When starting a new microservice, this Skill helps you decide between REST and GraphQL, then guides you through designing endpoints, defining schemas, and implementing robust error handling.

Quick Start

Example: Design a REST API endpoint for user management

"I need to design a REST API for managing users. Show me the best practices for endpoints, pagination, and error handling."

Claude will provide examples and code snippets for /api/users endpoints, including status codes and error formats.

Frequently Asked Questions about api-design-principles

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

FAQPage Schema
What's the best way to design REST API endpoints for scalability?

REST API design for scalability focuses on stateless resource modeling, proper HTTP method semantics, and pagination strategies. Structure endpoints around nouns (resources), use correct status codes, implement cursor or offset-based pagination, and separate concerns across multiple endpoints to avoid monolithic payloads and enable horizontal scaling.

How do I choose between REST and GraphQL for my API?

REST suits simpler, strongly-typed resource hierarchies with predictable access patterns; GraphQL excels when clients need flexible, fine-grained data queries and you can manage schema complexity. REST is easier to cache and monitor; GraphQL reduces over-fetching and bandwidth but requires resolver optimization and N+1 prevention with tools like DataLoader.

How do I handle API versioning and backward compatibility?

API versioning strategies include URL paths (/v1/, /v2/), headers, or query parameters. Maintain backward compatibility by deprecating fields gradually, supporting multiple versions simultaneously, and communicating breaking changes clearly. Document migration paths so clients can upgrade without service disruption.

What are common API design mistakes and how do I avoid them?

Common pitfalls include inconsistent error response formats, missing or unclear pagination, poor HTTP semantics, inadequate documentation, and N+1 query problems in GraphQL. Establish team standards for error handling, implement structured error objects with codes and messages, version your schema, and use DataLoader to batch resolver queries.

How do I document and communicate API standards across my team?

Create a shared design specification covering endpoint naming conventions, error formats, authentication patterns, and pagination rules. Use OpenAPI for REST or GraphQL schema documentation, enforce standards in code review, and maintain a design guide that covers HATEOAS, versioning, and governance policies for consistency across microservices.