OpenAPI Specification

## Overview

25 stars

Best use case

OpenAPI Specification is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

## Overview

Teams using OpenAPI Specification should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/openapi-spec/SKILL.md --create-dirs "https://raw.githubusercontent.com/ComeOnOliver/skillshub/main/skills/TerminalSkills/skills/openapi-spec/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/openapi-spec/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How OpenAPI Specification Compares

Feature / AgentOpenAPI SpecificationStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

## Overview

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# OpenAPI Specification

## Overview

OpenAPI (formerly Swagger) is the standard for describing REST APIs. Write a YAML/JSON spec once, then generate documentation, client SDKs, server stubs, mock servers, and tests automatically. Design-first development catches breaking changes before writing code.

## Instructions

### Step 1: Define API Spec

```yaml
# openapi.yaml — API specification
openapi: 3.1.0
info:
  title: Project Management API
  version: 1.0.0
  description: API for managing projects and tasks

servers:
  - url: https://api.example.com/v1
    description: Production
  - url: http://localhost:3000/v1
    description: Local development

paths:
  /projects:
    get:
      summary: List all projects
      operationId: listProjects
      tags: [Projects]
      parameters:
        - name: status
          in: query
          schema:
            type: string
            enum: [active, archived, all]
            default: active
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
        - name: cursor
          in: query
          schema:
            type: string
          description: Pagination cursor from previous response
      responses:
        '200':
          description: List of projects
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Project'
                  nextCursor:
                    type: string
                    nullable: true

    post:
      summary: Create a project
      operationId: createProject
      tags: [Projects]
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateProjectInput'
      responses:
        '201':
          description: Project created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Project'
        '422':
          $ref: '#/components/responses/ValidationError'

  /projects/{projectId}:
    get:
      summary: Get project by ID
      operationId: getProject
      tags: [Projects]
      parameters:
        - name: projectId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Project details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Project'
        '404':
          $ref: '#/components/responses/NotFound'

components:
  schemas:
    Project:
      type: object
      required: [id, name, status, createdAt]
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
          example: "Website Redesign"
        description:
          type: string
          nullable: true
        status:
          type: string
          enum: [active, archived]
        taskCount:
          type: integer
        createdAt:
          type: string
          format: date-time

    CreateProjectInput:
      type: object
      required: [name]
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
        description:
          type: string
          maxLength: 500

  responses:
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: "Project not found"

    ValidationError:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
              details:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                    message:
                      type: string

  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
```

### Step 2: Generate TypeScript Client

```bash
npx openapi-typescript openapi.yaml -o src/api/schema.ts
```

```typescript
// Generated types are used with fetch or axios
import type { paths } from './schema'

type ListProjectsResponse = paths['/projects']['get']['responses']['200']['content']['application/json']
type CreateProjectInput = paths['/projects']['post']['requestBody']['content']['application/json']
```

### Step 3: Validate and Lint

```bash
npx @redocly/cli lint openapi.yaml
npx @redocly/cli preview-docs openapi.yaml  # live preview
```

## Guidelines

- Design-first: write the spec before implementing. It's cheaper to change YAML than code.
- Use `$ref` extensively — reusable schemas prevent duplication and inconsistency.
- Add `operationId` to every endpoint — it's used for SDK method names.
- Use Redocly or Stoplight for visual spec editing and documentation hosting.
- Version your API in the URL path (`/v1/`) for breaking changes; use spec `version` for minor updates.

Related Skills

openapi-spec-generator

25
from ComeOnOliver/skillshub

Openapi Spec Generator - Auto-activating skill for API Development. Triggers on: openapi spec generator, openapi spec generator Part of the API Development skill category.

update-specification

25
from ComeOnOliver/skillshub

Update an existing specification file for the solution, optimized for Generative AI consumption based on new requirements or updates to any existing code.

openapi-to-application-code

25
from ComeOnOliver/skillshub

Generate a complete, production-ready application from an OpenAPI specification

create-specification

25
from ComeOnOliver/skillshub

Create a new specification file for the solution, optimized for Generative AI consumption.

create-github-pull-request-from-specification

25
from ComeOnOliver/skillshub

Create GitHub Pull Request for feature request from specification file using pull_request_template.md template.

create-github-issues-for-unmet-specification-requirements

25
from ComeOnOliver/skillshub

Create GitHub Issues for unimplemented requirements from specification files using feature_request.yml template.

create-github-issue-feature-from-specification

25
from ComeOnOliver/skillshub

Create GitHub Issue for feature request from specification file using feature_request.yml template.

create-github-action-workflow-specification

25
from ComeOnOliver/skillshub

Create a formal specification for an existing GitHub Actions CI/CD workflow, optimized for AI consumption and workflow maintenance.

aspnet-minimal-api-openapi

25
from ComeOnOliver/skillshub

Create ASP.NET Minimal API endpoints with proper OpenAPI documentation

lark-openapi-explorer

25
from ComeOnOliver/skillshub

飞书/Lark 原生 OpenAPI 探索:从官方文档库中挖掘未经 CLI 封装的原生 OpenAPI 接口。当用户的需求无法被现有 lark-* skill 或 lark-cli 已注册命令满足,需要查找并调用原生飞书 OpenAPI 时使用。

openapi-generator

25
from ComeOnOliver/skillshub

Generate comprehensive OpenAPI/Swagger specifications from existing code and APIs.

openapi-spec-generation

25
from ComeOnOliver/skillshub

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.