# API Gov Specialist

> Deep expertise in API governance: authoring style guides, custom Spectral rulesets, and API review automation at scale. Use when working with ruleset authoring, review automation or when the user mentions ruleset authoring, review automation.

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

---


Deep expertise in API governance: authoring style guides, custom Spectral rulesets, and API review automation at scale.

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

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

### 1. Read — backend context for `api-gov-specialist`
- Domain: Deep expertise in API governance: authoring style guides, custom Spectral rulesets, and API review automation at scale.
- **ruleset-authoring**: Write custom Spectral rulesets with functions for org-specific API conventions — `npx @stoplight/spectral-cli lint --ruleset .spectral.yaml openapi.yaml`
- **review-automation**: Automate API design review in PRs with linting and diff checks — `git diff --name-only --diff-filter=ACM origin/main HEAD | grep -E '\.(yaml|yml)$`
- Check `knowledge` and `prerequisites: spectral, openapi`

### 2. Reason — think for `api-gov-specialist`
- For `ruleset-authoring`: Write custom Spectral rulesets with functions for org-specific API conventions — decide which checks to run
- For `review-automation`: Automate API design review in PRs with linting and diff checks — decide which checks to run
- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs

### 3. Act — execute with `api-gov-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-gov-specialist:d826069a`

# API Gov Specialist

Designs and operates API governance programs: style guides, custom linting, and automated review.

## When to Use
- Building org-wide API standards
- Custom rule enforcement beyond defaults
- Scaling review across many teams

## Real Commands

```bash
# Lint with custom ruleset
npx @stoplight/spectral-cli lint --ruleset .spectral.yaml openapi.yaml

# JSON report for dashboards
npx @stoplight/spectral-cli lint -r .spectral.yaml --format json openapi.yaml > report.json

# Detect breaking changes between versions
openapi-diff --fail-on-incompatible v1.yaml v2.yaml

# CI-friendly output
redocly lint --extends=recommended openapi.yaml --output-style=github-actions
```

## Ruleset Example

```yaml
# .spectral.yaml
extends: [[spectral:oas, recommended]]
rules:
  no-internal-paths:
    message: Internal paths must be prefixed /internal
    given: $.paths[*]~
    severity: error
    then:
      function: pattern
      functionOptions: {match: "^(/internal|/v[0-9]+)"}
```

## Testing
Keep a fixture spec with intentional violations to verify rules fire correctly.

## Best Practices
- Version the ruleset like code
- Review new rules against existing specs before enabling as error

## Capabilities

### ruleset-authoring
Write custom Spectral rulesets with functions for org-specific API conventions

**Parameters:**
- `ruleset` (string): Custom ruleset file
- `spec` (string): Spec to lint

**Commands:**
- `npx @stoplight/spectral-cli lint --ruleset .spectral.yaml openapi.yaml`
- `npx @stoplight/spectral-cli lint -r .spectral.yaml --format json openapi.yaml > report.json`
- `npx @stoplight/spectral-cli lint --ruleset .spectral.yaml --verbose openapi.yaml`
- `node -e "const s=require('@stoplight/spectral'); console.log(s.version)"`
- `npx @stoplight/spectral-cli lint --ruleset .spectral.yaml --fail-severity warn openapi.yaml`

**Examples:**
- npx @stoplight/spectral-cli lint -r .spectral.yaml --format json openapi.yaml > report.json && jq '.summary' report.json
- npx @stoplight/spectral-cli lint -r .spectral.yaml --verbose openapi.yaml
- npx @stoplight/spectral-cli lint -r .spectral.yaml --fail-severity error openapi.yaml

### review-automation
Automate API design review in PRs with linting and diff checks

**Parameters:**
- `baseRef` (string): Baseline branch
- `failOn` (string): Failure threshold

**Commands:**
- `git diff --name-only --diff-filter=ACM origin/main HEAD | grep -E '\.(yaml|yml)$' | xargs npx @stoplight/spectral-cli lint`
- `openapi-diff --fail-on-incompatible --ignore-path path-to-ignore.json old.yaml new.yaml`
- `npx @stoplight/spectral-cli lint --summary --fail-severity error openapi.yaml`
- `redocly lint --extends=recommended openapi.yaml --output-style=github-actions`
- `swagger-cli validate $(git diff --name-only HEAD~1 | grep openapi.yaml)`

**Examples:**
- git diff --name-only origin/main HEAD | grep openapi.yaml | xargs npx @stoplight/spectral-cli lint --fail-severity error
- openapi-diff --fail-on-incompatible prod.yaml pr.yaml
- redocly lint --extends=recommended openapi.yaml --output-style=github-actions

## References
- [Spectral Functions](https://docs.stoplight.io/docs/spectral/reference/functions)
- [OpenAPI Diff](https://github.com/OpenAPITools/openapi-diff)
- [OpenAPI Style Guide Examples](https://opensource.zalando.com/restful-api-guidelines/)

