rest-api-design

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

Updated Jun 28, 2026
One-click install
npx skills add https://github.com/412181-HerediaLara/ScaffoldingBE-FE --skill rest-api-design-412181-heredialara
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rest-api-design
Source: https://github.com/412181-HerediaLara/ScaffoldingBE-FE/tree/main/BE/.agents/skills/rest-api-design
Command: npx skills add https://github.com/412181-HerediaLara/ScaffoldingBE-FE --skill rest-api-design-412181-heredialara

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? It helps developers design consistent, well-structured REST APIs by providing concrete guidance on resource naming, HTTP methods, status codes, versioning, and documentation, avoiding common mistakes like verb-based endpoints or inconsistent response formats. ## Core Features & Use Cases - Resource Modeling Guidance: Enforces noun-based, plural resource naming with proper nesting limits and CRUD-to-HTTP-method mapping. - Response & Error Standards: Provides templates for success, paginated collection, and structured error responses with correct status codes (200, 201, 400, 404, 409, 422, 429). - OpenAPI Documentation: Includes an OpenAPI 3.0 scaffold template and a complete Express.js reference implementation covering pagination, validation, and error handling. - Use Case: When building a new backend service, use this Skill to design the endpoint structure for a users resource, define request/response schemas, and generate the OpenAPI specification before writing controller code. ## Quick Start Ask the assistant to design a REST API for your resource, for example: design the endpoints, response formats, and OpenAPI spec for a products API with pagination and filtering.

Frequently Asked Questions about rest-api-design

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

FAQPage Schema
How do I design REST API endpoints correctly?

Use plural nouns for resources like /api/users instead of verbs like /api/getUsers, and map CRUD operations to HTTP methods: GET for reads, POST for creation, PUT/PATCH for updates, and DELETE for removal. Limit nesting to two levels, such as /api/users/123/orders.

What HTTP status codes should a REST API return?

Return 200 for successful reads, 201 for resource creation, 204 for deletions without a body, 400 for invalid requests, 401/403 for auth failures, 404 for missing resources, 409 for conflicts like duplicate emails, 422 for validation errors, and 429 for rate limiting.

How do I add pagination to a REST API response?

Accept page and limit query parameters, then return a pagination object with page, limit, total, totalPages, hasNext, and hasPrev alongside the data array. Optionally include HATEOAS-style links for self, first, prev, next, and last pages.

What is the best way to version a REST API?

URL path versioning such as /api/v1/users is the recommended approach because it is explicit and easy to route. Header-based versioning via Accept: application/vnd.myapi.v1+json is an alternative, while query parameter versioning is not recommended.

How should REST API error responses be formatted?

Return a structured error object containing a machine-readable code, a human-readable message, and a details array with field-level validation messages. Include metadata like timestamp and requestId to support debugging and client-side error handling.