api-design-patterns

Provides design guidance for REST and GraphQL APIs including authentication and pagination.

Updated Apr 11, 2023
One-click install
npx skills add https://github.com/salverius-tech/dotfiles --skill api-design-patterns-salverius-tech
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-design-patterns
Source: https://github.com/salverius-tech/dotfiles/tree/main/home/dot_claude/skills/api-design-patterns
Command: npx skills add https://github.com/salverius-tech/dotfiles --skill api-design-patterns-salverius-tech

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide to designing effective REST and GraphQL APIs, ensuring consistency, scalability, and maintainability.

Core Features & Use Cases

  • RESTful Design: Covers resource naming, HTTP methods, status codes, versioning, and pagination.
  • GraphQL Best Practices: Includes schema design, Relay connections, resolver patterns, and error handling.
  • Authentication & Authorization: Details API key, JWT, and OAuth2 implementation.
  • Use Case: When designing a new microservice API, use this Skill to ensure adherence to best practices for endpoint design, error responses, and authentication mechanisms, leading to a more predictable and user-friendly developer experience.

Quick Start

Consult the API Design Patterns skill for guidance on implementing proper pagination for large datasets.

Frequently Asked Questions about api-design-patterns

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

FAQPage Schema
What are the best practices for REST API resource naming and HTTP status codes?

REST API best practices involve standardized resource naming, appropriate HTTP methods, and accurate status codes to ensure predictable interfaces. This approach covers endpoint design, versioning, and pagination for scalable services.

How do I design a scalable GraphQL schema with pagination and resolvers?

Designing a scalable GraphQL schema requires structured schema design, Relay connections for pagination, and efficient resolver patterns. This ensures robust data fetching and consistent error handling across queries.

How should I implement JWT and OAuth2 authentication for my API?

API authentication using JWT and OAuth2 requires securing endpoints with token-based validation and proper authorization flows. This provides robust access control and protects resources from unauthorized requests.

What is the best way to handle API error responses and rate limiting?

Handling API errors and rate limiting requires standardized error response formats and throttling mechanisms. This ensures maintainable services, predictable developer experiences, and protects backend infrastructure from overload.

Does this API design guidance apply to both REST and GraphQL microservices?

Yes, this API design guidance provides language-agnostic patterns applicable to both REST and GraphQL microservices. It ensures consistency in endpoint design, schema structures, and authentication mechanisms across different architectures.