# API Documentation Engineer

> Implements docs-as-code for APIs: OpenAPI authoring, Redoc builds, mock servers, and SDK generation from specs. Use when working with docs as code, mock and sdk or when the user mentions docs as code, mock and sdk.

- Skill: `opknock/api-documentation-engineer` (Agent Skill)
- Install (CLI): `npx get-skill add opknock/api-documentation-engineer`
- Raw SKILL.md: https://api.skillmd.com/api/skills/opknock/api-documentation-engineer/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- License: MIT
- Author: OpKnock (https://skillmd.com/u/opknock)
- Updated: 2026-11-23
- Page: https://skillmd.com/skills/opknock/api-documentation-engineer

---


Implements docs-as-code for APIs: OpenAPI authoring, Redoc builds, mock servers, and SDK generation from specs.

## Agentic Workflow: Read -> Reason -> Act (api-documentation-engineer)

You are **api-documentation-engineer** (backend) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.

### 1. Read — backend context for `api-documentation-engineer`
- Domain: Implements docs-as-code for APIs: OpenAPI authoring, Redoc builds, mock servers, and SDK generation from specs.
- **docs-as-code**: Author specs in Git, validate, bundle, and build interactive docs — `npm install -g redoc-cli`
- **mock-and-sdk**: Stand up mock servers and generate SDKs from the spec — `npm install -g @stoplight/prism-cli`
- Check `knowledge` and `prerequisites: swagger-cli, redoc-cli, openapi-generator`

### 2. Reason — think for `api-documentation-engineer`
- For `docs-as-code`: Author specs in Git, validate, bundle, and build interactive docs — decide which checks to run
- For `mock-and-sdk`: Stand up mock servers and generate SDKs from the spec — decide which checks to run
- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs

### 3. Act — execute with `api-documentation-engineer` tools
- Tools: `Glob`, `Grep`, `Read`, `Bash`, `Redoc-cli` (see frontmatter `tools`/`allowed-tools`)
- Use `safe_path` for any write; record evidence (paths, checksums)
- Fingerprint: `api-documentation-engineer:2133434a`

# API Documentation Engineer

Implements a docs-as-code pipeline: spec in Git, docs generated in CI.

## When to Use
- Keeping docs in sync with code
- Shipping interactive docs fast
- Generating SDKs alongside docs

## Real Commands

```bash
# Build docs
npm install -g redoc-cli
redoc-cli build openapi.yaml -o public/index.html

# Serve locally
redoc-cli serve openapi.yaml -p 8090

# Mock server
npm install -g @stoplight/prism-cli
prism mock openapi.yaml -p 4010
curl -s http://localhost:4010/api/products | python -m json.tool

# SDKs
openapi-generator generate -i openapi.yaml -g typescript-fetch -o sdk/ts
openapi-generator generate -i openapi.yaml -g python --package-name store_api -o sdk/python
```

## CI Pipeline
1. Validate spec
2. Build HTML
3. Generate SDKs
4. Publish to docs site

## Testing
Walk through the mock endpoints matching each documented example.

## Best Practices
- Never hand-edit generated HTML or SDKs
- Review spec diffs in PRs

## Capabilities

### docs-as-code
Author specs in Git, validate, bundle, and build interactive docs

**Parameters:**
- `spec` (string): OpenAPI spec path
- `output` (string): HTML output path

**Commands:**
- `npm install -g redoc-cli`
- `redoc-cli build openapi.yaml -o public/index.html`
- `redoc-cli bundle openapi.yaml -o bundled.yaml`
- `swagger-cli validate openapi.yaml`
- `redoc-cli serve openapi.yaml`

**Examples:**
- redoc-cli build openapi.yaml -o public/index.html
- swagger-cli validate openapi.yaml && redoc-cli build openapi.yaml -o public/index.html
- redoc-cli serve openapi.yaml -p 8090

### mock-and-sdk
Stand up mock servers and generate SDKs from the spec

**Parameters:**
- `port` (string): Mock server port
- `generator` (string): SDK generator name

**Commands:**
- `npm install -g @stoplight/prism-cli`
- `prism mock openapi.yaml -p 4010`
- `openapi-generator generate -i openapi.yaml -g typescript-fetch -o sdk/ts`
- `openapi-generator generate -i openapi.yaml -g python -o sdk/python`
- `curl -s http://localhost:4010/api/products | python -m json.tool`

**Examples:**
- prism mock openapi.yaml -p 4010 & curl -s http://localhost:4010/api/products | python -m json.tool
- openapi-generator generate -i openapi.yaml -g typescript-fetch -o sdk/ts
- openapi-generator generate -i openapi.yaml -g python --package-name store_api -o sdk/python

## References
- [redoc-cli](https://github.com/Redocly/redoc/blob/master/cli/README.md)
- [Prism CLI](https://meta.stoplight.io/docs/prism)

