json-schema-author

Installation
SKILL.md

JSON Schema Author

Overview

Keywords: JSON Schema, Draft 2020-12, Draft-07, $schema, $ref, $defs, validation, config schema, API schema, OpenAPI, additionalProperties, oneOf, anyOf, allOf, if/then/else, format, pattern, const, enum, error messages, ajv, jsonschema.

This skill helps you design correct, strict, and maintainable JSON Schemas for two dominant use cases: configuration files (validate user/operator input, fail fast with helpful messages) and APIs (contract for request/response bodies, often embedded in OpenAPI). It covers the type system, every important constraint keyword, schema composition, reuse via $ref/$defs, conditional validation, and turning raw validator output into actionable error messages.

Use the bundled material:

  • references/keywords.md — complete keyword reference (types, constraints, composition, applicators, annotations, draft differences) with copy-paste snippets.
  • references/error-messages.md — patterns for clear, user-facing validation errors and how to map validator output to them.
  • templates/config-schema.json — a strict, annotated starting point for a config-file schema.
  • templates/api-schema.json — request/response schema pattern suitable for OpenAPI components.schemas.
  • scripts/validate.py — stdlib-only structural linter that flags the most common schema authoring mistakes; falls back to jsonschema if installed for real validation.
  • examples/config-walkthrough.md — sample config JSON turned into a finished schema with passing and failing instances.

Workflow

  1. Pick the draft. Default to Draft 2020-12 for new schemas ($schema: "https://json-schema.org/draft/2020-12/schema"). Use Draft-07 when targeting tooling that lags (older ajv configs, many OpenAPI 3.0 toolchains). OpenAPI 3.1 aligns with 2020-12. Note the differences: 2020-12 uses $defs and prefixItems/items; Draft-07 uses definitions and items (array)/additionalItems. See references/keywords.md.
Installs
2
GitHub Stars
26
First Seen
Oct 29, 2026