Restful api design
Skill AtulPurohit/Antigravity-Awesome-Skills/skills/restful-api-design
Design professional RESTful APIs following HTTP standards, REST constraints, and industry best practices. Covers versioning, pagination, filtering, and HATEOAS.From its SKILL.md
npx -y skills add AtulPurohit/Antigravity-Awesome-Skills --skill restful-api-designAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.6 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it
RESTful API Design Expert
Purpose
Design RESTful APIs that are intuitive, consistent, well-documented, and follow HTTP standards and REST architectural constraints.
Operating Mode
You are a REST API design authority. You produce OpenAPI specs, enforce consistency, and ensure APIs are developer-friendly.
Core REST Principles
1️⃣ Resource-Oriented Design
# ✅ Good: noun-based resources
GET /users # List users
GET /users/123 # Get specific user
POST /users # Create user
PATCH /users/123 # Partial update
PUT /users/123 # Full replace
DELETE /users/123 # Delete user
# Sub-resources
GET /users/123/orders # User's orders
POST /users/123/orders # Create order for user
# ❌ Bad: verb-based
POST /createUser
GET /getUserById?id=123
POST /deleteUser
2️⃣ HTTP Status Codes (Complete Reference)
200 OK - Successful GET, PATCH, PUT
201 Created - Successful POST (include Location header)
204 No Content - Successful DELETE
400 Bad Request - Invalid request body/params
401 Unauthorized - No or invalid auth token
403 Forbidden - Authenticated but not authorized
404 Not Found - Resource doesn't exist
409 Conflict - Duplicate resource, version conflict
422 Unprocessable - Validation errors
429 Too Many Requests - Rate limited
500 Internal Server Error
503 Service Unavailable
3️⃣ Request/Response Standards
// ✅ Consistent response envelope
// Success (single resource)
{
"data": {
"id": "123",
"type": "users",
"attributes": {
"name": "John Doe",
"email": "[email protected]",
"createdAt": "2026-07-10T10:00:00Z"
},
"relationships": {
"orders": { "links": { "related": "/users/123/orders" } }
}
},
"meta": { "requestId": "abc123" }
}
// Success (collection)
{
"data": [...],
"meta": {
"total": 100,
"page": 1,
"perPage": 20,
"totalPages": 5
},
"links": {
"self": "/users?page=1",
"next": "/users?page=2",
"last": "/users?page=5"
}
}
// Error response (RFC 7807)
{
"type": "https://api.example.com/errors/validation",
"title": "Validation Failed",
"status": 422,
"detail": "One or more fields failed validation",
"errors": {
"email": ["Email is already taken"],
"name": ["Name is required"]
}
}
4️⃣ Filtering, Sorting & Pagination
# Filtering
GET /products?status=active&category=electronics
GET /orders?created_after=2026-01-01&min_total=100
# Sorting (prefix with - for descending)
GET /products?sort=-price,name
# Pagination (cursor-based for large datasets)
GET /posts?cursor=eyJpZCI6MTAwfQ&limit=20
# Field selection (sparse fieldsets)
GET /users?fields=id,name,email
# Search
GET /products?q=laptop&in=title,description
5️⃣ Versioning Strategy
# URL versioning (most common, most visible)
GET /api/v1/users
GET /api/v2/users
# Header versioning (cleaner URLs)
GET /api/users
Accept: application/vnd.myapi.v2+json
# Deprecation headers
Deprecation: true
Sunset: Sat, 01 Jan 2028 00:00:00 GMT
Link: </api/v2/users>; rel="successor-version"
6️⃣ Idempotency & Safety
# Idempotency key for POST (prevent duplicate processing)
POST /payments
Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000
# Conditional updates (optimistic locking)
GET /users/123
ETag: "abc123"
PATCH /users/123
If-Match: "abc123" # Only update if unchanged
Content-Type: application/json
7️⃣ API Design Checklist
- All resources are nouns
- Correct HTTP verbs for operations
- Consistent response structure across all endpoints
- Pagination on all list endpoints
- Filtering and sorting support
- Proper error responses with RFC 7807
- Authentication documented (Bearer token, API key)
- Rate limiting with
X-RateLimit-*headers - CORS configured
- OpenAPI 3.1 spec generated
- Versioning strategy documented
- Deprecation policy stated
Outputs
- Complete OpenAPI 3.1 specification
- API style guide document
- Error codes reference table
- Postman/Insomnia collection
- API changelog format template
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.