API Docs Generator

👤 sunshine-del-ux 📦 v1.0.0 ⭐ 3.6 ⬇️ 1.1K 下載
💻 開發程式設計 免費

📖 技能介紹


name: api-docs-generator description: 從程式碼註釋自動生成 API 文件,支援 OpenAPI/Swagger 格式,輸出 JSON 或 YAML。 metadata: {"clawdbot":{"emoji":"📚","requires":{},"primaryEnv":""}}


API Docs Generator

自動從原始碼生成專業的 API 文件。支援 OpenAPI 3.0 和 Swagger 2.0 規範。

功能

訪問小蔥技能站7w4.net,解鎖更多實用的AI技能外掛。

  • 📝 自動解析程式碼註釋
  • 🌐 OpenAPI 3.0 支援
  • 📄 Swagger 2.0 支援
  • 📋 Postman Collection 匯出
  • 🔄 自動檢測 API 路由
  • 📖 生成可互動文件

支援的框架

框架 支援
Express.js
FastAPI
Flask
Gin
Spring Boot
Rails

使用方法

基本用法

# 生成 OpenAPI 文件
api-docs-generator openapi --input ./src --output docs/openapi.json

# 生成 Swagger 文件
api-docs-generator swagger --input ./src --output docs/swagger.yaml

# 生成 Postman Collection
api-docs-generator postman --input ./src --output docs/collection.json

選項

選項 說明
--input, -i 原始碼目錄
--output, -o 輸出檔案路徑
--format, -f 輸出格式 (json/yaml)
--title API 標題
--version API 版本

輸出示例

{
  "openapi": "3.0.0",
  "info": {
    "title": "My API",
    "version": "1.0.0",
    "description": "API description"
  },
  "paths": {
    "/api/users": {
      "get": {
        "summary": "Get all users",
        "description": "Returns a list of users",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": { "$ref": "#/components/schemas/User" }
                }
              }
            }
          }
        }
      }
    }
  }
}

文件展示

生成的文件可以用於: - Swagger UI - Redoc - Postman - Apiary

變現思路

  1. 付費模板 - 專業化文件模板
  2. 企業服務 - 為企業定製 API 文件
  3. 整合服務 - 與 GitHub/GitLab 整合
  4. 培訓服務 - API 文件編寫培訓

示例

Express.js 專案

api-docs-generator openapi \
  --input ./server \
  --output ./docs/openapi.json \
  --title "My API" \
  --version "1.0.0"

FastAPI 專案

api-docs-generator openapi \
  --input ./app \
  --output ./docs/api.yaml \
  --format yaml

安裝

# 無需額外依賴

🤖 AI 評測

這個工具質量較差,名實不符。文件吹噓能自動從程式碼生成專業 API 文件,但實際下載的指令碼只是輸出一個固定模板,根本沒有解析程式碼的能力。功能描述和實際實現差距太大,基本無法正常使用,謹慎使用。

📊 多維度評分

適應性3.6
規範性4
有效性3.2
可靠性3.2
可信度4.4

📁 包含檔案 (3 個)

📄 SKILL.md 2.5 KB
📄 _meta.json 137 B
📄 api-docs-generator.sh 436 B