agentsclimarketplace

Api design

Skill taipt1504/agent-skills/skills/api-design

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.From its SKILL.md

Install
npx -y skills add taipt1504/agent-skills --skill api-design

Assembled 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

5.0 KB, as published. Nobody here has run it

REST API Design Patterns

HTTP Methods & Status Codes

MethodPurposeIdempotentSuccess Code
GETReadYes200
POSTCreateNo201 + Location
PUTFull replaceYes200
PATCHPartial updateNo200
DELETERemoveYes204

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).

URL Conventions

  • Resource mapping (controller): /api/${resource}
  • Path APIs (method): /${versioning}/...
  • Full URL: /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.

Error Format — RFC 7807

{
  "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.

Pagination

TypeBest ForNotes
Offset (page=0&size=20)Admin UIsSimple; slow at large offsets
Cursor (opaque token)Feeds, infinite scrollConsistent; no drift
Keyset (afterId=X)Large datasetsFastest; needs composite index

Cap size at 100. Prefer cursor/keyset.

Versioning

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.

Validation & Rate Limiting

  • @Valid on all @RequestBody. Bean Validation: @NotBlank, @Email, @Size, @NotNull.
  • Whitelist sort fields to prevent injection.
  • Rate limit headers: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, Retry-After.

Checklist

  • Plural nouns, kebab-case, max 2-level nesting
  • Correct HTTP methods and status codes
  • RFC 7807 Problem Details for errors
  • @Valid on all @RequestBody
  • Global @RestControllerAdvice exception handler
  • Pagination on list endpoints (cursor preferred)
  • Sort field whitelist
  • API version in URL path
  • Location header on 201 responses
  • Rate limiting with standard headers
  • OpenAPI docs (@Operation, @ApiResponse)
  • Idempotency keys on mutation endpoints
  • Bulk operations capped (max 100)
  • Async ops use 202 + polling

References

Related Skills

  • summer-rest — Summer Framework handler pattern, ResponseFactory, exception handling
  • spring-webflux-patterns — Controller implementation patterns (MVC + WebFlux)
  • spring-security — Rate limiting headers, CORS, authentication for APIs
  • architecture — Hexagonal interface layer design for REST endpoints

Keep looking

Skills are one crate of 626,194. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.