openapi-spec-generator
Skill này làm gì
Công cụ này tạo một tài liệu kỹ thuật (gọi là đặc tả OpenAPI hoặc Swagger) mô tả cách một API (dịch vụ mà phần mềm dùng để giao tiếp) hoạt động. Nó có thể tạo tài liệu này từ mô tả bằng ngôn ngữ tự nhiên, mã nguồn hoặc một tài liệu chưa hoàn chỉnh.
Khi nào nên dùng
- ✓Khi bạn cần mô tả một API cho các lập trình viên khác.
- ✓Khi tạo tài liệu kỹ thuật cho một dịch vụ web.
- ✓Khi bạn đã có bản nháp API và muốn chuyển nó thành tiêu chuẩn.
Liên kết skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/openapi-spec-generator/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tạo một đặc tả OpenAPI cho một API quản lý công việc, với các endpoint để liệt kê, tạo và cập nhật công việc. Dùng định dạng YAML.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
AI phân tích mô tả hoặc mã của bạn để hiểu chi tiết API, như dữ liệu nó dùng và các hành động nó có thể thực hiện. Sau đó, nó lắp ráp một tài liệu kỹ thuật hoàn chỉnh theo chuẩn OpenAPI hoặc Swagger.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
OpenAPI / Swagger Specification Generator
When to Use
Use this skill when you need generate complete, production-ready OpenAPI 3.x and Swagger 2.0 specifications from natural language descriptions, code, or partial specs. Use this skill whenever the user mentions OpenAPI, Swagger, API spec, REST API documentation, YAML/JSON API schema, endpoint documentation, API...
Generate complete, valid OpenAPI 3.x or Swagger 2.0 specifications from descriptions, code, or partial specs.
Workflow
Step 1 — Gather Context
Before writing any YAML/JSON, ask (or infer from context) the following:
| Question | Why it matters |
|---|---|
| OpenAPI 3.x or Swagger 2.0? | Different info, servers/host, components/definitions structure |
| Output format: YAML or JSON? | YAML default unless user specifies JSON |
| What does this API do? | Sets info.title, info.description, tags |
| List of endpoints (or code to extract from)? | Core paths object |
| Authentication type(s)? | securitySchemes — see reference |
| Common data models or entities? | components/schemas / definitions |
| Any existing partial spec to extend? | Merge rather than overwrite |
If the user provides code (Express routes, FastAPI, Django URLs, Spring controllers, etc.), extract endpoints automatically — do not ask what the user already told you.
Step 2 — Build the Spec
Follow the structure guide for the chosen version. Always produce a complete, valid spec — never leave placeholder comments like # TODO: add schema.
OpenAPI 3.x Skeleton
openapi: "3.1.0"
info:
title: <API Title>
version: "1.0.0"
description: <Short description>
contact:
name: <Team or Author>
email: <contact@example.com>
servers:
- url: https://api.example.com/v1
description: Production
- url: https://staging-api.example.com/v1
description: Staging
tags:
- name: <Tag>
description: <Tag description>
paths:
/resource:
get:
summary: List resources
operationId: listResources
tags: [<Tag>]
parameters: []
responses:
"200":
description: Success
content:
application/json:
schema:
$ref: "#/components/schemas/ResourceList"
example:
items: []
total: 0
"401":
$ref: "#/components/responses/Unauthorized"
"500":
$ref: "#/components/responses/InternalError"
security:
- BearerAuth: []
components:
schemas: {}
responses:
Unauthorized:
description: Authentication required
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
InternalError:
description: Internal server error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
securitySchemes: {}
Swagger 2.0 Skeleton
swagger: "2.0"
info:
title: <API Title>
version: "1.0.0"
description: <Short description>
host: api.example.com
basePath: /v1
schemes: [https]
consumes: [application/json]
produces: [application/json]
tags: []
paths: {}
definitions: {}
securityDefinitions: {}
Step 3 — Schemas and Models
- Always use
$reffor any schema used in more than one place. - Include
exampleorexampleson every schema and response body. - Mark required fields with the
requiredarray. - Use
nullable: true(OAS 3.0) orx-nullable: true(Swagger 2.0) for optional nullable fields. - Prefer
formatkeywords:int32,int64,float,date,date-time,uuid,email,uri,byte,binary.
Common schema patterns:
# Pagination wrapper
PagedResult:
type: object
required: [items, total, page, pageSize]
properties:
items:
type: array
items:
$ref: "#/components/schemas/Resource"
total:
type: integer
format: int64
example: 100
page:
type: integer
format: int32
example: 1
pageSize:
type: integer
format: int32
example: 20
# Standard error
Error:
type: object
required: [code, message]
properties:
code:
type: string
example: RESOURCE_NOT_FOUND
message:
type: string
example: The requested resource was not found.
details:
type: object
additionalProperties: true
# Timestamps mixin (use allOf)
Timestamps:
type: object
properties:
createdAt:
…
Câu hỏi thường gặp
OpenAPI/Swagger là gì?
Đây là các tiêu chuẩn để mô tả API. Chúng giúp tài liệu hóa cách một dịch vụ web hoạt động, giúp các phần mềm khác nhau dễ tích hợp hơn.
Khác nhau giữa OpenAPI và Swagger là gì?
OpenAPI là tên của tiêu chuẩn hiện tại. Swagger là một công cụ phổ biến triển khai tiêu chuẩn này và cũng dùng để chỉ các phiên bản cũ hơn của tiêu chuẩn.
Tôi có cần biết lập trình để dùng cái này không?
Không nhất thiết. Bạn có thể mô tả API bằng ngôn ngữ tự nhiên, và công cụ sẽ chuyển nó thành tài liệu kỹ thuật.
Chi tiết
Mô tả gốc của tác giả
Generate complete, production-ready OpenAPI 3.x and Swagger 2.0 specifications from natural language descriptions, code, or partial specs.
Độ phổ biến
- Sao GitHub
- 48k
- Vị trí xếp hạng
- #5377
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
00-andruia-consultant
48kGiúp agent của bạn bắt đầu hoặc cải thiện các dự án AI. Phân tích mã, gợi ý công cụ và lập kế hoạch hành động bằng tiếng Tây Ban Nha.
007
48kCho phép agent của bạn thực hiện kiểm toán bảo mật và mô hình hóa mối đe dọa. Hữu ích để bảo vệ dự án khỏi các cuộc tấn công và lỗ hổng.
10-andruia-skill-smith
48kGiúp agent của bạn tạo hoặc cải thiện các công cụ AI. Xác định cách công cụ hoạt động, viết tài liệu và kiểm tra cấu trúc.
20-andruia-niche-intelligence
48kGiúp agent của bạn tạo bản tóm tắt về một ngành cụ thể. Hữu ích để hiểu bối cảnh, quy tắc, cách người dùng tương tác và rủi ro của dự án.
Skill tương tự
api-connector-builder
280kGiúp agent của bạn xây dựng kết nối API mới theo đúng mẫu đã có, dùng khi bạn cần thêm một tích hợp mà không tạo cách làm mới.
api-design
280kGiúp agent của bạn thiết kế REST API theo các thực hành tốt nhất, hữu ích để định nghĩa cách API giao tiếp, hiển thị lỗi và tổ chức dữ liệu.
backend-patterns
280kGiúp agent của bạn với các mẫu kiến trúc phía máy chủ và tối ưu cơ sở dữ liệu, hữu ích khi xây dựng hoặc rà soát code chạy trên máy chủ.