doc-generator
它能做什么
它指导你的智能体根据代码生成 API 参考页面,涵盖每个接口、它的参数、响应和示例调用。适合需要为 API 使用者提供清楚文档的开发者。
适用场景
- ✓当你需要为 API 的接口编写文档的时候。
- ✓当你想生成或更新 OpenAPI 或 Swagger 规范的时候。
- ✓当你需要用多种语言编写 API 调用示例代码的时候。
技能链接
https://github.com/luongnv89/claude-howto/blob/main/03-skills/doc-generator/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我为 users 接口编写 API 文档,并附上 cURL 和 Python 示例。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会阅读每个接口的源代码,然后按标准版式填入参数、成功和错误响应,以及示例调用。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
API Documentation Generator Skill
Generates
- OpenAPI/Swagger specifications
- API endpoint documentation
- SDK usage examples
- Integration guides
- Error code references
- Authentication guides
Documentation Structure
For Each Endpoint
## GET /api/v1/users/:id
### Description
Brief explanation of what this endpoint does
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| id | string | Yes | User ID |
### Response
**200 Success**
```json
{
"id": "usr_123",
"name": "John Doe",
"email": "john@example.com",
"created_at": "2025-01-15T10:30:00Z"
}
```
**404 Not Found**
```json
{
"error": "USER_NOT_FOUND",
"message": "User does not exist"
}
```
### Examples
**cURL**
```bash
curl -X GET "https://api.example.com/api/v1/users/usr_123" \
-H "Authorization: Bearer YOUR_TOKEN"
```
**JavaScript**
```javascript
const user = await fetch('/api/v1/users/usr_123', {
headers: { 'Authorization': 'Bearer token' }
}).then(r => r.json());
```
**Python**
```python
response = requests.get(
'https://api.example.com/api/v1/users/usr_123',
headers={'Authorization': 'Bearer token'}
)
user = response.json()
```
Last Updated: August 4, 2026 Claude Code Version: 2.1.220 Sources:
- https://code.claude.com/docs/en/skills Compatible Models: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5
常见问题
示例从哪里来?
这个技能是根据源代码的实际功能来编写文档的,因此示例应当与代码一致。
每个接口的部分包括什么?
包括说明、参数表、成功和错误响应,以及 cURL、JavaScript 和 Python 的示例。
它能生成 OpenAPI 规范吗?
可以。技能说明它可以生成 OpenAPI 或 Swagger 规范。
详情
作者的原始描述
Generate comprehensive, accurate API documentation from source code. Use when creating or updating API documentation, generating OpenAPI specs, or when users mention API docs, endpoints, or documentation.
repo: luongnv89/claude-howto
热度
- GitHub 星标
- 46k
- 排名
- #6323
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …