api-design

Design RESTful APIs with resource naming, HTTP methods, and status codes.

Updated May 24, 2023
One-click install
npx skills add https://github.com/Kimjiman/basic-arch --skill api-design-kimjiman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-design
Source: https://github.com/Kimjiman/basic-arch/tree/main/.claude/skills/api-design
Command: npx skills add https://github.com/Kimjiman/basic-arch --skill api-design-kimjiman

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide to designing and implementing production-ready REST APIs, ensuring consistency, developer-friendliness, and adherence to best practices.

Core Features & Use Cases

  • Resource Naming & URL Structure: Establishes conventions for clear and intuitive API endpoints.
  • HTTP Methods & Status Codes: Details the semantic use of HTTP verbs and status codes for effective communication.
  • Response Formatting: Defines standard structures for success, collection, and error responses, including pagination.
  • Pagination, Filtering, Sorting: Offers strategies for efficient data retrieval and manipulation.
  • Authentication, Authorization, Rate Limiting: Covers essential security and access control mechanisms.
  • Versioning: Outlines best practices for managing API evolution.
  • Use Case: When designing a new /users endpoint, use this Skill to determine the correct URL structure (/api/v1/users), HTTP methods (GET, POST, PUT, DELETE), status codes (200, 201, 404), and response formats for both single users and collections.

Quick Start

Use the api-design skill to generate a standard error response for a 400 bad request.

Frequently Asked Questions about api-design

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 URL structure?

REST API resource naming uses clear, intuitive endpoint conventions like `/api/v1/users`. This ensures your web services are consistent and developer-friendly by establishing a standardized URL structure for accessing resources.

How do I design REST API pagination, filtering, and sorting for large collections?

Design REST API pagination, filtering, and sorting by implementing standard response formats for collections. This ensures efficient data retrieval and manipulation, allowing clients to request specific subsets of data without overloading the backend.

What HTTP status codes should I use for REST API responses?

Use HTTP status codes like 200 for success, 201 for creation, and 404 for not found. Semantic use of these HTTP verbs and status codes ensures effective communication between the REST API and its clients.

How do I handle REST API authentication, authorization, and rate limiting?

Handle REST API security by implementing essential access control mechanisms. This covers authentication, authorization, and rate limiting to protect web services from unauthorized access and excessive requests.

Can I use this API design skill with TypeScript, Python, and Go backends?

Yes, you can use this skill with TypeScript, Python, and Go backends. It offers implementation patterns specifically for these languages to help you build robust and scalable REST APIs.

What is the best way to version a REST API?

Version a REST API by outlining best practices for managing API evolution, often using a version number in the URL path like `/api/v1/`. This manages breaking changes while maintaining backward compatibility for web services.