openapi-format
Follow this skill when a user asks to transform an OpenAPI document with the openapi-format CLI.
Core workflow
- •Identify the target outcome first.
- •Determine exactly what should change: order, filtering, casing, generation, overlay, conversion, rename, output format, split.
- •Determine input source (local file, remote URL, or overlay
extendsfallback).
- •Choose command shape.
- •Prefer a single command with explicit input/output unless the user asks for stdout.
- •Use
--configFilefor reusable workflows. - •Use
.openapiformatrcfor project defaults.
- •Keep config minimal.
- •Start from defaults.
- •Add only keys required for requested behavior.
- •Avoid writing exhaustive config unless requested.
- •Apply correct precedence.
- •Load
.openapiformatrconly when--configFileis not supplied. - •Load and merge
--configFilevalues. - •Apply CLI options last.
- •Normalize
--no-sortand--no-bundleintosort=falseandbundle=false.
- •Respect processing order.
- •
generate -> filter -> overlay -> sort -> casing -> convertTo -> rename -> write/split/stdout
- •Produce the output safely.
- •Use
--outputfor file writes. - •If
--splitis true, require--outputand treat it as split target root. - •Use
--jsonor--yamlfor stdout output formatting.
Decision rules
Filter semantics
- •Treat
methods,tags,operationIds,operations,flags,flagValues,responseContent, andrequestContentas removal filters. - •Treat
inverseMethods,inverseTags,inverseOperationIds,inverseFlags,inverseFlagValues,inverseResponseContent, andinverseRequestContentas keep filters. - •Use
unusedComponentsto remove unreferenced components recursively (iterative cleanup). - •Use
stripFlagsto delete marker fields after filtering.
Overlay behavior
- •Accept
--overlayFilewithactions. - •If input file is omitted and overlay has
extends, useextendsas effective input. - •Resolve local
extendsrelative to overlay file directory.
Sorting and components
- •Default sorting comes from
defaultSort.json. - •
sortPathsBycontrols path ordering (original,path,tags). - •
--sortComponentsFilecontrols which component groups are alphabetized. - •
--sortComponentsPropsalphabetizes schema properties incomponents.schemas.*.properties.
Output constraints
- •
--splitrequires--output. - •
--keepCommentsonly affects YAML comment preservation. - •
--lineWidthcontrols YAML line wrapping (-1means unlimited).
Use references
Open only what is needed:
- •
references/feature-matrix.mdfor option behavior, defaults, and interactions. - •
references/config-patterns.mdfor minimal config templates. - •
references/command-recipes.mdfor runnable command patterns. - •
references/troubleshooting.mdfor failure diagnosis and fixes.
Delivery checklist
- •Return the exact command(s) to run.
- •Return minimal config file contents if config files are needed.
- •Explain expected transformation result in plain terms.
- •Call out side effects (component pruning, split output tree, version conversion changes).
- •Highlight any assumptions (input path, output path, format, bundle behavior).