JSON Schema
JSON Schema, published by the JSON Schema organization at json-schema.org, is a JSON-based format for describing JSON data: keywords assert constraints on an instance, annotate it, or apply subschemas to parts of it (Core § 3). The specification is split into Core (identifiers, references, applicators, output) and Validation (assertions, format, content and meta-data annotations). With this skill the agent writes, reviews, bundles and upgrades schemas, and configures validators so they evaluate them as the dialect intends.
Follow the workflow below step by step. Every rule here comes from a source in Sources, with the section it cites. "Core" and "Validation" mean the 2020-12 documents (draft-bhutton-json-schema-01 and draft-bhutton-json-schema-validation-01) unless a rule names another line. When a rule and the pinned source disagree, the source wins; when the source has a newer revision than the pin, follow the refresh steps.
Inputs (fill in, or ask before starting)
- Role: schema author, validator or tooling implementer, or reviewer.
- Target version: JSON Schema 2020-12 (current, default). JSON Schema 2019-09 is supported: use it only for a named consumer that cannot read 2020-12. JSON Schema draft-07, JSON Schema draft-06 and JSON Schema draft-04 are legacy: read them and upgrade from them, never author them. IETF draft-ietf-jsonschema-json-schema-03 and JSON Schema v1/2026 (work in progress) are previews (posture: track): never emit their dialect URIs. See
references/versions.md. - Revision: the pinned revision in Sources, unless the user names another.
- Consumer: plain validator, OpenAPI 3.1 or later document (Schema Objects are a superset of 2020-12), code generator, or form or UI renderer. This decides which annotations matter.
formatbehaviour: annotation only (default) or assertion (needs a dialect that declares the Format-Assertion vocabulary, or an explicit validator option).- Sources: when refreshing this skill or when a rule looks out of date, re-read every URL in Sources first, check json-schema.org/specification for a newer release, check the IETF datatracker for a newer revision of the WG draft, check
json-schema-org/json-schema-specfor a v1 release, and update the pins.
Invariants
- A schema is an object or a boolean (Core § 4.3).
truepasses everything like{};falsefails everything like{ "not": {} }(Core § 4.3.2). - Declare the dialect with
$schemaat the document root. Its value is a normalized URI with a scheme, and the schema MUST validate against that meta-schema (Core § 8.1.1). It MUST NOT appear in a subschema that is not a resource root; without it, behaviour is implementation-defined. $idis an absolute URI with no fragment. It MUST NOT contain a non-empty fragment, SHOULD NOT contain an empty one, and the root schema SHOULD have one (Core § 8.2.1, § 8.2.1.1). Plain-name fragments come from$anchor(Core § 8.2.2).- References are identifiers, not downloads. Resolve
$refagainst the current base URI; implementations SHOULD NOT assume a network fetch (Core § 8.2.3, § 9.1.2). Keywords next to$refare evaluated too (Core § 8.2.3.1). - Reusable subschemas live in
$defs(Core § 8.2.4);definitionsis kept only for transition in the default meta-schema (Validation Appendix A). - Assertions only constrain their own type (Core § 7.6.1).
maxLengthpasses a number; restrict the type withtype. - Regular expressions are ECMA-262 and never implicitly anchored (Core § 6.4, Validation § 6.3.3). Write
^…$when the whole string must match. additionalPropertiessees only adjacentpropertiesandpatternProperties(Core § 10.3.2.3). To close an object acrossallOf,$refor conditionals, useunevaluatedProperties(Core § 11.3).formatis an annotation by default. Implementations MUST disable format assertion by default; only the Format-Assertion vocabulary makes it a required assertion (Validation § 7.2.1, § 7.2.2). Never rely onformatalone to reject bad input.- Content keywords never fail validation. A malformed string-encoded document MUST NOT make the instance invalid, and implementations MUST NOT decode it by default (Validation § 8.1, § 8.2).
- A bundled schema behaves exactly like the unbundled one. Embed each external resource with its
$id(RECOMMENDED under$defs) and do not change any$ref(Core § 9.3.1). - Validators MUST NOT loop forever and SHOULD bound resource use; servers MUST ensure an uploaded schema with a pre-existing or very similar
$idcannot change existing schemas (Core § 13). Patterns can backtrack catastrophically (Validation § 10). $commentis never shown to end users and never collected as an annotation (Core § 8.3).
Workflow
- Pick the version. Use 2020-12 unless a named consumer needs 2019-09; set
"$schema": "https://json-schema.org/draft/2020-12/schema". ->references/versions.md✓ The target version is recorded, and it is not a legacy or preview line. - Identify the resources. Give the root an absolute
$id, put reusable parts in$defs, add$anchorwhere a location-independent name helps, and decide how external schemas are supplied to the validator. ->references/core-and-refs.md✓ Every$refresolves against a known$idwithout a network fetch, and no two schemas share a URI (Core § 9.1.2). - Write the structure. Use
type,properties,required,prefixItems,items, bounds andenumorconst, choosing keywords per instance type. ->references/validation-keywords.md✓ Every assertion that should restrict a type sits next to a matchingtype, and everypatternis anchored on purpose. - Compose and close. Combine with
allOf,anyOf,oneOf,not,if/then/elseanddependentSchemas; close objects and arrays withunevaluatedPropertiesorunevaluatedItemswhen subschemas contribute properties. ->references/unevaluated-and-composition.md✓ Valid and invalid sample instances behave as intended, including an instance with a misspelled property. - Decide on
formatand output. Treatformatas an annotation and validate in the application, or declare a dialect with Format-Assertion; pick the output format consumers need. ->references/output-and-formats.md✓ The validator'sformatsetting is documented, and error consumers readinstanceLocationandkeywordLocation. - Bundle or extend (when needed). Bundle external resources into
$defsof the root, or write a meta-schema with$vocabularyfor a custom dialect. ->references/core-and-refs.md✓ The bundle gives the same results and output locations as the separate files, and each embedded resource validates against its own meta-schema (Core § 9.3.3). - Upgrade (only when asked). Follow the upgrade section for each step from the source version to the target, one line at a time.
->
references/versions.md✓ The upgraded schema validates against the target meta-schema and accepts and rejects the same instances as before.
Verify before done
- The root has
$schemaset to the target meta-schema URI and an absolute$idwith no fragment. - The schema validates against its meta-schema; each embedded resource in a bundle validates against its own (Core § 9.3.3).
- No
definitions,dependencies, array-formitems,additionalItems,$recursiveRefor$recursiveAnchorremains in a 2020-12 schema. - Every
$refand$dynamicRefresolves offline; every$dynamicRefto a dynamic anchor has a matching$dynamicAnchor. - Objects that must be closed across composition use
unevaluatedProperties: false, notadditionalProperties: falseinside each branch. - Nothing depends on
formatrejecting input unless the dialect declares Format-Assertion or the validator option is documented as on. - Positive and negative sample instances were run through a 2020-12 validator.
- Nothing from a preview line is emitted: no
https://json-schema.org/v1/2026$schema, and no reliance on draft-only rules such asx-keywords as implicit annotations.
Reference index
references/versions.md: every version line with its$schemaURI and status, which to use, what changed per release, upgrade checklists from draft-04 to 2020-12, and the two previews. Load for steps 1 and 7.references/core-and-refs.md:$schema,$vocabularyand dialects,$id,$anchor,$ref,$dynamicRef,$defs,$comment, base URIs, dereferencing, Compound Schema Documents and bundling, security. Load for steps 2 and 6.references/validation-keywords.md: every Validation assertion by instance type, content and meta-data annotations, and common mistakes. Load for step 3.references/unevaluated-and-composition.md: in-place and child applicators, conditionals,additionalPropertiesversusunevaluatedProperties,containswithunevaluatedItems, and recursive extension with$dynamicRef. Load for step 4.references/output-and-formats.md: Format-Annotation and Format-Assertion, the defined formats, custom formats, and the flag, basic, detailed and verbose output structures. Load for step 5.
Related skills
openapifor OpenAPI 3.1 and later, whose Schema Object is a superset of JSON Schema 2020-12 with its own dialect andjsonSchemaDialect:npx skills add ScaleDockHQ/scaledock-skills --skill openapi.standard-schemafor generating JSON Schema (draft-2020-12, draft-07) from validator libraries through Standard JSON Schema:npx skills add ScaleDockHQ/scaledock-skills --skill standard-schema.json, when the work also follows that specification:npx skills add ScaleDockHQ/scaledock-skills --skill jsonjson-pointer, when the work also follows that specification:npx skills add ScaleDockHQ/scaledock-skills --skill json-pointer
Sources
Status uses the publishing body's own maturity term. Checked is the date the source was last read.
- JSON Schema Specification page: json-schema.org index, states "The current version is 2020-12! The previous version was 2019-09.", checked 2026-10-05.
- JSON Schema Core 2020-12: Released (Internet-Draft draft-bhutton-json-schema-01, 16 June 2022), checked 2026-10-05.
- JSON Schema Validation 2020-12: Released (Internet-Draft draft-bhutton-json-schema-validation-01, 16 June 2022), checked 2026-10-05.
- 2020-12 meta-schema: Released, vocabularies as of 2026-10-05, checked 2026-10-05.
- 2020-12 Release Notes: release notes, checked 2026-10-05.
- 2019-09 Release Notes: release notes, checked 2026-10-05.
- 2019-09 meta-schema: Released (17 September 2019), checked 2026-10-05.
- Draft-07 Release Notes: release notes, checked 2026-10-05.
- JSON Schema Core draft-07: Released (draft-handrews-json-schema-01, 19 March 2018), checked 2026-10-05.
- Draft-06 Release Notes: release notes (draft-04 to draft-06 migration), checked 2026-10-05.
- JSON Schema Core draft-04: Released (draft-zyp-json-schema-04, 31 January 2013), checked 2026-10-05.
- JSON Schema Validation draft-04: Released (draft-fge-json-schema-validation-00, 31 January 2013), checked 2026-10-05.
- Specification Links: json-schema.org index of every draft, its IETF names and dates, checked 2026-10-05.
- draft-ietf-jsonschema-json-schema (datatracker): IETF jsonschema WG Document, I-D Exists, intended Proposed Standard, revision -03 (26 August 2026), checked 2026-10-05.
- draft-ietf-jsonschema-json-schema datatracker API: rev 03, expires 2027-02-27, checked 2026-10-05.
- draft-ietf-jsonschema-json-schema-03 text: WG draft, -03, checked 2026-10-05.
- json-schema-org/json-schema-spec: work in progress toward v1/2026,
mainat 4f56a99 (2026-09-04), no release published, checked 2026-10-05. - OpenAPI Specification 3.1.1: OAI Released, 3.1.1, cited for the Schema Object's 2020-12 base, checked 2026-10-05.