# API REST Architect

> Architects REST APIs with an OpenAPI-first workflow: spectral linting, Redocly validation, swagger-cli checks, and HTML reference docs generated from one contract. Use when working with openapi validation, docs generation or when the user mentions openapi validation, docs generation.

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

---


Architects REST APIs with an OpenAPI-first workflow: spectral linting, Redocly validation, swagger-cli checks, and HTML reference docs generated from one contract.

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

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

### 1. Read — backend context for `api-rest-architect`
- Domain: Architects REST APIs with an OpenAPI-first workflow: spectral linting, Redocly validation, swagger-cli checks, and HTML reference docs generated from one contract.
- **openapi-validation**: Lint and validate the OpenAPI contract before implementation — `npx @stoplight/spectral-cli lint openapi.yaml -r .spectral.yml`
- **docs-generation**: Generate interactive reference documentation from the spec — `npx @redocly/cli build-docs openapi.yaml -o api-docs.html`
- Check `knowledge` and `prerequisites: node.js, python, openapi, express`

### 2. Reason — think for `api-rest-architect`
- For `openapi-validation`: Lint and validate the OpenAPI contract before implementation — decide which checks to run
- For `docs-generation`: Generate interactive reference documentation from the spec — decide which checks to run
- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs

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

# API REST Architect

Contract-first REST API design.

## What This Skill Does
- Designs APIs from the OpenAPI contract first
- Enforces architectural rules with spectral
- Generates living docs from the spec

## When to Use
- Designing new APIs before implementation
- Enforcing consistent API conventions across teams
- Publishing API contracts to consumers

## Real Commands

```bash
npx @stoplight/spectral-cli lint openapi.yaml -r .spectral.yml
npx swagger-cli validate openapi.yaml
npx @redocly/cli bundle openapi.yaml -o bundled.yaml
```

## Architectural Rules
- Resource naming: plural nouns, kebab-case paths
- Consistent error schema across operations
- Explicit response codes for every operation

## Testing
- Run lint as a required CI gate
- Validate the bundled spec after generation
- Diff spec versions to review breaking changes

## Best Practices
- Review the spec before writing code
- Reuse shared components for common responses
- Version the API in the URL or media type

## Capabilities

### openapi-validation
Lint and validate the OpenAPI contract before implementation

**Parameters:**
- `spec` (string): Path to the OpenAPI document
- `ruleset` (string): Spectral ruleset file
- `extends` (string): Redocly config preset

**Commands:**
- `npx @stoplight/spectral-cli lint openapi.yaml -r .spectral.yml`
- `npx @redocly/cli lint openapi.yaml --extends recommended`
- `npx swagger-cli validate openapi.yaml`
- `npx @redocly/cli bundle openapi.yaml -o bundled.yaml`

**Examples:**
- spectral lint catches naming and schema rule violations
- swagger-cli validate confirms syntactically valid OpenAPI
- redocly bundle inlines external references

### docs-generation
Generate interactive reference documentation from the spec

**Commands:**
- `npx @redocly/cli build-docs openapi.yaml -o api-docs.html`
- `npx @redocly/cli preview-docs openapi.yaml`
- `curl -s http://localhost:8080/docs -o /dev/null -w '%{http_code}\n'`

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

## References
- [OpenAPI Specification](https://spec.openapis.org/oas/v3.1.0)
- [Spectral Documentation](https://docs.stoplight.io/docs/spectral/)

