Implements API documentation basics: OpenAPI authoring, Swagger UI/Redoc serving, and first docs build. Use when authoring or serving OpenAPI specs. Don't use for docs-site architecture (see api-doc-site-architecture) or generated SDK docs (see api-documentation-generator).
Agentic Workflow: Read -> Reason -> Act (api-doc-openapi-authoring)
You are Api Doc Openapi Authoring (backend) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — backend context for api-doc-openapi-authoring
- Domain: Implements API documentation basics: OpenAPI authoring, Swagger UI/Redoc serving, and first docs build. Use when authoring or serving OpenAPI specs. Don't use for docs-site architecture (see api-doc-s
- openapi-authoring: Author and validate OpenAPI specs by hand or from code —
npm install -g swagger-cli
- ui-serving: Serve Swagger UI and Redoc locally and in production —
npm install -g redoc-cli
- Check
knowledge and prerequisites: swagger-cli, redoc-cli, openapi-generator
2. Reason — think for api-doc-openapi-authoring
- For
openapi-authoring: Author and validate OpenAPI specs by hand or from code — decide which checks to run
- For
ui-serving: Serve Swagger UI and Redoc locally and in production — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with api-doc-openapi-authoring tools
- Tools:
Glob, Grep, Read, Bash, Swagger-cli (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
api-doc-openapi-authoring:7df4ec02
API Doc (Implementation)
Gets documentation on its feet: a validated spec and a served UI.
When to Use
- No docs exist yet
- Quick reference docs for a service
- Single-spec documentation
Real Commands
# Validate
npm install -g swagger-cli
swagger-cli validate openapi.yaml
# Bundle for distribution
swagger-cli bundle openapi.yaml -o bundled.yaml
# Serve Redoc
npm install -g redoc-cli
redoc-cli serve openapi.yaml -p 8090
# Build static HTML
redoc-cli build openapi.yaml -o index.html
# Swagger UI
npm install swagger-ui-dist
Minimal Spec
openapi: 3.0.0
info:
title: My API
version: 1.0.0
paths: {}
Testing
Validate after every spec edit; keep bundled.yaml committed.
Best Practices
- Validate in pre-commit
- Serve the same bundled file in all environments
Capabilities
openapi-authoring
Author and validate OpenAPI specs by hand or from code
Parameters:
spec (string): OpenAPI spec path
output (string): Bundled output path
Commands:
npm install -g swagger-cli
swagger-cli validate openapi.yaml
swagger-cli bundle openapi.yaml -o bundled.yaml
swagger-cli dereference openapi.yaml -o deref.yaml
node -e "const s={openapi:'3.0.0',info:{title:'API',version:'1.0.0'},paths:{}};console.log(JSON.stringify(s,null,2))"
Examples:
- swagger-cli validate openapi.yaml
- swagger-cli bundle openapi.yaml -o bundled.yaml && swagger-cli validate bundled.yaml
- node -e "const s={openapi:'3.0.0',info:{title:'API',version:'1.0.0'},paths:{}};console.log(JSON.stringify(s,null,2))"
ui-serving
Serve Swagger UI and Redoc locally and in production
Parameters:
port (string): Serve port
spec (string): Spec path
Commands:
npm install -g redoc-cli
redoc-cli serve openapi.yaml
redoc-cli build openapi.yaml -o index.html
npm install swagger-ui-dist
node -e "const d=require('swagger-ui-dist');console.log(d.getAbsoluteFSPath())"
Examples:
- redoc-cli serve openapi.yaml -p 8090
- redoc-cli build openapi.yaml -o index.html
- node -e "const d=require('swagger-ui-dist');console.log(d.getAbsoluteFSPath())"
References
1---2name: "api-doc-openapi-authoring"3description: "Implements API documentation basics: OpenAPI authoring, Swagger UI/Redoc serving, and first docs build. Use when authoring or serving OpenAPI specs. Don't use for docs-site architecture (see api-doc-site-architecture) or generated SDK docs (see api-documentation-generator)."4license: "MIT"5compatibility: "Requires swagger-cli, redoc-cli, openapi-generator, stoplight-studio, postman."6metadata:7 source: https://skillmd.com/skills/opknock/api-doc-openapi-authoring8 author: Kdesk9 version: 2.0.010 category: backend11allowed-tools: "Glob Grep Read Bash(node:*) Bash(npm:*) Bash(redoc-cli:*) Bash(swagger-cli:*)"12---1314Implements API documentation basics: OpenAPI authoring, Swagger UI/Redoc serving, and first docs build. Use when authoring or serving OpenAPI specs. Don't use for docs-site architecture (see api-doc-site-architecture) or generated SDK docs (see api-documentation-generator).1516## Agentic Workflow: Read -> Reason -> Act (api-doc-openapi-authoring)1718You are **Api Doc Openapi Authoring** (backend) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — backend context for `api-doc-openapi-authoring`21- Domain: Implements API documentation basics: OpenAPI authoring, Swagger UI/Redoc serving, and first docs build. Use when authoring or serving OpenAPI specs. Don't use for docs-site architecture (see api-doc-s22- **openapi-authoring**: Author and validate OpenAPI specs by hand or from code — `npm install -g swagger-cli`23- **ui-serving**: Serve Swagger UI and Redoc locally and in production — `npm install -g redoc-cli`24- Check `knowledge` and `prerequisites: swagger-cli, redoc-cli, openapi-generator`2526### 2. Reason — think for `api-doc-openapi-authoring`27- For `openapi-authoring`: Author and validate OpenAPI specs by hand or from code — decide which checks to run28- For `ui-serving`: Serve Swagger UI and Redoc locally and in production — decide which checks to run29- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3031### 3. Act — execute with `api-doc-openapi-authoring` tools32- Tools: `Glob`, `Grep`, `Read`, `Bash`, `Swagger-cli` (see frontmatter `tools`/`allowed-tools`)33- Use `safe_path` for any write; record evidence (paths, checksums)34- Fingerprint: `api-doc-openapi-authoring:7df4ec02`3536# API Doc (Implementation)3738Gets documentation on its feet: a validated spec and a served UI.3940## When to Use41- No docs exist yet42- Quick reference docs for a service43- Single-spec documentation4445## Real Commands4647```bash48# Validate49npm install -g swagger-cli50swagger-cli validate openapi.yaml5152# Bundle for distribution53swagger-cli bundle openapi.yaml -o bundled.yaml5455# Serve Redoc56npm install -g redoc-cli57redoc-cli serve openapi.yaml -p 80905859# Build static HTML60redoc-cli build openapi.yaml -o index.html6162# Swagger UI63npm install swagger-ui-dist64```6566## Minimal Spec6768```yaml69openapi: 3.0.070info:71 title: My API72 version: 1.0.073paths: {}74```7576## Testing77Validate after every spec edit; keep bundled.yaml committed.7879## Best Practices80- Validate in pre-commit81- Serve the same bundled file in all environments8283## Capabilities8485### openapi-authoring86Author and validate OpenAPI specs by hand or from code8788**Parameters:**89- `spec` (string): OpenAPI spec path90- `output` (string): Bundled output path9192**Commands:**93- `npm install -g swagger-cli`94- `swagger-cli validate openapi.yaml`95- `swagger-cli bundle openapi.yaml -o bundled.yaml`96- `swagger-cli dereference openapi.yaml -o deref.yaml`97- `node -e "const s={openapi:'3.0.0',info:{title:'API',version:'1.0.0'},paths:{}};console.log(JSON.stringify(s,null,2))"`9899**Examples:**100- swagger-cli validate openapi.yaml101- swagger-cli bundle openapi.yaml -o bundled.yaml && swagger-cli validate bundled.yaml102- node -e "const s={openapi:'3.0.0',info:{title:'API',version:'1.0.0'},paths:{}};console.log(JSON.stringify(s,null,2))"103104### ui-serving105Serve Swagger UI and Redoc locally and in production106107**Parameters:**108- `port` (string): Serve port109- `spec` (string): Spec path110111**Commands:**112- `npm install -g redoc-cli`113- `redoc-cli serve openapi.yaml`114- `redoc-cli build openapi.yaml -o index.html`115- `npm install swagger-ui-dist`116- `node -e "const d=require('swagger-ui-dist');console.log(d.getAbsoluteFSPath())"`117118**Examples:**119- redoc-cli serve openapi.yaml -p 8090120- redoc-cli build openapi.yaml -o index.html121- node -e "const d=require('swagger-ui-dist');console.log(d.getAbsoluteFSPath())"122123## References124- [swagger-cli](https://github.com/APIDevTools/swagger-cli)125- [Redoc CLI](https://github.com/Redocly/redoc/blob/master/cli/README.md)