К основному содержанию
скилл CX Codex

spring-boot-openapi-documentation — скилл для Claude Code: OpenAPI

Скилл помогает агенту настроить SpringDoc OpenAPI 3.0 и Swagger UI в проекте на Spring Boot 3.x и разметить эндпоинты аннотациями.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add giuseppe-trisciuoglio/developer-kit --skill spring-boot-openapi-documentation -a claude-code
Открыть на GitHub

Что делает spring-boot-openapi-documentation

Скилл задаёт агенту порядок работы с документацией REST API: подключить стартер SpringDoc, прописать параметры в application.yml, разметить контроллеры и DTO. Внутри — справочники по зависимостям Maven и Gradle, конфигурации, аннотациям, безопасности, пагинации, обработке исключений и сборке. Агент читает нужный файл и применяет шаблон к вашему коду.

Документирование строится на аннотациях @Tag, @Operation, @ApiResponse, @Parameter, @Schema и @SecurityRequirement. Схемы безопасности (JWT, OAuth2, Basic Auth, API-ключ) описываются в бине OpenAPI, а на контроллерах подключаются через @SecurityRequirement. Для Spring Data Pageable скилл советует @ParameterObject — иначе параметры страницы расползутся по отдельным полям и Swagger UI покажет их нечитаемо.

Готовые точки доступа: JSON спецификации на /v3/api-docs, интерфейс на /swagger-ui/index.html. В разделе ограничений прямо сказано: не выносите чувствительные данные в примеры и описания схем. Скилл рассчитан на WebMvc и WebFlux, есть поддержка Kotlin.

Какие задачи решает

  • подключить SpringDoc к проекту на Spring Boot 3.x
  • разметить контроллеры аннотациями OpenAPI
  • описать DTO и ограничения валидации в схемах
  • настроить схемы безопасности JWT или OAuth2
  • задокументировать постраничные эндпоинты с Pageable

Примеры запросов агенту

  • настрой SpringDoc OpenAPI в этом Spring Boot проекте
  • добавь аннотации @Operation и @ApiResponse к контроллерам BookController
  • опиши схему bearer-jwt в бине OpenAPI и подключи её к защищённым эндпоинтам

Как установить spring-boot-openapi-documentation

1Через Skills CLI (Vercel)

npx skills add giuseppe-trisciuoglio/developer-kit --skill spring-boot-openapi-documentation -a claude-code

2Вручную: положить файлы

~/.claude/skills/spring-boot-openapi-documentation/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/spring-boot-openapi-documentation/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о spring-boot-openapi-documentation

Как установить spring-boot-openapi-documentation в Claude?

Выполните npx skills add giuseppe-trisciuoglio/developer-kit --skill spring-boot-openapi-documentation -a claude-code. После установки файл скилла лежит в ~/.claude/skills/spring-boot-openapi-documentation/SKILL.md.

Что делает spring-boot-openapi-documentation?

Даёт агенту шаблоны для генерации документации REST API через SpringDoc OpenAPI 3.0 и Swagger UI: зависимости, конфигурация, аннотации, схемы безопасности, пагинация и обработка ошибок.

Какие зависимости нужны для работы?

Стартер springdoc-openapi-starter-webmvc-ui для WebMvc или springdoc-openapi-starter-webflux-ui для WebFlux. Скилл подсказывает конфигурацию Maven и Gradle для обоих вариантов.

Исходный текст

SKILL.md · MIT
---
name: spring-boot-openapi-documentation
description: Provides patterns to generate comprehensive REST API documentation using SpringDoc OpenAPI 3.0 and Swagger UI in Spring Boot 3.x applications. Use when setting up API documentation, configuring Swagger UI, adding OpenAPI annotations, implementing security documentation, or enhancing REST endpoints with examples and schemas.
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
---

# Spring Boot OpenAPI Documentation with SpringDoc

## Overview

SpringDoc OpenAPI automates generation of OpenAPI 3.0 documentation for Spring Boot projects with a Swagger UI web interface for exploring and testing APIs.

## When to Use

