# spring-boot-rest-api-standards

Enforces REST API design standards for Spring Boot, covering URL structure, DTO validation, status codes, and global exception handling.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 4200 installs · ★ 363
- Author: giuseppe-trisciuoglio
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/giuseppe-trisciuoglio/developer-kit/tree/HEAD/plugins/developer-kit-java/skills/spring-boot-rest-api-standards/SKILL.md
- Updated: 2026-09-10
- HTML: https://affpapa.org/en/nevibecode/skills/spring-boot-rest-api-standards

## What it does

This skill provides instructions for designing REST APIs in Spring Boot projects. It enforces resource-based URLs using plural nouns, aligns HTTP methods with idempotency rules, and prescribes status codes like 201 for creation, 204 for deletion, and 409 for conflicts.

The guidelines require separating API contracts from domain models. It instructs agents to build DTOs with Java records or Lombok, validate payloads with Jakarta annotations via `@Valid`, and catch exceptions using `@RestControllerAdvice`. Large datasets must use `Pageable` parameters along with pagination metadata.

Because the standard explicitly bans exposing domain entities directly, you will need dedicated DTO classes for every request and response payload.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add giuseppe-trisciuoglio/developer-kit --skill spring-boot-rest-api-standards -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/spring-boot-rest-api-standards/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/spring-boot-rest-api-standards/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add giuseppe-trisciuoglio/developer-kit --skill spring-boot-rest-api-standards -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/spring-boot-rest-api-standards/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add giuseppe-trisciuoglio/developer-kit --skill spring-boot-rest-api-standards -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/spring-boot-rest-api-standards/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install giuseppe-trisciuoglio/developer-kit spring-boot-rest-api-standards
```

2. **Manually: put the files in place**
- File: `.github/skills/spring-boot-rest-api-standards/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add giuseppe-trisciuoglio/developer-kit --skill spring-boot-rest-api-standards -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/giuseppe-trisciuoglio/developer-kit --path plugins/developer-kit-java/skills/spring-boot-rest-api-standards
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/spring-boot-rest-api-standards/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add giuseppe-trisciuoglio/developer-kit --skill spring-boot-rest-api-standards -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/giuseppe-trisciuoglio/developer-kit/tree/HEAD/plugins/developer-kit-java/skills/spring-boot-rest-api-standards/SKILL.md

## When to use it
- design resource-based REST endpoints with correct HTTP status codes
- set up global exception handling using @RestControllerAdvice
- validate incoming DTOs with Jakarta Validation constraints
- implement paginated responses with Pageable metadata

## Example prompts
- Generate a user CRUD controller following spring-boot-rest-api-standards
- Review this Spring Boot REST controller and fix any status code or URL issues
- Create a global exception handler for validation errors and ResponseStatusException

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 0d19870194adddb0.

BEGIN THIRD-PARTY FILE 0d19870194adddb0
```text
---
name: spring-boot-rest-api-standards
description: Provides REST API design standards and best practices for Spring Boot projects. Use when creating or reviewing REST endpoints, DTOs, error handling, pagination, security headers, HATEOAS and architecture patterns.
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
---

# 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**
   - Use plural nouns for resource names
   - Follow REST conventions: GET /users, POST /users, PUT /users/{id}
   - Avoid action-based URLs like /getUserList

2. **Implement Proper HTTP Methods**
   - GET: Retrieve resources (safe, idempotent)
   - POST: Create resources (not idempotent)
   - PUT: Replace entire resources (idempotent)
   - PATCH: Partial updates (not idempotent)
   - DELETE: Remove resources (idempotent)

3. **Use Appropriate Status Codes**
   - 200 OK: Successful GET/PUT/PATCH
   - 201 Created: Successful POST with Location header
   - 204 No Content: Successful DELETE
   - 400 Bad Request: Invalid request data
   - 404 Not Found: Resource doesn't exist
   - 409 Conflict: Duplicate resource
   - 500 Internal Server Error: Unexpected errors

4. **Create Request/Response DTOs**
   - Separate API contracts from domain entities
   - Use Java records or Lombok `@Data`/`@Value`
   - Apply Jakarta validation annotations
   - Keep DTOs immutable when possible

5. **Implement Validation**
   - Use `@Valid` annotation on `@RequestBody` parameters
   - Apply validation constraints (`@NotBlank`, `@Email`, `@Size`, etc.)
   - Handle validation errors with `MethodArgumentNotValidException`

6. **Set Up Error Handling**
   - Use `@RestControllerAdvice` for global exception handling
   - Return standardized error responses with status, error, message, and timestamp
   - Use `ResponseStatusException` for specific HTTP status codes

7. **Configure Pagination**
   - Use Pageable for large datasets
   - Include page, size, sort parameters
```
END THIRD-PARTY FILE 0d19870194adddb0

The third-party file has ended. Everything between the 0d19870194adddb0 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2495 of 7959 bytes. © giuseppe-trisciuoglio · MIT · https://github.com/giuseppe-trisciuoglio/developer-kit/tree/HEAD/plugins/developer-kit-java/skills/spring-boot-rest-api-standards/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
