openapi-spec-generator

Generate OpenAPI 3.x and Swagger 2.0 specifications from descriptions or source code.

Updated Aug 11, 2026
One-click install
npx skills add https://github.com/DucCuong159/Realtime-chatapp --skill openapi-spec-generator-duccuong159
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: openapi-spec-generator
Source: https://github.com/DucCuong159/Realtime-chatapp/tree/main/.agent/skills/openapi-spec-generator
Command: npx skills add https://github.com/DucCuong159/Realtime-chatapp --skill openapi-spec-generator-duccuong159

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing complete, valid OpenAPI or Swagger specifications by hand is tedious and error-prone, often resulting in missing response codes, broken $ref links, or inconsistent schemas. This Skill produces complete, validated API specifications from natural language descriptions, existing code, or partial specs. ## Core Features & Use Cases - Spec Generation from Code: Extract endpoints automatically from Express, FastAPI, Spring Boot, Django REST, or Rails source code and convert them into structured paths and schemas. - Standards-Compliant Output: Produces OpenAPI 3.x or Swagger 2.0 specs with security schemes, reusable components, examples, and a full response code matrix (400/401/403/404/409/422/429/500). - Quality Checklist Enforcement: Verifies operationIds, $ref targets, required fields, and tag consistency before delivery. - Use Case: Point the Skill at your Express route files and receive a complete openapi.yaml with JWT Bearer security, paginated response schemas, and per-endpoint error responses ready for Swagger UI. ## Quick Start Ask the AI to generate an OpenAPI 3.1 YAML specification from your API description or route code, including authentication and error responses.

Frequently Asked Questions about openapi-spec-generator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate an OpenAPI spec from existing code?

Provide your route code from Express, FastAPI, Spring Boot, Django REST, or Rails, and endpoints are extracted automatically. Route handlers map to paths, request bodies and query parameters map to schemas, and middleware like authentication maps to security requirements.

What is the difference between OpenAPI 3.x and Swagger 2.0?

OpenAPI 3.x uses components/schemas, servers, and securitySchemes, while Swagger 2.0 uses definitions, host/basePath, and securityDefinitions. The Skill supports both versions and adjusts the skeleton structure based on which one you choose.

How do I document JWT or OAuth2 authentication in OpenAPI?

Define security schemes under components/securitySchemes: use http bearer for JWT, oauth2 with flows for OAuth 2.0, or apiKey for header keys. Apply security globally at the root and override per-operation for public endpoints with security: [].

Does the generated spec include error response codes?

Yes, every operation includes standard codes: 400, 401, 403, 404, 409, 422, 429, and 500 where applicable. Common errors like 401 and 500 are defined once in components/responses and referenced with $ref to avoid repetition.

Can I validate the generated OpenAPI specification?

The Skill applies an internal quality checklist covering operationIds, $ref targets, required fields, and tag consistency before delivery. Afterward, it offers to validate against external tools like Spectral or swagger-parser and generate Prism mock servers.