Communitygithub.com

API文档生成器

自动从代码库中的API路由文件生成OpenAPI/Swagger文档。适用于REST API、Express路由、FastAPI端点或用户请求API文档的场景。

API文档生成器 是什么?

该技能能够自动分析代码库中的API路由定义,生成符合OpenAPI 3.0规范的文档。它支持主流框架,包括Express/Node.js、FastAPI、Flask、NestJS和Rails。技能通过搜索路由文件、提取HTTP方法、路径、参数、响应结构等关键信息,然后构建完整的OpenAPI规格文件。生成的文档包括所有发现的端点、准确的HTTP方法和路径、请求/响应示例以及安全需求。技能还针对不同框架提供了特定处理逻辑,例如利用FastAPI的Pydantic模型或NestJS的DTO,并支持从注释或装饰器中提取描述信息。最终文档可以保存为项目根目录的openapi.yaml文件,或放入docs/或api/目录。

兼容平台~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

相关技能