/spring-boot-skills:api-designfrom Spring Boot Skills
Adds OpenAPI/SpringDoc documentation and REST conventions to Spring Boot 4 Maven projects. Handles API versioning, ProblemDetail error schemas, and DTO conventions.
Ships in Spring Boot Skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Adds OpenAPI/SpringDoc documentation and REST conventions to an existing Spring Boot 4 project.
SKILL_DIR = directory containing this SKILL.md file.
Load SKILL_DIR/references/openapi-conventions.md before annotating controllers — it covers
versioning strategy, annotation style, DTO naming, and the error schema used here.
| Field | Required | Notes |
|---|---|---|
title | No | API title; defaults to project name from pom.xml |
version | No | API version; defaults to 1.0.0 |
description | No | short API description |
basePath | No | /api (default) or /api/v1 |
annotateControllers | No | false (default) — only annotate if user explicitly asks |
cat pom.xml
find src/main/java -name '*Controller.java' | head -20
ls src/main/resources/
Confirm Spring Boot 4.x and web dependency.
Add to pom.xml:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>3.1.1</version>
</dependency>
Before writing, verify the latest SpringDoc version:
curl -s "https://repo1.maven.org/maven2/org/springdoc/springdoc-openapi-starter-webmvc-ui/maven-metadata.xml" \
| python3 -c "import sys,re; print(re.findall(r'<version>(.*?)</version>', sys.stdin.read())[-1])"
SpringDoc 2.x is for Spring Boot 3+/SpringDoc 2.x APIs. Do not use springdoc-openapi-ui (the 1.x
artifact) on Boot 4.
Create src/main/java/<package>/shared/config/OpenApiConfig.java:
package <package>.shared.config;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.servers.Server;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.List;
@Configuration
public class OpenApiConfig {
@Bean
public OpenAPI openAPI(
@Value("${info.app.title:API}") String title,
@Value("${info.app.version:1.0.0}") String version,
@Value("${info.app.description:}") String description) {
return new OpenAPI()
.info(new Info()
.title(title)
.version(version)
.description(description))
.servers(List.of(
new Server().url("/").description("Default")
));
}
}
Add:
springdoc:
api-docs:
path: /api-docs
swagger-ui:
path: /swagger-ui.html
operations-sorter: method
tags-sorter: alpha
default-produces-media-type: application/json
info:
app:
title: ${APP_TITLE:<project name>}
version: ${APP_VERSION:1.0.0}
description: ${APP_DESCRIPTION:}
If spring-security is present, permit /swagger-ui/**, /api-docs/**, and /v3/api-docs/**.
Add src/main/java/<package>/shared/api/ProblemDetailSchema.java to document the ProblemDetail
responses globally:
package <package>.shared.api;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import org.springframework.http.ProblemDetail;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@ApiResponse(responseCode = "400", description = "Bad request",
content = @Content(schema = @Schema(implementation = ProblemDetail.class)))
@ApiResponse(responseCode = "404", description = "Not found",
content = @Content(schema = @Schema(implementation = ProblemDetail.class)))
@ApiResponse(responseCode = "409", description = "Conflict",
content = @Content(schema = @Schema(implementation = ProblemDetail.class)))
@ApiResponse(responseCode = "500", description = "Internal server error",
content = @Content(schema = @Schema(implementation = ProblemDetail.class)))
public @interface ProblemDetailSchema {
}
Use it on controllers:
@ProblemDetailSchema
@RestController
@RequestMapping("/api/v1/jobs")
public class JobController {
}
Create src/main/java/<package>/shared/api/ApiVersion.java:
package <package>.shared.api;
public final class ApiVersion {
private ApiVersion() {}
public static final String V1 = "/api/v1";
}
Use ApiVersion.V1 in @RequestMapping on controllers. Do not hardcode /api/v1 in multiple
controllers.
Only if annotateControllers is true. Add @Tag, @Operation, @Schema, and example DTO fields.
Example:
@Tag(name = "Jobs", description = "Job listing management")
@RestController
@RequestMapping(ApiVersion.V1 + "/jobs")
public class JobController {
@Operation(summary = "Create a job", description = "Creates a new job listing")
@PostMapping
public ResponseEntity<JobResponse> create(@Valid @RequestBody JobRequest request) { ... }
}
Never annotate internal/admin-only endpoints in a way that exposes them to public docs if they should
not be public. Use @Hidden for internal endpoints.
Create docs/api-conventions.md:
# API conventions
## Base path
All endpoints are under `/api/v1` unless marked otherwise.
## Content type
JSON only. Request bodies must include `Content-Type: application/json`.
## Errors
Errors follow RFC 9457 `ProblemDetail`:
```json
{
"type": "about:blank",
"title": "Resource Not Found",
"status": 404,
"detail": "Job not found: 42"
}
docs/pagination.md for implementation details.URL path versioning (/api/v1/). A new breaking version gets a new path (/api/v2/).
---
## Step 9 — Run and report
```bash
./mvnw test
Then verify the docs render at:
http://localhost:8080/swagger-ui.html
http://localhost:8080/api-docs
Report:
OpenApiConfig, ProblemDetailSchema, ApiVersion createdapplication.yml updateddocs/api-conventions.md createdspring-security to protect documented endpointsWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub dancan254/spring-boot-skills --plugin spring-boot-skills17 skills in this plugin
/devops-scaffoldAdd or update Dockerfile, docker-compose.yml, and GitHub Actions CI for an existing Spring Boot Maven project; reads the project first. Use when asked to dockerize a project, add CI or GitHub Actions, or set up DevOps. Not for security scanning — use security-hardening. Not for new projects — use spring-scaffold./http-resilienceMake outbound HTTP calls resilient in an existing Spring Boot 4 Maven project — circuit breakers, retries, and timeouts with RestClient and Resilience4j, plus tests that prove failures degrade gracefully. Use when asked to add retries or a circuit breaker, call external APIs reliably, or protect against a flaky downstream. Not for inbound rate limiting — use redis-setup./kafka-setupAdd Apache Kafka producers and consumers to an existing Spring Boot 4 Maven project — Spring Kafka config, JSON events, dead-letter topics, Testcontainers tests, compose wiring. Use when asked to add Kafka, Kafka topics, or event streaming. If messaging is requested without naming a broker, ask Kafka or RabbitMQ first./legacy-migrationMigrate a Spring Boot 2.x or 3.x app to Boot 4.x (Maven or Gradle) — audit first, then OpenRewrite-led version hops with a green build per hop, covering Jakarta, Jackson 3, modular starters, and runtime-only breakages. Use when asked to upgrade or migrate Spring Boot, or fix javax imports after an upgrade. Not for new projects./mcp-serverExpose an existing Spring Boot 4 Maven service as an MCP server with Spring AI — transport choice, @McpTool tools, tool hints, endpoint security, and verification with a real MCP client. Use when asked to add MCP, expose tools to an LLM or agent, or let an AI call my backend. Not for RAG — use spring-ai-rag./otel-setupWire OpenTelemetry end to end into an existing Spring Boot 4 Maven project — OTLP export for traces, metrics, and logs, the Logback appender Boot doesn't ship, a local Grafana LGTM backend, and a runbook proving all three signals land. Use when asked to add observability or OpenTelemetry, or when logs never reach the backend.