- Set up SpringDoc OpenAPI in Spring Boot 3.x projects
- Generate OpenAPI 3.0 specifications for REST APIs
- Configure and customize Swagger UI
- Add detailed API documentation with annotations
- Document request/response models with validation
- Implement API security documentation (JWT, OAuth2, Basic Auth)
- Document pageable and sortable endpoints
- Add examples and schemas to API endpoints
- Customize OpenAPI definitions programmatically
- Support multiple API groups and versions
- Document error responses and exception handlers
- Add JSR-303 Bean Validation to API documentation
- Support Kotlin-based Spring Boot APIs

## Quick Reference

| Concept | Description |
|---------|-------------|
| **Dependencies** | `springdoc-openapi-starter-webmvc-ui` for WebMvc, `springdoc-openapi-starter-webflux-ui` for WebFlux |
| **Configuration** | `application.yml` with `springdoc.api-docs.*` and `springdoc.swagger-ui.*` properties |
| **Access Points** | OpenAPI JSON: `/v3/api-docs`, Swagger UI: `/swagger-ui/index.html` |
| **Core Annotations** | `@Tag`, `@Operation`, `@ApiResponse`, `@Parameter`, `@Schema`, `@SecurityRequirement` |
| **Security** | Configure security schemes in OpenAPI bean, apply with `@SecurityRequirement` |
| **Pagination** | Use `@ParameterObject` with Spring Data `Pageable` |

## Instructions

### 1. Add Dependencies

Add SpringDoc starter for your application type (WebMvc or WebFlux). See [dependency-setup.md](references/dependency-setup.md) for Maven/Gradle configuration.

### 2. Configure SpringDoc

Set basic configuration in `application.yml`:

```yaml
springdoc:
  api-docs:
    path: /api-docs
  swagger-ui:
    path: /swagger-ui.html
    operationsSorter: method
```

See [configuration.md](references/configuration.md) for advanced options.

### 3. Document Controllers

Use OpenAPI annotations to add descriptive information:

```java
@RestController
@Tag(name = "Book", description = "Book management APIs")
public class BookController {

    @Operation(summary = "Get book by ID")
    @ApiResponse(responseCode = "200", description = "Book found")
    @GetMapping("/{id}")
    public Book findById(@PathVariable Long id) { }
}
```

See [controller-documentation.md](references/controller-documentation.md) for patterns.

### 4. Document Models

Apply `@Schema` annotations to DTOs:

```java
@Schema(description = "Book entity")
public class Book {
    @Schema(example = "1", accessMode = Schema.AccessMode.READ_ONLY)
    private Long id;

    @Schema(example = "Clean Code", required = true)
    private String title;
}
```

See [model-documentation.md](references/model-documentation.md) for validation patterns.

### 5. Configure Security

Set up security schemes in OpenAPI bean:

```java
@Bean
public OpenAPI customOpenAPI() {
    return new OpenAPI()
        .components(new Components()
            .addSecuritySchemes("bearer-jwt", new SecurityScheme()
                .type(SecurityScheme.Type.HTTP)
                .scheme("bearer")
                .bearerFormat("JWT")
            )
        );
}
```

Apply with `@SecurityRequirement(name = "bearer-jwt")` on controllers. See [security-configuration.md](references/security-configuration.md).

### 6. Document Pagination

Use `@ParameterObject` for Spring Data `Pageable`:

```java
@GetMapping("/paginated")
public Page<Book> findAll(@ParameterObject Pageable pageable) {
    return repository.findAll(pageable);
}
```

See [pagination-support.md](references/pagination-support.md).

### 7. Test Documentation

Access Swagger UI at `/swagger-ui/index.html` to verify documentation completeness.

### 8. Customize for Production

Configure API grouping, versioning, and build plugins. See [advanced-configuration.md](references/advanced-configuration.md) and [build-integration.md](references/build-integration.md).

## Best Practices

