ql-link/linkrag-service/swagger-annotation
Claude Code and agent skill by ql-link/linkrag-service
- community
Checking that the SKILL.md file is still in the repository.
SpringDoc OpenAPI 3 中文注解生成工作流。为 Spring Boot Controller 和 DTO 生成符合企业级规范的中文 Swagger 注解(@Tag、@Operation、@Parameter、@Schema)。
Install
npx vskill@latest install ql-link/linkrag-service/swagger-annotationSKILL.md
SpringDoc OpenAPI 3 注解规范
核心原则
| 原则 | 说明 | |
|---|---|---|
| 中文文档 | 所有 name、description、summary、example 必须为中文 | |
| 自解释性 | 注解后的 API 文档页面对前后端协作方无需额外说明 | |
| 最小侵入 | 只补缺失注解,不修改现有业务逻辑 |
注解包路径
项目使用 OpenAPI 3 注解(io.swagger.v3.oas.annotations.*),与 Knife4j UI 配合使用:
1. Controller 注解
1.1 类级别:@Tag
1.2 方法级别:@Operation
| 参数 | 说明 | 是否必填 | |
|---|---|---|---|
summary | 一句话描述接口功能,显示在 API 列表标题处 | 必填 | |
description | 业务语义、适用场景、注意事项 | 建议填写 |
1.3 参数级别:@Parameter
用于 @RequestParam、@PathVariable、@RequestHeader:
@RequestBody 参数不需要 @Parameter,在 DTO 的 @Schema 上标注即可。
2. DTO 注解
2.1 Response DTO / Request DTO
| 注解位置 | 说明 | |
|---|---|---|
类上 @Schema(description="...") | 描述该 DTO 的业务用途 | |
字段上 @Schema(description="...", example="...") | 描述字段含义,枚举字段必须列出所有可能值 |
2.2 枚举/状态字段
description 中必须列举所有可能值及含义:
3. 典型示例(参考 UsageController)
已有完整注解的 Controller 参考 UsageController.java,已有 DTO 注解参考 DatasetDTO.java。
缺少注解的 Controller 示例:OssFileController.java(仅有 @RestController,无 @Tag / @Operation)。
4. 执行流程
步骤 1:扫描目标
识别目标文件(Controller 或 DTO),列出:
- 哪些 Controller 缺
@Tag - 哪些方法缺
@Operation - 哪些参数缺
@Parameter - 哪些 DTO 缺
@Schema
步骤 2:逐层标注
按顺序:类级 @Tag → 方法 @Operation → 参数 @Parameter → DTO @Schema
步骤 3:验证
5. 禁止事项
| 禁止项 | 说明 | |
|---|---|---|
| 英文 description / summary | 本项目约定全中文文档 | |
方法无 @Operation(summary) | Knife4j 列表中该接口无可读标题 | |
| 枚举字段不列举可能值 | 前端无法理解合法取值范围 | |
混用 Swagger 2 注解(io.swagger.annotations.*) | 项目已统一使用 OpenAPI 3 注解(io.swagger.v3.oas.annotations.*) |
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.ai/skills/swagger-annotation/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ql-link/linkrag-service/swagger-annotation)