api-best-practices
Installation
SKILL.md
REST API Best Practices
Overview
Designing a robust REST API is critical for frontend-backend communication and third-party integrations. This skill covers the structural rules, status codes, naming conventions, and security measures essential for building professional APIs. Invoke this skill when architecting a new backend service, refactoring existing endpoints, or reviewing API designs.
Core Principles
- Resource-Oriented: URLs should represent nouns (resources), not verbs (actions).
- Statelessness: Each request must contain all the information the server needs to fulfill it. The server should not store request state between calls.
- Predictability: A consumer should be able to guess endpoint structures based on existing patterns.
- Idempotency: Operations like PUT and DELETE should produce the same result no matter how many times they are called.
Preparation Checklist
- Identify the core domain entities that will be exposed as resources.
- Decide on the API versioning strategy (e.g., URL path
/v1/, header, or query param). - Establish the standardization for response formats (e.g., JSON API standard, wrapper objects).