- **Use descriptive operation summaries**: Short (< 120 chars), clear statements
- **Document all response codes**: Include success (2xx), client errors (4xx), server errors (5xx)
- **Add examples to request/response bodies**: Use `@ExampleObject` for realistic examples
- **Leverage JSR-303 validation annotations**: SpringDoc auto-generates constraints from validation annotations
- **Use `@ParameterObject` for complex parameters**: Especially for Pageable, custom filter objects
- **Group related endpoints with `@Tag`**: Organize API by domain entities or features
- **Document security requirements**: Apply `@SecurityRequirement` where authentication needed
- **Hide internal endpoints appropriately**: Use `@Hidden` or create separate API groups
- **Customize Swagger UI for better UX**: Enable filtering, sorting, try-it-out features
- **Version your API documentation**: Include version in OpenAPI Info

## References

- **[dependency-setup.md](references/dependency-setup.md)** — Maven/Gradle dependencies and version selection
- **[configuration.md](references/configuration.md)** — Basic and advanced configuration options
- **[controller-documentation.md](references/controller-documentation.md)** — Controller and endpoint documentation patterns
- **[model-documentation.md](references/model-documentation.md)** — Entity, DTO, and validation documentation
- **[security-configuration.md](references/security-configuration.md)** — JWT, OAuth2, Basic Auth, API key configuration
- **[pagination-support.md](references/pagination-support.md)** — Pageable, Slice, and custom pagination patterns
- **[advanced-configuration.md](references/advanced-configuration.md)** — API groups, customizers, OpenAPI bean configuration
- **[exception-handling.md](references/exception-handling.md)** — Exception documentation and error response schemas
- **[build-integration.md](references/build-integration.md)** — Maven/Gradle plugins and CI/CD integration
- **[complete-examples.md](references/complete-examples.md)** — Full controller, entity, and configuration examples
- **[annotations-reference.md](references/annotations-reference.md)** — Complete annotation reference with attributes
- **[springdoc-official.md](references/springdoc-official.md)** — Official SpringDoc documentation
- **[troubleshooting.md](references/troubleshooting.md)** — Common issues and solutions

## Constraints and Warnings

- Do not expose sensitive data in API examples or schema descriptions
- Keep OpenAPI annotations minimal to avoid cluttering controller code; use global configurations when possible
- Large API definitions can impact Swagger UI performance; consider grouping APIs by domain
- Schema generation may not work correctly with complex generic types; use explicit `@Schema` annotations
- Avoid circular references in DTOs as they cause infinite recursion in schema generation
- Security schemes must be properly configured before using `@SecurityRequirement` annotations
- Hidden endpoints (`@Operation(hidden = true)`) are still visible in code and may leak through other documentation tools

## Examples

### Basic Controller Documentation

```java
@RestController
@Tag(name = "Books", description = "Book management APIs")
@RequestMapping("/api/books")
public class BookController {

    @Operation(
        summary = "Get book by ID",
        description = "Retrieves detailed information about a specific book"
    )
    @ApiResponse(responseCode = "200", description = "Book found")
    @ApiResponse(responseCode = "404", description = "Book not found")
    @GetMapping("/{id}")
    public Book getBook(@PathVariable Long id) {
        return bookService.findById(id);
    }

    @Operation(summary = "Create new book")
    @SecurityRequirement(name = "bearer-jwt")
    @PostMapping
    @ResponseStatus(HttpStatus.CREATED)
    public Book createBook(@Valid @RequestBody CreateBookRequest request) {
        return bookService.create(request);
    }
}
```

### Documented Model with Validation

```java
@Schema(description = "Book entity")
public class Book {
    @Schema(description = "Unique identifier", example = "1", accessMode = Schema.AccessMode.READ_ONLY)
    private Long id;

    @Schema(description = "Book title", example = "Clean Code", required = true)
    @NotBlank
    @Size(min = 1, max = 200)
    private String title;

    @Schema(description = "Author name", example = "Robert C. Martin")
    @NotBlank
    private String author;

    @Schema(description = "Price in USD", example = "29.99", minimum = "0")
    @NotNull
    @DecimalMin("0.0")
    private BigDecimal price;
}
```

### Security Configuration

```java
@Bean
public OpenAPI customOpenAPI() {
    return new OpenAPI()
        .info(new Info()
            .title("Book API")
            .version("1.0.0")
            .description("REST API for book management"))
        .components(new Components()
            .addSecuritySchemes("bearer-jwt", new SecurityScheme()
                .type(SecurityScheme.Type.HTTP)
                .scheme("bearer")
                .bearerFormat("JWT"))
            .addSecuritySchemes("api-key", new SecurityScheme()
                .type(SecurityScheme.Type.APIKEY)
                .in(SecurityScheme.In.HEADER)
                .name("X-API-Key")));
}
```

