Agent skill
spectral
Use when configuring Spectral for API linting, creating custom rulesets, and validating OpenAPI or AsyncAPI specifications
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/spectral
SKILL.md
Spectral API Linting
Quick Start
# .spectral.yaml
extends: spectral:oas
rules:
operation-operationId: error
info-contact: warn
oas3-api-servers: off
Core Concepts
- Rulesets: Collections of rules; extend built-in (
spectral:oas,spectral:asyncapi) - Severity:
error,warn,info,hint, oroffto disable - Given: JSONPath expression targeting what to validate
- Then: Functions and conditions to check
Custom Rules
rules:
must-have-description:
description: All operations must have descriptions
given: $.paths[*][get,post,put,patch,delete]
severity: error
then:
field: description
function: truthy
path-must-be-kebab-case:
given: $.paths[*]~
then:
function: pattern
functionOptions:
match: "^(/[a-z0-9-]+)+$"
Built-in Functions
truthy/falsy- Value exists / is emptypattern- Regex matchinglength- String/array length constraintsenumeration- Value in allowed listschema- Validate against JSON Schemaalphabetical- Keys in orderundefined- Property must not exist
CLI Usage
spectral lint openapi.yaml
spectral lint openapi.yaml --ruleset .spectral.yaml
spectral lint openapi.yaml -f json # JSON output
Reference Files
- references/functions.md - All built-in functions
- references/custom-functions.md - Writing custom functions
- references/jsonpath.md - JSONPath expressions
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?