rest-api
REST API design principles and implementation patterns. Use when designing API endpoints, creating API clients, or implementing HTTP communication between frontend and backend.
When & Why to Use This Skill
This Claude skill provides comprehensive guidance on REST API design principles and implementation patterns. It assists developers in creating standardized API endpoints, managing HTTP methods, and handling status codes to ensure robust, scalable communication between frontend and backend systems.
Use Cases
- Designing standardized RESTful endpoints for web applications to ensure architectural consistency and maintainability.
- Implementing correct HTTP status codes and error handling patterns to improve API reliability and developer experience.
- Creating consistent JSON request and response structures for seamless integration between different software components.
- Developing API clients with proper header configurations, authentication patterns, and payload formatting.
- Refactoring legacy interfaces into modern RESTful architectures using industry-standard design patterns.
| name | rest-api |
|---|---|
| description | REST API design principles and implementation patterns. Use when designing API endpoints, creating API clients, or implementing HTTP communication between frontend and backend. |
| allowed-tools | Read, Edit, Write, Glob, Grep, Bash |
REST API Skill
Quick Reference
REST (Representational State Transfer) is an architectural style for designing networked applications.
API Endpoints (Based on Spec)
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/{user_id}/tasks | List all tasks |
| POST | /api/{user_id}/tasks | Create a task |
| GET | /api/{user_id}/tasks/{id} | Get task details |
| PUT | /api/{user_id}/tasks/{id} | Update a task |
| DELETE | /api/{user_id}/tasks/{id} | Delete a task |
| PATCH | /api/{user_id}/tasks/{id}/complete | Toggle completion |
HTTP Methods
- GET - Retrieve resources (safe, idempotent)
- POST - Create new resources (not idempotent)
- PUT - Update/replace entire resource (idempotent)
- PATCH - Partial update (not idempotent)
- DELETE - Remove resource (idempotent)
Status Codes
| Code | Meaning | Usage |
|---|---|---|
| 200 | OK | Successful GET, PUT, PATCH |
| 201 | Created | Successful POST (new resource) |
| 204 | No Content | Successful DELETE |
| 400 | Bad Request | Invalid input |
| 401 | Unauthorized | Missing/invalid token |
| 403 | Forbidden | Not user's resource |
| 404 | Not Found | Resource doesn't exist |
| 422 | Unprocessable Entity | Validation error |
| 500 | Internal Server Error | Server error |
Request Format
Headers
Authorization: Bearer {JWT_TOKEN}
Content-Type: application/json
Accept: application/json
Body (POST/PUT/PATCH)
{
"title": "Buy groceries",
"description": "Milk, eggs, bread",
"completed": false
}
Response Format
Success (200/201)
{
"id": 1,
"user_id": "user_123",
"title": "Buy groceries",
"description": "Milk, eggs, bread",
"completed": false,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
Error (4xx/5xx)
{
"detail": "Task not found",
"code": "NOT_FOUND"
}
For Detailed Reference
See REFERENCE.md for:
- Advanced query parameters
- Pagination patterns
- API versioning
- Rate limiting
- OpenAPI documentation