agentleFS
bestdeejay-designbestdeejay-design/agent-skills/skills/api-doc-generator/SKILL.md

api-doc-generator

Skill6 starsChanged 3 months agoMITView on GitHub

Генерация Markdown-документации REST API из OpenAPI-схемы (3.x, включая 3.1.0). Скрипт api_doc.py читает openapi.json (файл или stdin), извлекает endpoint'ы (method, path, summary, operationId, параметры query/path/header, requestBody, коды ответов) и рендерит Markdown-раздел на каждый эндпоинт. FastAPI: схема из app.openapi() или /openapi.json; Express: swagger-jsdoc (референс в SKILL.md). Триггеры: 'api doc', 'документация API', 'openapi', 'swagger в markdown', 'сгенерай api doc', 'документировать эндпоинты', 'api reference', 'описать API', 'rest api docs'.",

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when:

    line 23
  2. Distinctive:

    Do NOT use when:

    line 29
  3. Very specific:

    Do not use for validating whether an API matches its contract.

    line 77
  4. Distinctive:

    Write to the requested output path, then reopen the result and verify every source operation has a corresponding Markdown heading.

    line 84

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

API Doc Generator

Генерация Markdown-документации REST API из OpenAPI-схемы: парсинг схемы, разбор endpoint'ов, рендер раздела на каждый метод с параметрами и кодами.

Загружай этот скилл когда нужно документировать REST API в Markdown: по endpoint'ам, с параметрами, телами запросов и кодами ответов. Скилл читает OpenAPI-схему (JSON) и выдаёт готовый документ.

🎯 When to use

Use this skill when:

  • Есть openapi.json/swagger.json и нужен Markdown-документ для README/Wiki
  • FastAPI-приложение: нужно отрендерить app.openapi() в документацию
  • Просят «документация API», «api doc», «описать эндпоинты»
  • Нужна автономная страница API Reference без хостинга Swagger UI

Do NOT use when:

  • Есть Swagger UI / Redoc онлайн — это уже интерактивная документация
  • Нужна сгенерированная из кода схема (Express + swagger-jsdoc) — сначала собери схему, потом этот скрипт
  • Нужен глубокий разбор типов (oneOf/allOf) — скрипт выдаёт плоскую таблицу параметров

📦 Files

  • SKILL.md — этот файл
  • scripts/api_doc.py — рендерер OpenAPI → Markdown (Python 3 stdlib)

🧰 Usage

# Из файла:
python3 skills/api-doc-generator/scripts/api_doc.py --schema openapi.json

# Из stdin:
cat openapi.json | python3 api_doc.py --stdin

# В файл:
python3 api_doc.py --schema openapi.json --title "My API" --out API.md

🔌 Получение схемы по фреймворку

FastAPI (OpenAPI 3.1 по умолчанию)

import json, app  # your FastAPI app
with open("openapi.json", "w") as f:
    json.dump(app.openapi(), f, ensure_ascii=False, indent=2)

Затем: python3 api_doc.py --schema openapi.json.

Express (Node.js)

Вариант A — swagger-jsdoc (аннотированный код):

npx swagger-jsdoc -d swagger-def.js -o openapi.json

Вариант B — AST-прогулка по маршрутам (если нет аннотаций): собрать app._router.stack (Express 4) в список method+path вручную — базовый случай.

✅ Definition of Done

  • Скрипт отработал: Markdown-документ в stdout или --out.
  • Каждый endpoint: method, path, summary, параметры таблицей, коды ответов.
  • Схема OpenAPI прошла json.loads без ошибок.

Boundaries

  • Do not use for validating whether an API matches its contract; use api-contract-testing for checks.

Operating procedure

  1. Load the OpenAPI 3.x document and fail if it is not parseable.
  2. Preserve the source operation order and group methods by path.
  3. Render parameters, request bodies, response codes, auth hints, and operation IDs without inventing values.
  4. Write to the requested output path, then reopen the result and verify every source operation has a corresponding Markdown heading.

Output contract and verification

The output is Markdown plus a run summary containing the input path, operation count, output path, and exit status. Treat missing schemas, unresolved references, and unsupported constructs as explicit warnings; never silently omit an endpoint. Re-run the generator after changing the spec and compare the operation count before claiming completeness.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.