# API Schema Specialist

> Reviews and hardens API schemas with spectral: OpenAPI rulesets, custom rules, JSON output for CI, and schema quality gating. Use when working with spectral linting, schema review or when the user mentions spectral linting, schema review.

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

---


Reviews and hardens API schemas with spectral: OpenAPI rulesets, custom rules, JSON output for CI, and schema quality gating.

## Agentic Workflow: Read -> Reason -> Act (api-schema-specialist)

You are **api-schema-specialist** (data) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.

### 1. Read — data context for `api-schema-specialist`
- Domain: Reviews and hardens API schemas with spectral: OpenAPI rulesets, custom rules, JSON output for CI, and schema quality gating.
- **spectral-linting**: Lint OpenAPI schemas with spectral — `npx @stoplight/spectral-cli lint openapi.yaml -r .spectral.yml`
- **schema-review**: Enforce schema quality rules — `npx @stoplight/spectral-cli lint openapi.yaml -r quality-rules.yaml`
- Check `knowledge` and `prerequisites: openapi, json-schema, node.js, python`

### 2. Reason — think for `api-schema-specialist`
- For `spectral-linting`: Lint OpenAPI schemas with spectral — decide which checks to run
- For `schema-review`: Enforce schema quality rules — decide which checks to run
- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs

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

# API Schema Specialist

Schema linting and review with spectral.

## What This Skill Does
- Lints OpenAPI contracts for consistency
- Enforces custom schema rules
- Exports reports for CI gating

## When to Use
- Reviewing schema PRs
- Enforcing API design standards
- Auditing legacy specs

## Real Commands

```bash
npx @stoplight/spectral-cli lint openapi.yaml -r .spectral.yml
npx @stoplight/spectral-cli lint openapi.yaml -f json -o report.json
npx @stoplight/spectral-cli lint openapi.yaml --fail-severity=warn
```

## Custom Rule

```yaml
rules:
  schemas-need-description:
    given: $.components.schemas[*]
    severity: error
    then:
      field: description
      function: truthy
```

## Testing
- Fail builds on error-severity violations
- Review JSON reports for triage
- Add rules incrementally

## Best Practices
- Extend a base ruleset before adding custom rules
- Document rule intent in comments
- Run lint in pre-merge checks

## Capabilities

### spectral-linting
Lint OpenAPI schemas with spectral

**Parameters:**
- `spec` (string): OpenAPI file to lint
- `ruleset` (string): Spectral ruleset path
- `format` (string): stylish, json, junit

**Commands:**
- `npx @stoplight/spectral-cli lint openapi.yaml -r .spectral.yml`
- `npx @stoplight/spectral-cli lint openapi.yaml -f json -o report.json`
- `npx @stoplight/spectral-cli lint openapi.yaml -f junit -o junit.xml`
- `npx @stoplight/spectral-cli lint openapi.yaml --fail-severity=warn`

**Examples:**
- -f json exports machine-readable results
- --fail-severity=warn makes warnings fail CI
- -f junit integrates with test reports

### schema-review
Enforce schema quality rules

**Commands:**
- `npx @stoplight/spectral-cli lint openapi.yaml -r quality-rules.yaml`
- `curl -s http://localhost:3000/openapi.json -o openapi.json`
- `npx @stoplight/spectral-cli lint openapi.json -r .spectral.yml`

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

## References
- [Spectral Docs](https://docs.stoplight.io/docs/spectral/)
- [Spectral CLI](https://github.com/stoplightio/spectral)

