skillfed

spring-boot-rest-api-standards

This skill guides you through building well-structured REST APIs in Spring Boot, covering resource-based URL design, proper HTTP method usage, appropriate status codes, and DTO patterns. It includes strategies for validation, global exception handling, pagination setup, and security header configuration. Use it when creating endpoints, designing API contracts, or reviewing REST architecture.

spring-boot-rest-api-standards helps you design and implement REST endpoints following Spring Boot conventions for URLs, HTTP methods, status codes, DTOs, validation, and error handling.

AI-generated summary based on this skill's SKILL.md

311 37 MIT updated by giuseppe-trisciuoglio

Install

giuseppe-trisciuoglio/developer-kit/spring-boot-rest-api-standards · repository language: Python

git clone https://github.com/giuseppe-trisciuoglio/developer-kit
cp -r developer-kit/plugins/developer-kit-java/skills/spring-boot-rest-api-standards ~/.claude/skills/spring-boot-rest-api-standards
npx skillfed install giuseppe-trisciuoglio/developer-kit/spring-boot-rest-api-standards

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I design REST endpoints in Spring Boot following best practices?

spring-boot-rest-api-standards guides you through resource-based URL design, proper HTTP method usage, and appropriate status codes. Focus on noun-based endpoints (e.g., /api/users, /api/orders) rather than verb-based ones, use GET for retrieval, POST for creation, PUT/PATCH for updates, and DELETE for removal. The skill covers implementing these patterns with Spring Boot annotations like @RestController, @GetMapping, @PostMapping, and @RequestBody to ensure your endpoints follow REST conventions.

What is the best way to handle errors in a Spring Boot REST API?

spring-boot-rest-api-standards teaches global error handling through @ControllerAdvice and @ExceptionHandler annotations. This approach centralizes exception management, allowing you to catch specific exceptions and return standardized error responses with appropriate HTTP status codes. The skill shows how to create consistent error response DTOs containing error codes, messages, and timestamps, ensuring clients receive predictable error formats across all endpoints.

How should I validate request and response DTOs in Spring Boot?

spring-boot-rest-api-standards covers DTO validation using Spring's validation framework with annotations like @NotNull, @NotBlank, @Email, and @Size. Create separate request and response DTOs to maintain proper separation of concerns—request DTOs handle incoming data validation while response DTOs shape outgoing data. Use @Valid on controller method parameters to trigger validation, and combine with global exception handling to return validation error details.

How do I implement pagination in a Spring Boot REST API?

spring-boot-rest-api-standards shows how to configure pagination using Spring Data's Pageable interface. Accept pagination parameters (page, size, sort) in your controller methods, pass them to repository queries, and return Page objects. This enables clients to request specific result subsets efficiently. The skill demonstrates proper response formatting that includes total count, current page, and available pages for client-side navigation.

What security headers and CORS configuration does spring-boot-rest-api-standards cover?

spring-boot-rest-api-standards addresses production-ready security through CORS configuration and security headers. Learn to configure allowed origins, HTTP methods, and credentials using @CrossOrigin or WebMvcConfigurer. The skill includes setting security headers like X-Content-Type-Options, X-Frame-Options, and Strict-Transport-Security to protect against common vulnerabilities and ensure your API meets enterprise security requirements.

Can I use spring-boot-rest-api-standards to review existing REST API code?

Yes, spring-boot-rest-api-standards includes a REST API review checklist covering REST standards compliance. Use it to audit your existing endpoints for proper HTTP method usage, status code appropriateness, URL design consistency, DTO patterns, error handling standardization, and security configurations. This helps identify gaps between your current implementation and REST best practices.

SKILL.md

rendered from the published skill — quoted content, verbatim

Spring Boot REST API Standards

Overview

REST API design standards for Spring Boot covering URL design, HTTP methods, status codes, DTOs, validation, error handling, pagination, and security headers.

When to Use

  • Creating REST endpoints and API routes
  • Designing DTOs and API contracts
  • Implementing error handling and validation
  • Setting up pagination and filtering
  • Configuring security headers and CORS
  • Reviewing REST API architecture

Instructions

To Build RESTful API Endpoints

Follow these steps to create well-designed REST API endpoints:

  1. Design Resource-Based URLs
  2. Use plural nouns for resource names
  3. Follow REST conventions: GET /users, POST /users, PUT /users/{id}
  4. Avoid action-based URLs like /getUserList

  5. Implement Proper HTTP Methods

  6. GET: Retrieve resources (safe, idempotent)
  7. POST: Create

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 8 files
plugins/developer-kit-java/skills/spring-boot-rest-api-standards/SKILL.md
plugins/developer-kit-java/skills/spring-boot-rest-api-standards/references/architecture-patterns.md
plugins/developer-kit-java/skills/spring-boot-rest-api-standards/references/examples.md
plugins/developer-kit-java/skills/spring-boot-rest-api-standards/references/http-reference.md
plugins/developer-kit-java/skills/spring-boot-rest-api-standards/references/pagination-and-filtering.md
plugins/developer-kit-java/skills/spring-boot-rest-api-standards/references/references.md
plugins/developer-kit-java/skills/spring-boot-rest-api-standards/references/security-headers.md
plugins/developer-kit-java/skills/spring-boot-rest-api-standards/references/spring-web-annotations.md

Related skills

Tags

rest-conventions dto-patterns error-handling api-design http-semantics request-validation pagination-filtering security-headers controller-architecture api-contracts