REST API design — resource naming, HTTP methods, status codes, pagination, error handling.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-gentleman-native:api-restThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
A well-designed API is intuitive. If a developer needs to read documentation for every endpoint, the design failed.
A well-designed API is intuitive. If a developer needs to read documentation for every endpoint, the design failed.
GET /users ← list users
POST /users ← create user
GET /users/:id ← get user
PUT /users/:id ← replace user
PATCH /users/:id ← partial update
DELETE /users/:id ← delete user
/getUsers, /createUser, /deleteUser. The method already tells you the action./users not /user./users/:id/orders./orders?userId=123.| Method | Purpose | Idempotent | Body |
|---|---|---|---|
| GET | Read | Yes | No |
| POST | Create | No | Yes |
| PUT | Full replace | Yes | Yes |
| PATCH | Partial update | No* | Yes |
| DELETE | Remove | Yes | No |
| Code | When |
|---|---|
200 OK | Successful GET, PUT, PATCH |
201 Created | Successful POST — include Location header |
204 No Content | Successful DELETE or action with no response body |
400 Bad Request | Malformed request (invalid JSON, missing required field) |
401 Unauthorized | No authentication (actually means "unauthenticated") |
403 Forbidden | Authenticated but not authorized |
404 Not Found | Resource doesn't exist |
409 Conflict | State conflict (duplicate email, version mismatch) |
422 Unprocessable Entity | Valid JSON but fails validation (email format, min length) |
429 Too Many Requests | Rate limited |
500 Internal Server Error | Unhandled server error — never intentional |
{ success: false }. That's an anti-pattern.Use a consistent format across ALL endpoints:
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Email format is invalid",
"details": [
{ "field": "email", "message": "Must be a valid email address" }
]
}
}
code — machine-readable constant (for client error handling).message — human-readable description.details — optional array for field-level validation errors.GET /posts?limit=20&cursor=eyJpZCI6MTIzfQ
Response includes:
{ "data": [...], "pagination": { "next_cursor": "eyJpZCI6MTQzfQ", "has_more": true } }
GET /posts?limit=20&offset=40
GET /users?status=active&role=admin.sort param: GET /users?sort=-created_at (prefix - for descending).GET /users?sort=-created_at,name.GET /users?q=john for full-text search./v1/users. Simple, explicit, cacheable.X-RateLimit-Limit: 100
X-RateLimit-Remaining: 87
X-RateLimit-Reset: 1700000000
429 Too Many Requests with Retry-After header when exceeded.camelCase for JSON keys (JavaScript ecosystem standard).id in every resource response."2024-01-15T10:30:00Z".{ "data": [...], "pagination": {...} }, not bare arrays.Content-Type: application/json header._links with self, next, related — but don't cargo cult it./getUser, /deletePost).{ success: false, error: "..." }.npx claudepluginhub juanisarmiento/ecosistema-claude --plugin claude-gentleman-nativeDesigns RESTful APIs with resource naming, HTTP methods, status codes, JSON response formats, pagination, and query parameters. Use when building new APIs or establishing conventions.
Guides REST API design patterns for production-grade endpoints including resource naming, status codes, pagination, filtering, error responses, versioning, and rate limiting. Use when designing new APIs or reviewing contracts.
Provides RESTful API design standards covering resource naming, HTTP methods, status codes, pagination, versioning, and error response formats.