Communitygithub.com

API 文件產生器

從程式碼庫中的 API 路由檔案自動產生 OpenAPI 3.0 (Swagger) 文件。適用於處理 REST API、Express 路由、FastAPI 端點,或使用者需要 API 文件時。

API 文件產生器 是什麼?

此技能可自動從程式碼庫中的 API 路由檔案產生 OpenAPI 3.0 (Swagger) 文件。它支援多種後端框架,包括 Express/Node.js、FastAPI、Flask 和 NestJS,能自動發現路由定義、分析 HTTP 方法、路徑、參數和回應結構。產生的規格檔會包含身份驗證方案、標籤分組和 JSON Schema 定義,並可選擇儲存為 `openapi.yaml` 或 `swagger.json`。此技能對於需要快速建立或更新 API 文件的開發者非常實用,尤其適用於維護舊有程式碼或啟用 API 管理工具(如 Swagger UI 或 Redoc)的情境。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/aiskillstore/marketplace/crazydubya/api-documentation-generator

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

API 文件產生器 是做什麼的?

此技能能從程式碼庫中的 API 路由檔案自動產生 OpenAPI 3.0 (Swagger) 文件。

何時使用此技能

  • 使用者要求產生 API 文件
  • 處理 REST API 端點
  • 需要建立或更新 OpenAPI/Swagger 規格
  • 為 Express、FastAPI、Flask、NestJS 或類似框架設定 API 文件

操作說明

1. 探索 API 路由

搜尋程式碼庫中的 API 路由定義:

  • Express/Node.js:尋找 app.get()、app.post()、router.get() 等
  • FastAPI/Python:尋找 @app.get()、@router.post() 裝飾器
  • Flask:尋找 @app.route() 裝飾器
  • NestJS:尋找 @Get()、@Post()、@Controller() 裝飾器
  • Rails:尋找 config/routes.rb 中的路由

使用 Glob 來尋找路由檔案 (例如:**/*routes*.{js,ts,py}、**/controllers/**/*.{js,ts})

2. 分析路由模式

對於每個發現的路由,提取:

  • HTTP 方法:GET、POST、PUT、PATCH、DELETE
  • 路徑:端點 URL (例如:/api/users/:id)
  • 參數:路徑參數、查詢參數、請求主體
  • 回應:預期的回應結構
  • 身份驗證:是否需要驗證
  • 描述:路由附近的註解或文件字串

3. 產生 OpenAPI 規格

建立或更新 OpenAPI 3.0 規格檔案 (通常為 openapi.yaml 或 swagger.json):

  • 從 templates/openapi-3.0.yaml 範本開始
  • 將每個路由對應到 OpenAPI 路徑物件
  • 使用 JSON Schema 定義請求和回應的結構
  • 包含參數定義 (路徑、查詢、主體)
  • 若偵測到身份驗證機制,請加入驗證方案 (Bearer、API Key、OAuth2)
  • 使用標籤將端點分組 (例如「使用者」、「產品」、「驗證」)

4. 驗證完整性

檢查產生的文件是否包含:

  • 所有已發現的端點
  • 準確的 HTTP 方法和路徑
  • 盡可能包含請求和回應的範例
  • 錯誤回應 (400、401、404、500 等)
  • 安全要求

5. 輸出位置

  • 儲存為專案根目錄下的 openapi.yaml,或
  • 若 docs/ 或 api/ 目錄存在,則放置於其中
  • 若不明確,請詢問使用者的偏好位置

框架特定備註

Express/Node.js

  • 檢查可能影響驗證/驗證的中介軟體
  • 尋找請求驗證器 (Joi、express-validator 等)
  • 提取 JSDoc 註解作為端點說明

FastAPI

  • FastAPI 會自動產生 OpenAPI 文件,但此技能可增強這些文件
  • 提取 Pydantic 模型作為請求和回應的結構
  • 檢查 response_model 和 status_code 參數

NestJS

  • 尋找 DTO (資料傳輸物件) 作為結構
  • 檢查 Swagger 裝飾器 (@ApiOperation、@ApiResponse)
  • 從控制器和方法裝飾器中提取元數據

最佳做法

  1. 使用現有結構:若程式碼庫中有 TypeScript 介面、Pydantic 模型等,請使用它們來獲得準確的結構
  2. 包含範例:若有測試案例,請從中提取請求和回應範例
  3. 邏輯分組:使用標籤依照資源或功能區域組織端點
  4. 適當版本:使用程式碼庫中的 API 版本 (例如「1.0.0」)
  5. 加入說明:使用程式碼註解/文件字串作為端點說明

支援檔案

  • templates/openapi-3.0.yaml:基礎 OpenAPI 範本
  • examples.md:框架特定範例

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

相關技能