## Related Skills

- `spring-boot-rest-api-standards` — REST API design standards
- `spring-boot-dependency-injection` — Dependency injection patterns
- `unit-test-controller-layer` — Testing REST controllers
- `spring-boot-actuator` — Production monitoring and management

## External Resources

- [SpringDoc Official Documentation](https://springdoc.org/)
- [OpenAPI 3.0 Specification](https://swagger.io/specification/)
- [Swagger UI Configuration](https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/)

© giuseppe-trisciuoglio · MIT · giuseppe-trisciuoglio/developer-kit

Похожие скиллы

Всё по теме «Бэкенд и API» →
302-frameworks-spring-boot-rest Juan Antonio Breña Moral Скилл для проектирования и разбора REST API на Spring Boot: методы, коды ответов, DTO, версионирование, пагинация, ошибки по RFC 7807. CX Codex +1 392установок api-reference-documentation aj-geddes Скилл помогает агенту собрать справочник по API: эндпоинты, аутентификация, примеры запросов и ответов, спецификация OpenAPI. CX Codex +1 494установок spring-boot-engineer https://github.com/Jeffallan Разворачивает архитектуру Spring Boot 3.x, контроллеры, репозитории Spring Data JPA и правила Spring Security 6. Пригодится при сборке REST API, реактивных сервисов и микросервисов на Java. CX Codex +1 8 400установок spring-boot Mindrally Скилл задаёт агенту стиль кода на Spring Boot: REST-контроллеры, тесты, безопасность, сборка и деплой. Пригодится, когда проект на Java и хочется единообразия. CX Codex +1 832установок spring-boot-development manutej Скилл для ИИ-агента, который подсказывает, как писать Spring Boot: авто-конфигурация, внедрение зависимостей, REST-контроллеры, Spring Data и Spring Security. CX Codex +1 534установок spring-boot-patterns decebals Скилл задаёт структуру Spring Boot-проекта и шаблоны для контроллеров, сервисов и репозиториев. Пригодится, когда агент пишет новый код или разбирает чужой. CX Codex +1 322установок

Из того же набора93

spring-data-jpa Шаблоны и правила для слоя персистентности на Spring Data JPA: создание репозиториев, пагинация, аудит сущностей и настройка транзакций. CX Codex +1 4 100установок spring-boot-security-jwt Скилл с готовыми шаблонами JWT-аутентификации для Spring Boot 3.5.x: генерация токенов через JJWT, фильтры, RBAC и OAuth2. CX Codex +1 4 100установок drawio-logical-diagrams Генерирует файлы .drawio в нативном формате XML для логических схем, архитектуры систем, нотаций BPMN и UML. Пригодится для визуализации логики без привязки к конкретным облачным сервисам. CX Codex +1 4 000установок clean-architecture Помогает строить Java 21+ приложения на Spring Boot 3.5+ с чистыми слоями, портами и адаптерами. Нужен при рефакторинге связанного кода или проектировании доменной модели. CX Codex +1 4 000установок nextjs-app-router Даёт паттерны и примеры для Next.js 16+ с App Router: от Server Components до route.ts и кэширования. CX Codex +1 3 900установок spring-boot-crud-patterns Скилл собирает полный CRUD-слой для сервисов на Spring Boot 3: агрегаты, JPA-репозитории, DTO и REST-контроллеры по feature-архитектуре. CX Codex +1 3 900установок typescript-security-review Проверяет код TypeScript и Node.js на уязвимости OWASP, утечки секретов и ошибки в настройке JWT или CORS. Пригодится перед релизом или при аудите авторизации в Express, NestJS и Next.js. CX Codex +1 3 900установок prompt-engineering Скилл помогает писать, отлаживать и проверять промпты для LLM. Пригодится для few-shot-примеров, системных инструкций и шаблонов. CX Codex +1 3 900установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой