api-documentation-generator by claudiodearaujo/izacenter
npx skills add https://github.com/claudiodearaujo/izacenter --skill api-documentation-generator自动从您的代码库生成清晰、全面的 API 文档。此技能可帮助您创建专业的文档,包括端点描述、请求/响应示例、身份验证详情、错误处理和使用指南。
非常适合 REST API、GraphQL API 和 WebSocket API。
首先,我将检查您的 API 代码库以了解:
对于每个端点,我将创建包含以下内容的文档:
端点详情:
请求规范:
响应规范:
代码示例:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
我将包括:
清晰的错误文档,包括:
在可能的情况下,我将提供:
## 创建用户
创建一个新的用户账户。
**端点:** `POST /api/v1/users`
**身份验证:** 必需(Bearer token)
**请求体:**
\`\`\`json
{
"email": "user@example.com", // 必需:有效的电子邮件地址
"password": "SecurePass123!", // 必需:至少 8 个字符,包含 1 个大写字母,1 个数字
"name": "John Doe", // 必需:2-50 个字符
"role": "user" // 可选:"user" 或 "admin"(默认:"user")
}
\`\`\`
**成功响应(201 Created):**
\`\`\`json
{
"id": "usr_1234567890",
"email": "user@example.com",
"name": "John Doe",
"role": "user",
"createdAt": "2026-01-20T10:30:00Z",
"emailVerified": false
}
\`\`\`
**错误响应:**
- `400 Bad Request` - 无效的输入数据
\`\`\`json
{
"error": "VALIDATION_ERROR",
"message": "Invalid email format",
"field": "email"
}
\`\`\`
- `409 Conflict` - 邮箱已存在
\`\`\`json
{
"error": "EMAIL_EXISTS",
"message": "An account with this email already exists"
}
\`\`\`
- `401 Unauthorized` - 缺少或无效的身份验证令牌
**示例请求(cURL):**
\`\`\`bash
curl -X POST https://api.example.com/api/v1/users \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "SecurePass123!",
"name": "John Doe"
}'
\`\`\`
**示例请求(JavaScript):**
\`\`\`javascript
const response = await fetch('https://api.example.com/api/v1/users', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: 'user@example.com',
password: 'SecurePass123!',
name: 'John Doe'
})
});
const user = await response.json();
console.log(user);
\`\`\`
**示例请求(Python):**
\`\`\`python
import requests
response = requests.post(
'https://api.example.com/api/v1/users',
headers={
'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'
},
json={
'email': 'user@example.com',
'password': 'SecurePass123!',
'name': 'John Doe'
}
)
user = response.json()
print(user)
\`\`\`
## 用户查询
通过 ID 获取用户信息。
**查询:**
\`\`\`graphql
query GetUser($id: ID!) {
user(id: $id) {
id
email
name
role
createdAt
posts {
id
title
publishedAt
}
}
}
\`\`\`
**变量:**
\`\`\`json
{
"id": "usr_1234567890"
}
\`\`\`
**响应:**
\`\`\`json
{
"data": {
"user": {
"id": "usr_1234567890",
"email": "user@example.com",
"name": "John Doe",
"role": "user",
"createdAt": "2026-01-20T10:30:00Z",
"posts": [
{
"id": "post_123",
"title": "My First Post",
"publishedAt": "2026-01-21T14:00:00Z"
}
]
}
}
}
\`\`\`
**错误:**
\`\`\`json
{
"errors": [
{
"message": "User not found",
"extensions": {
"code": "USER_NOT_FOUND",
"userId": "usr_1234567890"
}
}
]
}
\`\`\`
## 身份验证
所有 API 请求都需要使用 Bearer 令牌进行身份验证。
### 获取令牌
**端点:** `POST /api/v1/auth/login`
**请求:**
\`\`\`json
{
"email": "user@example.com",
"password": "your-password"
}
\`\`\`
**响应:**
\`\`\`json
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 3600,
"refreshToken": "refresh_token_here"
}
\`\`\`
### 使用令牌
在 Authorization 头中包含令牌:
\`\`\`
Authorization: Bearer YOUR_TOKEN
\`\`\`
### 令牌过期
令牌在 1 小时后过期。使用刷新令牌获取新的访问令牌:
**端点:** `POST /api/v1/auth/refresh`
**请求:**
\`\`\`json
{
"refreshToken": "refresh_token_here"
}
\`\`\`
简介
身份验证
快速开始
端点
数据模型
错误处理
速率限制
变更日志
SDK 和工具
症状: 示例无法工作,参数错误,端点返回不同的数据 解决方案:
症状: 用户不知道如何处理错误,支持工单增加 解决方案:
症状: 用户无法开始使用,挫败感增加 解决方案:
症状: 用户发送无效请求,出现验证错误 解决方案:
生成交互式文档:
openapi: 3.0.0
info:
title: My API
version: 1.0.0
paths:
/users:
post:
summary: Create a new user
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUserRequest'
导出集合以便于测试:
{
"info": {
"name": "My API",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Create User",
"request": {
"method": "POST",
"url": "{{baseUrl}}/api/v1/users"
}
}
]
}
@doc-coauthoring - 用于协作编写文档@copywriting - 用于清晰、用户友好的描述@test-driven-development - 用于确保 API 行为与文档匹配@systematic-debugging - 用于故障排除 API 问题专业提示: 尽可能让您的 API 文档贴近代码。使用从代码注释生成文档的工具,以确保它们保持同步!
每周安装数
1
代码仓库
GitHub 星标数
1
首次出现
今天
安全审计
安装于
zencoder1
amp1
cline1
openclaw1
opencode1
cursor1
Automatically generate clear, comprehensive API documentation from your codebase. This skill helps you create professional documentation that includes endpoint descriptions, request/response examples, authentication details, error handling, and usage guidelines.
Perfect for REST APIs, GraphQL APIs, and WebSocket APIs.
First, I'll examine your API codebase to understand:
For each endpoint, I'll create documentation including:
Endpoint Details:
Request Specification:
Response Specification:
Code Examples:
I'll include:
Clear error documentation including:
Where possible, I'll provide:
## Create User
Creates a new user account.
**Endpoint:** `POST /api/v1/users`
**Authentication:** Required (Bearer token)
**Request Body:**
\`\`\`json
{
"email": "user@example.com", // Required: Valid email address
"password": "SecurePass123!", // Required: Min 8 chars, 1 uppercase, 1 number
"name": "John Doe", // Required: 2-50 characters
"role": "user" // Optional: "user" or "admin" (default: "user")
}
\`\`\`
**Success Response (201 Created):**
\`\`\`json
{
"id": "usr_1234567890",
"email": "user@example.com",
"name": "John Doe",
"role": "user",
"createdAt": "2026-01-20T10:30:00Z",
"emailVerified": false
}
\`\`\`
**Error Responses:**
- `400 Bad Request` - Invalid input data
\`\`\`json
{
"error": "VALIDATION_ERROR",
"message": "Invalid email format",
"field": "email"
}
\`\`\`
- `409 Conflict` - Email already exists
\`\`\`json
{
"error": "EMAIL_EXISTS",
"message": "An account with this email already exists"
}
\`\`\`
- `401 Unauthorized` - Missing or invalid authentication token
**Example Request (cURL):**
\`\`\`bash
curl -X POST https://api.example.com/api/v1/users \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "SecurePass123!",
"name": "John Doe"
}'
\`\`\`
**Example Request (JavaScript):**
\`\`\`javascript
const response = await fetch('https://api.example.com/api/v1/users', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: 'user@example.com',
password: 'SecurePass123!',
name: 'John Doe'
})
});
const user = await response.json();
console.log(user);
\`\`\`
**Example Request (Python):**
\`\`\`python
import requests
response = requests.post(
'https://api.example.com/api/v1/users',
headers={
'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'
},
json={
'email': 'user@example.com',
'password': 'SecurePass123!',
'name': 'John Doe'
}
)
user = response.json()
print(user)
\`\`\`
## User Query
Fetch user information by ID.
**Query:**
\`\`\`graphql
query GetUser($id: ID!) {
user(id: $id) {
id
email
name
role
createdAt
posts {
id
title
publishedAt
}
}
}
\`\`\`
**Variables:**
\`\`\`json
{
"id": "usr_1234567890"
}
\`\`\`
**Response:**
\`\`\`json
{
"data": {
"user": {
"id": "usr_1234567890",
"email": "user@example.com",
"name": "John Doe",
"role": "user",
"createdAt": "2026-01-20T10:30:00Z",
"posts": [
{
"id": "post_123",
"title": "My First Post",
"publishedAt": "2026-01-21T14:00:00Z"
}
]
}
}
}
\`\`\`
**Errors:**
\`\`\`json
{
"errors": [
{
"message": "User not found",
"extensions": {
"code": "USER_NOT_FOUND",
"userId": "usr_1234567890"
}
}
]
}
\`\`\`
## Authentication
All API requests require authentication using Bearer tokens.
### Getting a Token
**Endpoint:** `POST /api/v1/auth/login`
**Request:**
\`\`\`json
{
"email": "user@example.com",
"password": "your-password"
}
\`\`\`
**Response:**
\`\`\`json
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 3600,
"refreshToken": "refresh_token_here"
}
\`\`\`
### Using the Token
Include the token in the Authorization header:
\`\`\`
Authorization: Bearer YOUR_TOKEN
\`\`\`
### Token Expiration
Tokens expire after 1 hour. Use the refresh token to get a new access token:
**Endpoint:** `POST /api/v1/auth/refresh`
**Request:**
\`\`\`json
{
"refreshToken": "refresh_token_here"
}
\`\`\`
Introduction
Authentication
Quick Start
Endpoints
Data Models
Error Handling
Rate Limiting
Changelog
Symptoms: Examples don't work, parameters are wrong, endpoints return different data Solution:
Symptoms: Users don't know how to handle errors, support tickets increase Solution:
Symptoms: Users can't get started, frustration increases Solution:
Symptoms: Users send invalid requests, validation errors Solution:
Generate interactive documentation:
openapi: 3.0.0
info:
title: My API
version: 1.0.0
paths:
/users:
post:
summary: Create a new user
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUserRequest'
Export collection for easy testing:
{
"info": {
"name": "My API",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Create User",
"request": {
"method": "POST",
"url": "{{baseUrl}}/api/v1/users"
}
}
]
}
@doc-coauthoring - For collaborative documentation writing@copywriting - For clear, user-friendly descriptions@test-driven-development - For ensuring API behavior matches docs@systematic-debugging - For troubleshooting API issuesPro Tip: Keep your API documentation as close to your code as possible. Use tools that generate docs from code comments to ensure they stay in sync!
Weekly Installs
1
Repository
GitHub Stars
1
First Seen
Today
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
zencoder1
amp1
cline1
openclaw1
opencode1
cursor1
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
29,800 周安装
Docnify自动化:通过Rube MCP和Composio工具包实现文档操作自动化
1 周安装
Docmosis自动化集成指南:通过Rube MCP与Composio实现文档生成自动化
1 周安装
Dictionary API自动化教程:通过Rube MCP和Composio实现词典API操作自动化
1 周安装
detrack-automation:自动化追踪技能,集成Claude AI提升开发效率
1 周安装
Demio自动化工具包:通过Rube MCP和Composio实现Demio操作自动化
1 周安装
Deel自动化工具:通过Rube MCP与Composio实现HR与薪资操作自动化
1 周安装
SDKs and Tools