Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
wshobson avatar

Openapi Spec Generation

  • 13.3k installs
  • 38.3k repo stars
  • Updated July 22, 2026
  • wshobson/agents

openapi-spec-generation is a skill for generating OpenAPI specifications automatically from Python FastAPI or TypeScript code instead of maintaining specs separately.

About

openapi-spec-generation is a skill for generating OpenAPI specifications directly from Python FastAPI or TypeScript code. It demonstrates code-first patterns where API specs are derived from models and route definitions rather than maintained separately. Developers use it during Build phase to keep documentation and specs synchronized with implementation.

  • Code-first OpenAPI generation from Python FastAPI and TypeScript tsoa frameworks
  • Pydantic model integration with validation and schema inference
  • SDK generation and linting patterns for production API specs

Openapi Spec Generation by the numbers

  • 13,295 all-time installs (skills.sh)
  • +222 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #59 of 4,386 Backend & APIs skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

openapi-spec-generation capabilities & compatibility

Capabilities
spec generation · sdk generation · documentation auto · validation
Use cases
api development
npx skills add https://github.com/wshobson/agents --skill openapi-spec-generation

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs13.3k
repo stars38.3k
Security audit3 / 3 scanners passed
Last updatedJuly 22, 2026
Repositorywshobson/agents

How do you generate OpenAPI specs from FastAPI code?

Generate and maintain OpenAPI specifications from FastAPI or tsoa application code during API development and documentation.

Who is it for?

Backend developers using FastAPI or tsoa who want automated, spec-first API documentation and SDK generation from code.

Skip if: REST APIs already using separate spec files; GraphQL or non-REST architectures; legacy APIs without framework support.

When should I use this skill?

The user asks to generate, update, lint, or export OpenAPI from FastAPI, tsoa, or existing Python/TypeScript API handlers.

What you get

Code-derived OpenAPI 3 specification, validated schema definitions, and optional generated client SDKs.

  • OpenAPI JSON spec
  • Generated SDK
  • API documentation

By the numbers

  • Includes a FastAPI example API versioned at 2.0.0
  • Covers Python FastAPI and TypeScript tsoa generation paths

Files

SKILL.mdMarkdownGitHub ↗

OpenAPI Spec Generation

Comprehensive patterns for creating, maintaining, and validating OpenAPI 3.1 specifications for RESTful APIs.

When to Use This Skill

  • Creating API documentation from scratch
  • Generating OpenAPI specs from existing code
  • Designing API contracts (design-first approach)
  • Validating API implementations against specs
  • Generating client SDKs from specs
  • Setting up API documentation portals

Core Concepts

1. OpenAPI 3.1 Structure

openapi: 3.1.0
info:
  title: API Title
  version: 1.0.0
servers:
  - url: https://api.example.com/v1
paths:
  /resources:
    get: ...
components:
  schemas: ...
  securitySchemes: ...

2. Design Approaches

ApproachDescriptionBest For
Design-FirstWrite spec before codeNew APIs, contracts
Code-FirstGenerate spec from codeExisting APIs
HybridAnnotate code, generate specEvolving APIs

Templates and detailed worked examples

Full template library and detailed worked examples live in references/details.md. Read that file when you need the concrete templates.

Best Practices

Do's

  • Use $ref - Reuse schemas, parameters, responses
  • Add examples - Real-world values help consumers
  • Document errors - All possible error codes
  • Version your API - In URL or header
  • Use semantic versioning - For spec changes

Don'ts

  • Don't use generic descriptions - Be specific
  • Don't skip security - Define all schemes
  • Don't forget nullable - Be explicit about null
  • Don't mix styles - Consistent naming throughout
  • Don't hardcode URLs - Use server variables

Related skills

How it compares

Use openapi-spec-generation when route code is the source of truth; prefer design-first OpenAPI skills when product teams define contracts before implementation.

FAQ

Do I need a separate OpenAPI file?

No - FastAPI generates specs automatically from code. tsoa (TypeScript) also generates automatically from decorators and Pydantic/class definitions.

How do I add examples and descriptions to API specs?

Use Pydantic Field() with description parameter, model_config examples, and FastAPI response model definitions to enrich spec output.

Is Openapi Spec Generation safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.