원클릭으로
api-doc-generator
// Generate API documentation from source code, supporting REST APIs, GraphQL, and various documentation formats.
// Generate API documentation from source code, supporting REST APIs, GraphQL, and various documentation formats.
Help debug code by analyzing error messages, identifying root causes, and providing fix suggestions.
Automatically generate unit tests based on source code, supporting multiple languages and testing frameworks.
Smart code review skill that helps review code quality, identify potential issues, and provide improvement suggestions.
Git commit message generator that creates conventional commit messages based on code changes.
| name | api-doc-generator |
| description | Generate API documentation from source code, supporting REST APIs, GraphQL, and various documentation formats. |
| license | CC0-1.0 |
根据代码生成 API 文档,支持 REST API、GraphQL 及多种文档格式。
Generate API documentation from source code, supporting REST APIs, GraphQL, and various documentation formats.
当用户请求以下操作时使用此 skill:
每个 API 端点应包含:
支持以下文档格式:
templates/api-doc.md 模板Use templates/api-doc.md for Markdown output format.
## API 文档 / API Documentation
### 端点概览 / Endpoint Overview
| 方法 | 路径 | 描述 |
|------|------|------|
| GET | /api/resource | 获取资源列表 |
### 详细说明 / Details
#### [方法] /path
**描述**: ...
**请求参数**:
| 参数 | 类型 | 必需 | 描述 |
|------|------|------|------|
**请求示例**:
```json
{}
响应示例:
{}
## Examples
### 输入 / Input
```python
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
app = FastAPI()
class User(BaseModel):
id: int
name: str
email: str
@app.get("/users/{user_id}")
async def get_user(user_id: int) -> User:
"""Get a user by ID."""
if user_id <= 0:
raise HTTPException(status_code=404, detail="User not found")
return User(id=user_id, name="John", email="john@example.com")
@app.post("/users")
async def create_user(user: User) -> User:
"""Create a new user."""
return user
| 方法 | 路径 | 描述 |
|---|---|---|
| GET | /users/{user_id} | 根据 ID 获取用户信息 |
| POST | /users | 创建新用户 |
描述: 根据用户 ID 获取用户信息
路径参数:
| 参数 | 类型 | 必需 | 描述 |
|---|---|---|---|
| user_id | integer | ✅ | 用户唯一标识符 |
响应 200 - 成功:
{
"id": 1,
"name": "John",
"email": "john@example.com"
}
响应 404 - 未找到:
{
"detail": "User not found"
}
描述: 创建新用户
请求体:
| 字段 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer | ✅ | 用户 ID |
| name | string | ✅ | 用户姓名 |
| string | ✅ | 用户邮箱 |
请求示例:
{
"id": 1,
"name": "John",
"email": "john@example.com"
}
响应 200 - 成功:
{
"id": 1,
"name": "John",
"email": "john@example.com"
}