Openapi spec generation

From mtecoYY/ai-baike · View interactive version

Openapi spec generation is an AI agent skill from the GitHub repository mtecoYY/ai-baike. Generate and maintain OpenAPI 3.1 specifications from code, design-first specs, and validation patterns. Use when creating API documentation, generating SDKs, or ensuring API contract compliance.

How to use this skill

Skill file

OpenAPI Spec Generation

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

When to Use This Skill

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

| Approach | Description | Best For |

| ---------------- | ---------------------------- | ------------------- |

| Design-First | Write spec before code | New APIs, contracts |

| Code-First | Generate spec from code | Existing APIs |

| Hybrid | Annotate code, generate spec | Evolving 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

Don'ts

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.