Lint an OpenAPI 3.0/3.1 JSON document against ten style rules (operationId, kebab-case paths, tags, summaries, response descriptions) and apply safe idempotent autofixes. Use when reviewing or cleaning an API spec or enforcing naming conventions.
95%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Check an OpenAPI document against a small, fixed style guide and fix the mechanical problems
safely. The bundled script runs ten rules (OAS001 to OAS010) and four autofixes. It works on
its own: nothing to install or build.
Get the spec as a JSON file. If it is YAML, convert it to JSON first; the script reads JSON only and never edits the original file.
Lint:
python3 scripts/openapi_style_lint.py lint openapi.jsonEach line is RULE severity pointer message, sorted by JSON pointer. Add
--format json for machine-readable output. Silence or re-grade a rule with
--rule OAS005=off or --rule OAS003=error (repeatable; levels error, warn, off).
Fix what is safe:
python3 scripts/openapi_style_lint.py fix openapi.json > openapi.fixed.jsonThe fixed document goes to stdout; the list of applied fixes goes to stderr. The input file is not touched. Show the user a diff between the two files and let them accept it.
Re-run lint on the fixed file. Whatever remains needs a human decision: see below.
Exit codes: 0 clean (or fix done), 1 at least one error-level finding, 2 usage or input
error (unreadable file, invalid JSON, not OpenAPI 3.0/3.1, nesting over 128, file over
10 MiB).
Rule ids, default severities and fix behaviour are in references/rules.md.
Fixed automatically and safely: OAS004 trailing slash on a path, OAS002 operationId not
camelCase, OAS006 operation tag missing from the top-level tags, OAS008 response without a
description. A fix is skipped when it would collide with something that already exists (for
example /users/ is not renamed when /users is already defined).
Never fixed automatically, so propose wording and ask the user: OAS001 missing operationId,
OAS003 path segment not kebab-case (renaming a path breaks clients), OAS005 missing summary,
OAS007 path template parameter without an in: path declaration, OAS009 duplicate
operationId, OAS010 property name not camelCase.
Renaming an operationId or a path can change generated client code. Say so when you apply or suggest it.
$ref resolution (rules look at the document as
written).This skill bundles a standard-library port of the rules implemented by the openapi-style-lint package: https://github.com/Trysac/u149-openapi-style-lint