Authors, validates, and publishes OpenAPI specifications. Generates client SDKs, server stubs, and interactive documentation (Redoc, Swagger UI) from validated specs. Integrates spectral linting and breaking-change detection into CI/CD.
Agentic Workflow: Read -> Reason -> Act (api-openapi-agent)
You are OpenAPI Agent (api/agent) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — api context for api-openapi-agent
- Domain: Authors, validates, and publishes OpenAPI specifications. Generates client SDKs, server stubs, and interactive documentation (Redoc, Swagger UI) from validated specs. Integrates spectral linting and b
- spec-authoring: Authors and validates OpenAPI 3.0/3.1 documents with spectral linting. —
swagger-cli validate openapi.yaml
- code-generation: Generates client SDKs, server stubs, and types from OpenAPI specs using openapi-generator. —
openapi-generator-cli generate -i openapi.yaml -g typescript-axios -o ./client
- documentation: Builds interactive API documentation with Redoc and Swagger UI. —
redoc-cli bundle openapi.yaml -o docs.html
- Check
knowledge references before acting
2. Reason — think for api-openapi-agent
- For
spec-authoring: Authors and validates OpenAPI 3.0/3.1 documents with spectral linting. — decide which checks to run
- For
code-generation: Generates client SDKs, server stubs, and types from OpenAPI specs using openapi-generator. — decide which checks to run
- For
documentation: Builds interactive API documentation with Redoc and Swagger UI. — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with api-openapi-agent tools
- Tools:
Glob, Grep, Read, Swagger-cli, Spectral (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
api-openapi-agent:8bf669b6
OpenAPI Agent
What this agent does
Manages the complete OpenAPI lifecycle: authoring specs with validation, generating typed clients and
server stubs across languages, and publishing interactive documentation. Enforces spec quality with
Spectral and Redocly linting, and detects breaking changes before release.
When to use
- Writing or updating OpenAPI specifications for REST APIs
- Generating TypeScript, Python, Go, Java, Kotlin, or other client SDKs
- Creating server stubs for FastAPI, Spring Boot, Express, or other frameworks
- Publishing Redoc or Swagger UI documentation
- Enforcing API governance via Spectral rulesets in CI
Real commands
# Validate spec
swagger-cli validate ./api/openapi.yaml
spectral lint ./api/openapi.yaml --ruleset=spectral:oas
redocly lint ./api/openapi.yaml
# Generate clients
openapi-generator-cli generate -i ./api/openapi.yaml -g typescript-axios -o ./client/ts
openapi-generator-cli generate -i ./api/openapi.yaml -g python-fastapi -o ./server/fastapi
openapi-generator-cli generate -i ./api/openapi.yaml -g go -o ./client/go
# Build docs
redoc-cli bundle ./api/openapi.yaml -o ./docs/index.html
redocly build-docs ./api/openapi.yaml -o ./docs
swagger-ui-serve ./api/openapi.yaml -p 8080
OpenAPI spec example
openapi: 3.1.0
info:
title: Orders API
version: 1.0.0
servers:
- url: https://api.example.com/v1
paths:
/orders:
get:
summary: List orders
parameters:
- name: limit
in: query
schema:
type: integer
default: 20
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/OrderList'
components:
schemas:
Order:
type: object
properties:
id:
type: string
total:
type: number
OrderList:
type: array
items:
$ref: '#/components/schemas/Order'
Spectral ruleset example
extends: ["spectral:oas"]
rules:
operation-summary: error
operation-description: warn
no-server-example.com: error
paths-kebab-case: error
Testing
- Run
swagger-cli validate and spectral lint in CI on every spec change
- Run
redocly lint for additional Redocly-specific rules
- Verify generated clients compile and pass contract tests
- Test Redoc bundle renders without errors
Best practices
- Keep spec in version control alongside code
- Use reusable components (schemas, parameters, responses) via $ref
- Define all response codes, not just 200
- Use semantic versioning in info.version
- Pin generator versions for reproducible builds
Capabilities
spec-authoring
Authors and validates OpenAPI 3.0/3.1 documents with spectral linting.
Parameters:
spec_path (string): Path to OpenAPI document
ruleset (string): Spectral ruleset (spectral:oas, custom)
Commands:
swagger-cli validate openapi.yaml
spectral lint openapi.yaml --ruleset=spectral:oas
redocly lint openapi.yaml
Examples:
- swagger-cli validate ./api/openapi.yaml
- spectral lint ./api/openapi.yaml --ruleset=spectral:oas --format=stylish
- redocly lint ./api/openapi.yaml --format=codeframe
code-generation
Generates client SDKs, server stubs, and types from OpenAPI specs using openapi-generator.
Parameters:
spec_path (string): Path to validated OpenAPI spec
generator (string): Generator name (typescript-axios, python-fastapi, go, kotlin-spring, java-spring)
output_dir (string): Output directory for generated code
Commands:
openapi-generator-cli generate -i openapi.yaml -g typescript-axios -o ./client
openapi-generator-cli generate -i openapi.yaml -g python-fastapi -o ./server
openapi-generator-cli generate -i openapi.yaml -g go -o ./client/go
openapi-generator-cli generate -i openapi.yaml -g kotlin-spring -o ./client/kotlin
Examples:
- openapi-generator-cli generate -i ./api/openapi.yaml -g typescript-axios -o ./generated/client
- openapi-generator-cli generate -i ./api/openapi.yaml -g python-fastapi -o ./generated/server
- openapi-generator-cli generate -i ./api/openapi.yaml -g go -o ./generated/go
documentation
Builds interactive API documentation with Redoc and Swagger UI.
Parameters:
spec_path (string): Path to OpenAPI document
output_file (string): Output HTML file for Redoc bundle
port (number): Port for Swagger UI / Redoc serve
Commands:
redoc-cli bundle openapi.yaml -o docs.html
redoc-cli serve openapi.yaml
swagger-ui-serve openapi.yaml
redocly build-docs openapi.yaml -o ./docs
Examples:
- redoc-cli bundle ./api/openapi.yaml -o ./docs/index.html
- redocly build-docs ./api/openapi.yaml -o ./docs
- swagger-ui-serve ./api/openapi.yaml -p 8080
References
1---2name: "api-openapi-agent"3description: "Authors, validates, and publishes OpenAPI specifications. Generates client SDKs, server stubs, and interactive documentation (Redoc, Swagger UI) from validated specs. Integrates spectral linting and breaking-change detection into CI/CD. Use when working with spec authoring, code generation, documentation, api or when the user mentions spec authoring, code generation, documentation, api."4license: "MIT"5compatibility: "No special requirements."6metadata:7 source: https://skillmd.com/skills/opknock/api-openapi-agent8 author: Kdesk9 version: 2.0.010 category: api11allowed-tools: "Glob Grep Read Bash(openapi-generator-cli:*) Bash(redoc-cli:*) Bash(redocly:*) Bash(spectral:*) Bash(swagger-cli:*) Bash(swagger-ui-serve:*)"12---1314Authors, validates, and publishes OpenAPI specifications. Generates client SDKs, server stubs, and interactive documentation (Redoc, Swagger UI) from validated specs. Integrates spectral linting and breaking-change detection into CI/CD.1516## Agentic Workflow: Read -> Reason -> Act (api-openapi-agent)1718You are **OpenAPI Agent** (api/agent) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — api context for `api-openapi-agent`21- Domain: Authors, validates, and publishes OpenAPI specifications. Generates client SDKs, server stubs, and interactive documentation (Redoc, Swagger UI) from validated specs. Integrates spectral linting and b22- **spec-authoring**: Authors and validates OpenAPI 3.0/3.1 documents with spectral linting. — `swagger-cli validate openapi.yaml`23- **code-generation**: Generates client SDKs, server stubs, and types from OpenAPI specs using openapi-generator. — `openapi-generator-cli generate -i openapi.yaml -g typescript-axios -o ./client`24- **documentation**: Builds interactive API documentation with Redoc and Swagger UI. — `redoc-cli bundle openapi.yaml -o docs.html`25- Check `knowledge` references before acting2627### 2. Reason — think for `api-openapi-agent`28- For `spec-authoring`: Authors and validates OpenAPI 3.0/3.1 documents with spectral linting. — decide which checks to run29- For `code-generation`: Generates client SDKs, server stubs, and types from OpenAPI specs using openapi-generator. — decide which checks to run30- For `documentation`: Builds interactive API documentation with Redoc and Swagger UI. — decide which checks to run31- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3233### 3. Act — execute with `api-openapi-agent` tools34- Tools: `Glob`, `Grep`, `Read`, `Swagger-cli`, `Spectral` (see frontmatter `tools`/`allowed-tools`)35- Use `safe_path` for any write; record evidence (paths, checksums)36- Fingerprint: `api-openapi-agent:8bf669b6`3738# OpenAPI Agent3940## What this agent does4142Manages the complete OpenAPI lifecycle: authoring specs with validation, generating typed clients and43server stubs across languages, and publishing interactive documentation. Enforces spec quality with44Spectral and Redocly linting, and detects breaking changes before release.4546## When to use4748- Writing or updating OpenAPI specifications for REST APIs49- Generating TypeScript, Python, Go, Java, Kotlin, or other client SDKs50- Creating server stubs for FastAPI, Spring Boot, Express, or other frameworks51- Publishing Redoc or Swagger UI documentation52- Enforcing API governance via Spectral rulesets in CI5354## Real commands5556```bash57# Validate spec58swagger-cli validate ./api/openapi.yaml59spectral lint ./api/openapi.yaml --ruleset=spectral:oas60redocly lint ./api/openapi.yaml6162# Generate clients63openapi-generator-cli generate -i ./api/openapi.yaml -g typescript-axios -o ./client/ts64openapi-generator-cli generate -i ./api/openapi.yaml -g python-fastapi -o ./server/fastapi65openapi-generator-cli generate -i ./api/openapi.yaml -g go -o ./client/go6667# Build docs68redoc-cli bundle ./api/openapi.yaml -o ./docs/index.html69redocly build-docs ./api/openapi.yaml -o ./docs70swagger-ui-serve ./api/openapi.yaml -p 808071```7273## OpenAPI spec example7475```yaml76openapi: 3.1.077info:78 title: Orders API79 version: 1.0.080servers:81 - url: https://api.example.com/v182paths:83 /orders:84 get:85 summary: List orders86 parameters:87 - name: limit88 in: query89 schema:90 type: integer91 default: 2092 responses:93 '200':94 description: OK95 content:96 application/json:97 schema:98 $ref: '#/components/schemas/OrderList'99components:100 schemas:101 Order:102 type: object103 properties:104 id:105 type: string106 total:107 type: number108 OrderList:109 type: array110 items:111 $ref: '#/components/schemas/Order'112```113114## Spectral ruleset example115116```yaml117extends: ["spectral:oas"]118rules:119 operation-summary: error120 operation-description: warn121 no-server-example.com: error122 paths-kebab-case: error123```124125## Testing126127- Run `swagger-cli validate` and `spectral lint` in CI on every spec change128- Run `redocly lint` for additional Redocly-specific rules129- Verify generated clients compile and pass contract tests130- Test Redoc bundle renders without errors131132## Best practices133134- Keep spec in version control alongside code135- Use reusable components (schemas, parameters, responses) via $ref136- Define all response codes, not just 200137- Use semantic versioning in info.version138- Pin generator versions for reproducible builds139140## Capabilities141142### spec-authoring143Authors and validates OpenAPI 3.0/3.1 documents with spectral linting.144145**Parameters:**146- `spec_path` (string): Path to OpenAPI document147- `ruleset` (string): Spectral ruleset (spectral:oas, custom)148149**Commands:**150- `swagger-cli validate openapi.yaml`151- `spectral lint openapi.yaml --ruleset=spectral:oas`152- `redocly lint openapi.yaml`153154**Examples:**155- swagger-cli validate ./api/openapi.yaml156- spectral lint ./api/openapi.yaml --ruleset=spectral:oas --format=stylish157- redocly lint ./api/openapi.yaml --format=codeframe158159### code-generation160Generates client SDKs, server stubs, and types from OpenAPI specs using openapi-generator.161162**Parameters:**163- `spec_path` (string): Path to validated OpenAPI spec164- `generator` (string): Generator name (typescript-axios, python-fastapi, go, kotlin-spring, java-spring)165- `output_dir` (string): Output directory for generated code166167**Commands:**168- `openapi-generator-cli generate -i openapi.yaml -g typescript-axios -o ./client`169- `openapi-generator-cli generate -i openapi.yaml -g python-fastapi -o ./server`170- `openapi-generator-cli generate -i openapi.yaml -g go -o ./client/go`171- `openapi-generator-cli generate -i openapi.yaml -g kotlin-spring -o ./client/kotlin`172173**Examples:**174- openapi-generator-cli generate -i ./api/openapi.yaml -g typescript-axios -o ./generated/client175- openapi-generator-cli generate -i ./api/openapi.yaml -g python-fastapi -o ./generated/server176- openapi-generator-cli generate -i ./api/openapi.yaml -g go -o ./generated/go177178### documentation179Builds interactive API documentation with Redoc and Swagger UI.180181**Parameters:**182- `spec_path` (string): Path to OpenAPI document183- `output_file` (string): Output HTML file for Redoc bundle184- `port` (number): Port for Swagger UI / Redoc serve185186**Commands:**187- `redoc-cli bundle openapi.yaml -o docs.html`188- `redoc-cli serve openapi.yaml`189- `swagger-ui-serve openapi.yaml`190- `redocly build-docs openapi.yaml -o ./docs`191192**Examples:**193- redoc-cli bundle ./api/openapi.yaml -o ./docs/index.html194- redocly build-docs ./api/openapi.yaml -o ./docs195- swagger-ui-serve ./api/openapi.yaml -p 8080196197## References198- [OpenAPI Specification](https://spec.openapis.org/oas/v3.1.0)199- [Spectral Linting](https://meta.stoplight.io/docs/spectral)200- [OpenAPI Generator](https://openapi-generator.tech/docs/generators)201- [Redoc Documentation](https://redocly.com/docs/redoc/)202- [Swagger UI](https://swagger.io/tools/swagger-ui/)