Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计通过

api-documentationAPI 文档

Agent Skill

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

总安装

376

周安装

16

GitHub Stars

6

下载量

132
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:api-documentation(API 文档)
来源仓库:https://github.com/troykelly/claude-skills
仓库路径:skills/api-documentation
安装命令:
npx skills add https://github.com/troykelly/claude-skills --skill api-documentation
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/troykelly/claude-skills --skill api-documentation

简介

辅助生成和维护 OpenAPI 规范的接口文档,支持端点描述与示例编写。

  • 适用于前后端协作、系统集成或 API 设计评审等开发流程。
  • 可自动提取请求/响应结构并补充标准错误码与安全要求说明。
  • 需基于真实代码或已有样例填写内容,避免虚构参数或响应格式。
  • 安装后可通过 npx 工具验证生成的 YAML 文件结构合法性。

SKILL.md

API Documentation Enforcement

Overview

Ensures all API changes are reflected in Swagger/OpenAPI documentation. When documentation drift is detected, work pauses until documentation is synchronized.

Core principle: API documentation is a first-class artifact, not an afterthought. No API change ships without documentation.

Announce at start: "I'm using api-documentation to verify Swagger/OpenAPI sync."

When This Skill Triggers

This skill is triggered when ANY of these file patterns are modified:

PatternFrameworkTrigger Reason
**/routes/**/*.tsExpress/FastifyRoute definitions
**/controllers/**/*.tsNestJS/ExpressController endpoints
**/*.controller.tsNestJSController class
**/api/**/*.pyFastAPI/FlaskAPI endpoints
**/*_router.pyFastAPIRouter definitions
**/handlers/**/*.goGoHTTP handlers
**/schema*.tsTypeScriptSchema definitions
**/dto/**/*.tsNestJSData transfer objects
**/models/**/*.tsVariousAPI models

Documentation Locations

Check these locations for existing API documentation:

FileFormatStandard
openapi.yamlYAMLOpenAPI 3.x
openapi.jsonJSONOpenAPI 3.x
swagger.yamlYAMLSwagger 2.0
swagger.jsonJSONSwagger 2.0
docs/api.yamlYAMLOpenAPI 3.x
api/openapi.yamlYAMLOpenAPI 3.x

The Protocol

Step 1: Detect API Changes

# Check if current changes affect API
API_CHANGED=false

# Check common API file patterns
for pattern in "routes/" "controllers/" "api/" "handlers/" "*.controller.ts" "*_router.py"; do
  if git diff --name-only HEAD~1 | grep -q "$pattern"; then
    API_CHANGED=true
    break
  fi
done

# Check for schema/DTO changes
if git diff --name-only HEAD~1 | grep -qE "(schema|dto|model)"; then
  API_CHANGED=true
fi

echo "API Changed: $API_CHANGED"

Step 2: Find Documentation File

find_api_docs() {
  for file in openapi.yaml openapi.json swagger.yaml swagger.json \
              docs/api.yaml docs/openapi.yaml api/openapi.yaml; do
    if [ -f "$file" ]; then
      echo "$file"
      return 0
    fi
  done
  return 1
}

DOC_FILE=$(find_api_docs)
if [ -z "$DOC_FILE" ]; then
  echo "ERROR: No API documentation file found"
  echo "PAUSE: Trigger documentation-audit skill"
fi

Step 3: Verify Sync

Compare API code with documentation:

verify_api_sync() {
  local doc_file=$1

  # Extract endpoints from code
  CODE_ENDPOINTS=$(find . -name "*.ts" -path "*/routes/*" -exec grep -h "@(Get|Post|Put|Delete|Patch)" {} \; | \
    sed 's/.*@\(Get\|Post\|Put\|Delete\|Patch\)(\([^)]*\)).*/\1 \2/' | sort -u)

  # Extract endpoints from OpenAPI
  DOC_ENDPOINTS=$(yq '.paths | keys[]' "$doc_file" 2>/dev/null | sort -u)

  # Compare
  MISSING=$(comm -23 <(echo "$CODE_ENDPOINTS" | sort) <(echo "$DOC_ENDPOINTS" | sort))

  if [ -n "$MISSING" ]; then
    echo "DRIFT DETECTED: Endpoints in code but not in docs:"
    echo "$MISSING"
    return 1
  fi

  return 0
}

Step 4: Handle Drift

If documentation drift is detected:

## API Documentation Drift Detected

**Status:** PAUSED
**Reason:** API documentation is out of sync with code

### Missing from Documentation
- `POST /api/users` (found in `routes/users.ts:45`)
- `GET /api/users/:id/profile` (found in `routes/users.ts:67`)

### Action Required
1. Invoke `documentation-audit` skill
2. Update Swagger/OpenAPI documentation
3. Resume current work after sync complete

---
*api-documentation skill paused work*

Then invoke documentation-audit:

Use Skill tool: documentation-audit

Documentation Requirements

When updating API documentation, include:

Required Fields

FieldDescription
summaryShort description of endpoint
descriptionDetailed explanation
parametersAll path/query/header params
requestBodyRequest schema with examples
responsesAll response codes with schemas
tagsGrouping for organization
securityAuth requirements

Required Examples

Every endpoint must have:

  • Request example (for POST/PUT/PATCH)
  • Success response example
  • Error response example

Example OpenAPI Entry

/api/users:
  post:
    summary: Create a new user
    description: |
      Creates a new user account with the provided details.
      Requires admin authentication.
    tags:
      - Users
    security:
      - bearerAuth: []
    requestBody:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreateUserRequest'
          example:
            email: user@example.com
            name: John Doe
            role: member
    responses:
      '201':
        description: User created successfully
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/User'
            example:
              id: usr_123abc
              email: user@example.com
              name: John Doe
              role: member
              createdAt: '2025-01-02T10:30:00Z'
      '400':
        description: Invalid request body
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Error'
            example:
              code: VALIDATION_ERROR
              message: Email is required
      '401':
        description: Authentication required
      '403':
        description: Insufficient permissions

Validation

After updating documentation, validate:

# Validate OpenAPI spec
npx @apidevtools/swagger-cli validate openapi.yaml

# Or with yq for basic structure check
yq 'has("openapi") and has("paths") and has("info")' openapi.yaml

Checklist

Before resuming work:

  • API documentation file exists
  • All endpoints are documented
  • Request/response schemas defined
  • Examples provided for all operations
  • Security requirements documented
  • Documentation validates successfully
  • Changes committed to branch

Integration

This skill coordinates with:

SkillPurpose
documentation-auditFull documentation sync
issue-driven-developmentTriggered during implementation
comprehensive-reviewValidates documentation complete

When to Skip

This skill can be skipped when:

  • Changes are purely internal (no API surface change)
  • Changes are to test files only
  • Changes are to documentation itself
  • Project has no API (CLI tool, library, etc.)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

29.67%
按下载量换算39

Antigravity

23.04%
按下载量换算30

Gemini CLI

15.9%
按下载量换算21

OpenCode

10.67%
按下载量换算14

Codex

7.94%
按下载量换算10

windsurf

2.87%
按下载量换算4

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills