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
knowledgeandprerequisites: 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 doctorpatterns for your inputs
3. Act — execute with api-schema-specialist tools
- Tools:
Glob,Grep,Read,Npx,Bash(see frontmattertools/allowed-tools) - Use
safe_pathfor 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
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
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 lintruleset(string): Spectral ruleset pathformat(string): stylish, json, junit
Commands:
npx @stoplight/spectral-cli lint openapi.yaml -r .spectral.ymlnpx @stoplight/spectral-cli lint openapi.yaml -f json -o report.jsonnpx @stoplight/spectral-cli lint openapi.yaml -f junit -o junit.xmlnpx @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.yamlcurl -s http://localhost:3000/openapi.json -o openapi.jsonnpx @stoplight/spectral-cli lint openapi.json -r .spectral.yml
Examples:
- -cli --help
- -api --help