AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Api Doc Gen

skill-srnichols-plan-forge-api-doc-gen · by srnichols

Generate or update OpenAPI specification from Python/FastAPI route decorators. Validate spec-to-code consistency. Use after adding or changing API endpoints.

— No reviews yet
0 installs
50 views
0.0% view→install

Install

$ agentstack add skill-srnichols-plan-forge-api-doc-gen

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-srnichols-plan-forge-api-doc-gen)

Reliability & compatibility

✓ Security review passed
0 installs to date
— no reviews yet
● 2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Api Doc Gen? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

API Documentation Generation Skill

Trigger

"Generate API docs" / "Update OpenAPI spec" / "Document this endpoint"

Steps

1. Discover API Endpoints

grep -rn "@app\.\(get\|post\|put\|delete\|patch\)" --include="*.py" src/

> If this step fails (no matches): Try grep -rn "@router\.\(get\|post\|put\|delete\|patch\)" --include="*.py" src/ for FastAPI APIRouter patterns.

> **If no .py files found*: Stop and report "No Python project found in this directory."

2. Extract Endpoint Details

For each endpoint, document:

  • HTTP method and path (from @app.get("/path") decorators)
  • Request body schema (from Pydantic model type hints)
  • Query parameters (from Query() parameter defaults)
  • Path parameters (from {param} in route paths)
  • Response schema (from response_model decorator argument)
  • Authentication requirements (from Depends() security dependencies)

3. Generate/Update OpenAPI Spec

FastAPI generates OpenAPI automatically. Verify the generated spec:

# Start the app and fetch the auto-generated spec
python -c "from main import app; import json; print(json.dumps(app.openapi(), indent=2))"

> If this step fails: Check that the app entry point is correct — try from app.main import app or inspect pyproject.toml for the entry point.

openapi: 3.1.0
info:
  title: (project name from pyproject.toml)
  version: (from pyproject.toml or VERSION file)
paths:
  /api/v1/resource:
    get:
      summary: Brief description
      parameters: [...]
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Resource' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '404': { $ref: '#/components/responses/NotFound' }

4. Validate Consistency

Use the forge_analyze MCP tool to verify spec-to-code consistency:

  • [ ] Every route decorator has a matching spec entry
  • [ ] No spec entries without corresponding code (ghost endpoints)
  • [ ] Request/response schemas match actual Pydantic models
  • [ ] Status codes match HTTPException raises and status_code parameters
  • [ ] Auth requirements match Depends() security chains

5. Report

API Documentation Status:
  Endpoints in code:    N
  Endpoints in spec:    N
  Missing from spec:    N (list them)
  Ghost entries:        N (in spec but not in code)
  Schema mismatches:    N

Overall: PASS / FAIL

Safety Rules

  • NEVER invent endpoints not in the code
  • ALWAYS preserve existing spec customizations (descriptions, examples)
  • Validate against actual route decorators, not assumptions
  • Flag breaking changes (removed endpoints, changed schemas)
  • Run pytest after any spec-related code changes

Temper Guards

| Shortcut | Why It Breaks | |----------|--------------| | "The code is self-documenting" | Code shows implementation, not intent. API consumers need contracts, not source code. | | "We'll add the OpenAPI spec later" | Specs drift from implementation immediately. Generate alongside code or they'll never match. | | "Only internal consumers, no docs needed" | Internal APIs become external APIs. Undocumented internal APIs create onboarding bottlenecks. | | "Examples aren't necessary" | Examples are the most-read section of any API doc. Abstract schemas don't show real usage. |

Warning Signs

  • Endpoints without response type annotations — returns untyped or generic responses
  • Spec doesn't match actual routes — OpenAPI spec has different paths/methods than the running API
  • No request/response examples — spec has schemas but no concrete usage examples
  • Error responses undocumented — only success codes documented, error payloads missing
  • Spec not validated against running API — generated once but never verified against live routes

Exit Proof

After completing this skill, confirm:

  • [ ] OpenAPI spec generated or updated (FastAPI auto-gen / flask-smorest)
  • [ ] Spec validates against actual endpoints — no ghost entries, no missing routes
  • [ ] Request/response examples present for key routes
  • [ ] Error responses documented (4xx/5xx with schemas)
  • [ ] pip install -e . succeeds after any spec-related code changes

Persistent Memory (if OpenBrain is configured)

  • Before generating docs: search_thoughts("API design", project: "", created_by: "copilot-vscode", type: "convention") — load API naming conventions, pagination patterns, and error response standards
  • After spec update: capture_thought("API doc: ", project: "", created_by: "copilot-vscode", source: "skill-api-doc-gen") — persist API evolution for breaking change tracking

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.