# API REST Generation

> Generates REST clients and documentation from OpenAPI with openapi-generator-cli and Redocly: multi-language client generation, config files, and docs deployment. Use when working with client generation, docs deployment or when the user mentions client generation, docs deployment.

- Skill: `opknock/api-rest-generation` (Agent Skill)
- Install (CLI): `npx get-skill add opknock/api-rest-generation`
- Raw SKILL.md: https://api.skillmd.com/api/skills/opknock/api-rest-generation/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-rest-generation

---


Generates REST clients and documentation from OpenAPI with openapi-generator-cli and Redocly: multi-language client generation, config files, and docs deployment.

## Agentic Workflow: Read -> Reason -> Act (api-rest-generation)

You are **Api Rest Generation** (backend) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.

### 1. Read — backend context for `api-rest-generation`
- Domain: Generates REST clients and documentation from OpenAPI with openapi-generator-cli and Redocly: multi-language client generation, config files, and docs deployment.
- **client-generation**: Generate typed API clients in multiple languages — `npx @openapitools/openapi-generator-cli generate -i openapi.yaml -g typescript-f`
- **docs-deployment**: Build and preview reference documentation — `npx @redocly/cli build-docs openapi.yaml -o dist/api.html`
- Check `knowledge` and `prerequisites: node.js, python, express, fastapi`

### 2. Reason — think for `api-rest-generation`
- For `client-generation`: Generate typed API clients in multiple languages — decide which checks to run
- For `docs-deployment`: Build and preview reference documentation — decide which checks to run
- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs

### 3. Act — execute with `api-rest-generation` tools
- Tools: `Glob`, `Grep`, `Read`, `Npx` (see frontmatter `tools`/`allowed-tools`)
- Use `safe_path` for any write; record evidence (paths, checksums)
- Fingerprint: `api-rest-generation:160d6aa4`

# API REST v5 - Clients & Docs

Code and doc generation from OpenAPI.

## What This Skill Does
- Generates clients for TS, Python, Go, Java
- Builds static docs from the spec
- Keeps generated artifacts in sync

## When to Use
- Releasing official SDKs
- Sharing docs with consumers
- Multi-language client support

## Real Commands

```bash
npx @openapitools/openapi-generator-cli generate -i openapi.yaml -g typescript-fetch -o ./client-ts
npx @openapitools/openapi-generator-cli generate -i openapi.yaml -g python -o ./client-py
npx @redocly/cli build-docs openapi.yaml -o dist/api.html
```

## Generation Config

```yaml
inputSpec: openapi.yaml
generators:
  typescript-fetch:
    output: client-ts
    additionalProperties:
      useSingleRequestParameter: true
```

## Testing
- Compile each generated client
- Run a smoke call against the live API
- Diff generated output on spec changes

## Best Practices
- Commit generated clients in SDK repos
- Regenerate on tagged releases only
- Validate specs before generation

## Capabilities

### client-generation
Generate typed API clients in multiple languages

**Parameters:**
- `input-spec` (string): OpenAPI file path
- `generator` (string): Target language generator
- `output` (string): Output directory

**Commands:**
- `npx @openapitools/openapi-generator-cli generate -i openapi.yaml -g typescript-fetch -o ./client-ts`
- `npx @openapitools/openapi-generator-cli generate -i openapi.yaml -g python -o ./client-py`
- `npx @openapitools/openapi-generator-cli generate -i openapi.yaml -g go -o ./client-go`
- `npx @openapitools/openapi-generator-cli generate -i openapi.yaml -g java -o ./client-java`
- `npx @openapitools/openapi-generator-cli config-help -g typescript-fetch`

**Examples:**
- -g typescript-fetch produces a fetch-based TS client
- -g python generates a requests-based client
- config-help documents generator options

### docs-deployment
Build and preview reference documentation

**Commands:**
- `npx @redocly/cli build-docs openapi.yaml -o dist/api.html`
- `npx @redocly/cli preview-docs openapi.yaml`
- `npx @redocly/cli bundle openapi.yaml -o dist/openapi.bundle.yaml`
- `npx @redocly/cli lint openapi.yaml`

**Examples:**
- -cli --help
- -api --help

## References
- [OpenAPI Generator CLI](https://openapi-generator.tech/docs/usage/)
- [Redocly CLI](https://redocly.com/docs/cli/)

