From devco-agent-skills
REST API design patterns for Spring Boot — HTTP methods, status codes, URL conventions, RFC 7807 ProblemDetail errors, pagination, versioning, validation, and OpenAPI documentation. Use when designing REST endpoints, choosing HTTP status codes, implementing error responses, adding pagination to list APIs, versioning APIs, or generating OpenAPI/Swagger specs.
How this skill is triggered — by the user, by Claude, or both
Slash command
/devco-agent-skills:api-designThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
| Method | Purpose | Idempotent | Success Code |
| Method | Purpose | Idempotent | Success Code |
|---|---|---|---|
GET | Read | Yes | 200 |
POST | Create | No | 201 + Location |
PUT | Full replace | Yes | 200 |
PATCH | Partial update | No | 200 |
DELETE | Remove | Yes | 204 |
Key codes: 201 (Created + Location), 202 (Async), 204 (No content), 400 (Validation), 401 (Unauthenticated), 403 (Forbidden), 404 (Not found), 409 (Conflict), 422 (Semantic), 429 (Rate limited).
/api/${resource}/${versioning}/.../api/${resource}/${versioning}/...# Controller: @RequestMapping("/api/users")
GET /api/users/v1 # List
POST /api/users/v1 # Create
GET /api/users/v1/123 # Get by ID
PUT /api/users/v1/123 # Replace
DELETE /api/users/v1/123 # Delete
GET /api/users/v1/123/orders # Nested (max 2 levels)
# Controller: @RequestMapping("/api/orders")
POST /api/orders/v1/123/cancel # Action as sub-resource
Rules: plural nouns, kebab-case, lowercase, no trailing slash, no verbs. Version on method, NOT resource mapping — enables per-resource bumps.
{
"type": "https://api.example.com/problems/validation-error",
"title": "Validation Error",
"status": 400,
"detail": "Request validation failed",
"errors": [{"field": "email", "message": "must be a valid email"}]
}
Enable: spring.mvc.problemdetail.enabled: true. Use @RestControllerAdvice with ProblemDetail.
| Type | Best For | Notes |
|---|---|---|
Offset (page=0&size=20) | Admin UIs | Simple; slow at large offsets |
| Cursor (opaque token) | Feeds, infinite scroll | Consistent; no drift |
Keyset (afterId=X) | Large datasets | Fastest; needs composite index |
Cap size at 100. Prefer cursor/keyset.
Version in method path: /api/{resource}/{version}/.... v1 is forever — backward compatible. Optional fields for minor changes. Breaking changes = new version. Use Sunset + Deprecation headers.
@Valid on all @RequestBody. Bean Validation: @NotBlank, @Email, @Size, @NotNull.X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, Retry-After.@Valid on all @RequestBody@RestControllerAdvice exception handlerLocation header on 201 responses@Operation, @ApiResponse)Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub taipt1504/agent-skills --plugin devco-agent-skills