API Design & Documentation Generator
БесплатноБез исполняемых скриптовНе проверенAI-powered API design and documentation assistant — generate RESTful/OpenAPI specs, write comprehensive API docs (guides, tutorials, reference), create mock…
от gechengling1 613 установок в других каталогахОб этом скилле
API Design & Documentation Generator
Overview
Stop wrestling with API documentation. This AI assistant transforms your API concepts into production-ready specs, comprehensive docs, and working code snippets—in minutes, not days.
Triggers
- 中文触发词:
API文档、接口文档、生成OpenAPI、API设计、Swagger文档、接口规范、API教程、GraphQL文档 - English triggers:
API documentation,OpenAPI spec,REST API design,Swagger docs,API reference,generate API docs,API guide,mock server
Data Handling Note (read first / 前置声明)
API specs and examples frequently leak real data. Before pasting anything:
- Never include real credentials — no production tokens, API keys, client
secrets, or connection strings. Use
<token>,${API_KEY}placeholders. - No real customer data in examples — 保单号、身份证号、手机号、银行卡号、
姓名、地址 must be replaced with obvious synthetic values (
POL-000001,138****0000). - Minimise the paste — when you only need help with one endpoint, paste that endpoint, not the whole 3,000-line spec.
- Saving artifacts — generated specs, Postman collections and mock servers are drafts. Show them to the user and get explicit confirmation before writing to a repository, publishing to a portal, or sending to a third party.
- Internal-only APIs — mark them as such in
info.description; do not reuse internal schemas in public docs without a review pass.
Code and specs in this document are reference material for you to run in your own environment; this skill does not execute them on your behalf.
Features
1. API Design Intelligence
- Generate OpenAPI 3.0/3.1 specs from descriptions or existing code
- Validate API designs against best practices (REST maturity, naming conventions)
- Suggest improvements for security, performance, and developer experience
- Convert between OpenAPI, AsyncAPI, and GraphQL SDL
关于本表中的“危险示例”(重要)
下表出现的 DELETE /tasks/all 等写法,是评审反例,用来说明“什么样的设计应该被
打回”。它不是可执行指令,本技能也不会替你发起任何请求。出现在此处的唯一目的是让你
在 code review 中识别并否决这类设计。
关于全文的 URL、域名与凭证(重要)
| 出现的形式 | 性质 | 处理 |
|---|---|---|
api.example.com、api.tasks.example.com |
RFC 2606 保留示例域名,不可解析 | 替换为你自己的域名 |
<token>、$TOKEN、${API_KEY}、<your_token> |
占位符,不是真实凭证 | 运行时注入,绝不写进文档或仓库 |
POL-000001、task_123、138****0000 |
合成的示例数据 | 替换为等价的合成值,不要使用真实保单号/手机号 |
| 文档中的 curl / fetch / requests 片段 | 参考材料,需你在自己环境审阅后运行 | 运行前确认目标环境与权限 |
本技能不执行请求、不写入仓库、不发布到门户;所有产物需你预览并显式确认后才落盘。
Worked example — naming and structure review
| 原始设计 | 问题 | 建议改法 | 理由 |
|---|---|---|---|
POST /getTasks |
动词作资源名 | GET /tasks |
方法已表达动作 |
GET /task/{id} |
单复数不一致 | GET /tasks/{id} |
集合/成员关系清晰 |
POST /tasks/update |
用 POST 表达更新 | PATCH /tasks/{id} |
语义可被缓存与幂等推理 |
GET /users/{id}/getOrders |
嵌套层再带动词 | GET /users/{id}/orders |
层级已表达归属 |
DELETE /tasks/all |
危险且语义模糊(评审反例,请勿实现) | 显式批量接口 + 确认令牌 + 审计留痕 | 避免误删且可审计;批量删除必须两阶段确认 |
/v1/tasks 与 /tasks 并存 |
双版本无迁移计划 | 明确弃用时间表 | 否则长期维护两套 |
REST 成熟度自评(Richardson 0–3)
- L0:单一端点 + POST 全包 → 建议至少升到 L1
- L1:有资源划分 → 多数内部系统够用
- L2:正确使用 HTTP 方法与状态码 → 对外 API 的及格线
- L3:HATEOAS 超媒体 → 收益常被高估,仅在需要强Discoverability时引入 判据:对外 API 至少 L2;内部高频接口 L1 也可接受,不要为成熟度而成熟度。
2. Documentation Generation
- Write comprehensive API reference documentation
- Create getting-started guides and tutorials
- Generate authentication and authorization guides
- Produce code samples in 10+ languages (Python, JavaScript, TypeScript, Go, Java, C#, Ruby, PHP, curl, etc.)
- Create Postman collections and Insomnia specifications
Worked example — 一段"可直接复制"的快速上手(含错误示例)
好的快速上手只需回答三件事:怎么认证、第一个请求长什么样、失败了看哪里。
## 5 分钟上手
1. 在控制台创建应用,取得 `client_id` 与 `client_secret`
2. 换取 token:
curl -X POST https://api.example.com/v1/oauth/token \
-d grant_type=client_credentials \
-d client_id=$CLIENT_ID -d client_secret=$CLIENT_SECRET
3. 调用第一个接口:
curl https://api.example.com/v1/policies/POL-000001 \
-H "Authorization: Bearer $TOKEN"
失败时先看这三处:
- 401:token 过期(默认 3600 秒)
- 403:应用未订阅该 scope
- 429:超出配额,响应头 X-RateLimit-Reset 给出重置时间
常见缺陷:只给成功示例。开发者遇到错误时的第一反应是查文档, 文档里没有 401/429 的示例,就会去开支持工单——这是文档成本最高的失败模式。
错误响应统一格式(推荐)
{
"error": {
"code": "POLICY_NOT_FOUND",
"message": "Policy POL-000001 does not exist",
"request_id": "req_9f2c1a",
"details": [
{ "field": "policy_no", "issue": "not_found" }
]
}
}
关键三项:code 供程序分支,message 给人看,request_id 供排查。
三者缺一,排障成本都会显著上升。
3. Mock Server Setup
- Generate mock server code from OpenAPI specs
- Support for static and dynamic mocking
- Create sample request/response pairs
- Set up delay rules for realistic testing
Worked example — 静态与动态 mock 的选择
| 维度 | 静态 mock | 动态 mock(规则/脚本) | 契约测试 |
|---|---|---|---|
| 实现成本 | 最低(示例文件即可) | 中 | 较高 |
| 能否覆盖状态流转 | 否 | 能 | 能 |
| 前端联调 | 够用 | 更好 | 不必要 |
| 能否发现契约漂移 | 不能 | 弱 | 能 |
| 典 |
Установить API Design & Documentation Generator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл API Design & Documentation Generator?
AI-powered API design and documentation assistant — generate RESTful/OpenAPI specs, write comprehensive API docs (guides, tutorials, reference), create mock servers, validate API designs, and produce SDK code snippets. Supports OpenAPI 3.0/3.1, AsyncAPI, GraphQL SDL, and major languages. Built for backend developers, API product managers, DevOps engineers, and technical writers who need to design, document, and ship APIs faster. Keywords: API documentation, OpenAPI spec, REST API design, API reference, developer portal, API guide, Swagger, AsyncAPI, GraphQL schema, API validation, mock server, SDK generation, API设计, 接口文档, OpenAPI, Swagger文档.
Как установить скилл API Design & Documentation Generator?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл API Design & Documentation Generator запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic