yaml-json-schema
Skill0 starsChanged 3 months agoMITView on GitHub
Authors, audits, refactors, and validates YAML-encoded JSON Schema 2020-12 documents per `spec/project/yaml-json-schema/`. Scaffolds a new `<slug>-v1.0.schema.yaml` with all mandatory skeleton entries in spec order; audits existing `*.schema.yaml` files for dialect drift, missing identity, inline duplicates, and missing property descriptions; refactors duplicates into `$defs`; runs meta-validation and data-conformance validation. Invoke for: "scaffold a JSON Schema in YAML", "audit our schemas", "extract a `$defs` entry", "validate this YAML against a schema", or German equivalents ("YAML-Schema anlegen", "Schemata auditieren", "Daten gegen Schema validieren"). Skip for: OpenAPI/AsyncAPI Schema Objects, JSON-encoded schemas, feature-frontmatter rules (`spec/project/feature/`), or project-structure scaffolding (`project-structure-apply`). Supports resume on re-invocation per `spec/claude/resumable-work/`.
- Installs packages
In this repository36 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- audience-identifySkill
- backlog-delivery-orchestrateSkill
- backstage-catalog-generateSkill
- blog-authorSkill
- blog-author-triggerSkill
- cicd-pipeline-designSkill
- continuous-improvement-triageSkill
- cookiecutter-template-manageSkill
- docs-audience-tracks-applySkill
- docs-dry-refactorSkill
- github-issue-templates-applySkill
- issue-backlog-partitionSkill
- issue-batch-orchestrateSkill
- issue-orchestrateSkill
- lektorat-applySkill
- lektorat-auto-reviseSkill
- mermaid-diagrams-applySkill
- mkdocs-structure-applySkill
- permission-allowlist-maintainSkill
- portfolio-auditSkill
- portfolio-inflight-triageSkill
- project-structure-applySkill
- pull-request-createSkill
- pull-request-mergeSkill
- pull-request-runner-sweepSkill
- readme-structure-applySkill
- release-notes-curateSkill
- release-publish-triggerSkill
- requirements-elicitSkill
- spec-drift-auditSkill
- specSkill
- tech-stack-captureSkill
- vocab-drift-auditSkill
- workflow-health-triageSkill
- working-copy-startSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 1 is distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 45
When the spec isn't present in the target repository, fall back to the copy shipped by the nolte-shared plugin (read it at runtime from the …
- Very specific: line 61
Read the spec's canonical-language version (en.md) and treat it as authoritative.
- Very specific: line 62
Check whether Taskfile.yml exposes a lint target.
- Very specific: line 63
Check for uncommitted changes under any directory the skill will write to (/schemas/, Taskfile.yml, README.md or schemas/README.md).
- Very specific: line 68
Read references/operations.md when executing any of the operations below in detail.
- Very specific: line 76
Read-only walk of every /*.schema.yaml.
- Very specific: line 100
Read examples/01-meta-validation.md when running a meta-validation pass for the first time on a new schema.
- Very specific: line 101
Read examples/02-data-against-schema.md when wiring up sidecar-comment-based schema associations for the first time.
- Very specific: line 102
Read examples/03-schema-lifecycle.md when revising an existing schema (minor or major bump).
- Very specific: line 106
Validator precedence: When multiple validators are installed (task lint, check-jsonschema, ajv, python -m jsonschema), the skill uses the …
- Distinctive: line 127
Never: treat absence of an installed validator as a passing gate.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
YAML JSON Schema
Operationalises spec/project/yaml-json-schema/<canonical_language>.md. The skill covers the full lifecycle of a YAML-encoded JSON Schema 2020-12 document — authoring a new schema, auditing an existing one against the spec, refactoring duplicates into $defs, and validating both the schema itself and any data files it governs — through one explicit, per-step interactive surface.
Why this is a skill, not an agent
- Per-step user approval is the contract. Every file change — a new schema, a
$defsextraction, a$refrewrite, a meta-validation fix — is shown to the user before it lands. The audit step is read-only; the apply steps are sequences of approvals an agent's fire-and-forget shape can't carry. - Mid-flow type and identity choices are load-bearing. Picking
type: objectvsoneOf, choosing the right$idslug and version segment, and deciding whether a property warrants$defsextraction are interactive judgment calls against the spec. Skill form preserves the dialogue surface; an autonomous agent would obscure it. - The output flows back into the main conversation. The audit table, refactor proposals, and validation reports surface inline so the user can redirect the slug, the version bump, or the choice of validator without re-entering an agent boundary.
- Counter-dimension considered: a narrower audit-only agent could specialise on reading every
*.schema.yamland producing a structured report, gaining on context-window protection. The high-impact part is the authoring and refactoring dialogue, not the report; skill wins.
When the spec isn't present in the target repository, fall back to the copy shipped by the nolte-shared plugin (read it at runtime from the plugin install path, or from the nolte/claude-shared repository). Never invent requirements that aren't in the spec.
User-language policy
Detect the user's language and respond in it. Generated content is split:
- Schema file content (
$schema,$id,title, property names,descriptionstrings,examples) is always English. JSON Schema is an interlingua and the spec treatstitle/descriptionas technical-identifier territory so that consumers across the portfolio read them the same way regardless of conversation language. - Surrounding prose (audit findings, refactor proposals, validation reports surfaced to the user) follows the conversation language.
- YAML header comments generated by the skill (
# Schema for <object name>; consumed by <consumer>) are English so they read consistently ingit diffand IDE views.
Preconditions
Before doing anything:
- Confirm the working directory is a git repository (
git rev-parse --is-inside-work-tree). - Locate
spec/project/yaml-json-schema/. The spec lives either in the target repo or in the nolte-shared plugin; if neither is reachable, stop and ask the user which spec source to use. - Read the spec's canonical-language version (
en.md) and treat it as authoritative. The translation (de.md) is structure-identical but not the source of truth. - Check whether
Taskfile.ymlexposes alinttarget. The skill plugs schema meta-validation and data-conformance validation into the same target rather than inventing a new one; if no target exists, ask the user before scaffolding one. - Check for uncommitted changes under any directory the skill will write to (
**/schemas/,Taskfile.yml,README.mdorschemas/README.md). If the tree is dirty, report and ask whether to stash, commit, or abort — never overwrite uncommitted work. - Confirm a validator binary is available:
check-jsonschema --version,ajv --version, orpython -m jsonschema --version. If none is installed, stop and emit an install hint based on the repository's ecosystem (pip install check-jsonschema,npm install -g ajv-cli); the spec forbids silent skip.
Operations
Read references/operations.md when executing any of the operations below in detail.
1. Author a new schema (<slug>-v1.0.schema.yaml)
Gather slug, target object, consuming spec path, and on-disk location. Compose the $id URI deterministically. Draft the file with the ten top-level skeleton entries in spec order. Walk properties one at a time; scan for $defs extraction candidates. Validate with an example before writing. Update the repo README as a separate approved edit.
2. Audit existing schemas
Read-only walk of every **/*.schema.yaml. Classify each spec requirement as pass, missing, or drift per file. Checks: dialect, identity, skeleton order, file layout, description anchor, property descriptions, $ref shape, $defs naming, inline duplication, examples, README listing. Also runs operation 4 on every schema.
3. Refactor (apply audit findings)
Walk audit findings one at a time; propose the minimal fix and ask for per-item confirmation. Handles dialect fix, $id composition, skeleton reorder, $defs extraction, relative-$ref rewrite, missing property descriptions, forbidden top-level keys, and additionalProperties justification.
4. Meta-validation (schema-against-meta-schema)
Validate every *.schema.yaml against the JSON Schema 2020-12 meta-schema. Validator preference order: task lint → check-jsonschema --check-metaschema → ajv compile --spec=draft2020 → python -m jsonschema. Report pass / fail (verbatim output) / blocked (no validator). Never silence failures.
5. Data validation (data-against-schema)
Associate every data file (*.yaml, *.yml, *.json) with its schema via sidecar comment, Refs comment, or .schemas-config.yaml mapping. Run the validator per association; report pass / fail / skipped / unassociated. Never invent associations.
6. Lifecycle bump (revise an existing schema)
Diff proposed change; classify as minor (backward-compatible) or major (breaking). Compose the new filename and $id segment. Write alongside the previous file; never edit in place for externally-referenced schemas. Surface consumer migration list; delegate release-note entry to release-notes-curate.
7. Re-audit
Re-run operations 2, 4, and 5 end-to-end; present a fresh grouped summary. Call out any remaining missing, drift, fail, or unassociated items.
Examples
- Read
examples/01-meta-validation.mdwhen running a meta-validation pass for the first time on a new schema. - Read
examples/02-data-against-schema.mdwhen wiring up sidecar-comment-based schema associations for the first time. - Read
examples/03-schema-lifecycle.mdwhen revising an existing schema (minor or major bump).
Gotchas
- Validator precedence: When multiple validators are installed (
task lint,check-jsonschema,ajv,python -m jsonschema), the skill uses the first available in that order. Atask linttarget withcheck-jsonschemaconfigured overrides directcheck-jsonschemainvocation; mention which validator ran in the result table so a re-run can detect drift. - YAML 1.1 vs YAML 1.2 booleans:
Yes/No/On/Offparse as booleans under YAML 1.1 but as strings under YAML 1.2. Schemas authored under loaders that default to 1.1 (older Ruby tooling) can land withadditionalProperties: Nosilently re-typed; emit a YAML 1.2 directive (%YAML 1.2\n---) at the top of any file the skill writes to make the version explicit. $schemaURI trailing slash:https://json-schema.org/draft/2020-12/schemaandhttps://json-schema.org/draft/2020-12/schema#resolve to the same document, but validators compare URIs as strings. The skill always emits the no-fragment form; never append#.#/$defs/JSON Pointer escaping: a$defskey containing~or/must be escaped (~0,~1) in the$reffragment. The skill rejects$defsnames containing those characters at authoring time rather than silently emitting escape sequences.formatkeyword is annotation-only by default in JSON Schema 2020-12. Validators likeajvenforceformatonly when configured with--all-errors --strict=falseand theajv-formatsplugin. Don't promise the user thatformat: emailwill fail invalid data unless the validator config enables enforcement; record the gap in the validation report.unevaluatedPropertiesvsadditionalProperties: withallOfcomposition,additionalProperties: falseonly constrains the immediatepropertiesblock; properties contributed byallOfmembers are still allowed unlessunevaluatedProperties: falseis set. The spec settles this: a closed object schema that composes viaallOfMUST express the closed-shape guarantee withunevaluatedProperties: false, and the meta-validation step rejects anallOf-composed schema that relies onadditionalProperties: falsealone. Flag any such schema during the audit and refactor it tounevaluatedProperties: falserather than surfacing it as an unresolved choice.integeris not a subtype ofnumberforenum: enum values are matched by JSON equality; an enum entry1in atype: numberschema does not match1.0in data unless both are integers in the JSON model. Watch for this when refactoring inline enums into$defs.- Relative
$refworks locally and breaks remotely: a validator run from the schema's directory will resolve$ref: ../other.schema.yamlfine and pass meta-validation. The same schema imported by$idfrom a different repo will silently fail to resolve the$ref. The skill rejects relative$refat authoring time, regardless of local test success. titleanddescriptionare not validation keywords — they are annotations. The skill still treats their presence as MUST per the spec, but emit a clear "annotation, not enforced" note when the user asks why the validator passes a schema missing a description.- Meta-validation passes a schema with no
propertiesdefined undertype: object. That's valid JSON Schema (an open object schema) but almost never the author's intent. The audit reports this as a SHOULD finding ("schema describes nothing"), not a MUST violation.
Hard rules
- Never emit a schema file without
$schema: https://json-schema.org/draft/2020-12/schemaas the first keyed entry. Other dialects are forbidden by the spec. - Never emit a schema file without an
$idURI underhttps://github.com/nolte/<repo>/blob/main/as the second keyed entry, whose path after/blob/main/matches the file's repository-relative on-disk location. A schema with no$id, or one carrying a non-GitHub namespace, is unreferenceable and forbidden by the spec. - Never emit a schema whose
descriptionlacks the literal substringRefs spec/<topic>/<slug>/. Traceability to the consuming spec is a MUST. - Never emit a relative-path
$ref($ref: ../other.schema.yaml#/$defs/Foo). Only#/$defs/<Name>and absolutehttps://github.com/nolte/…URIs are permitted. - Never mix dialects within a single schema document. A
$reffrom a 2020-12 schema into a draft-07 schema is forbidden; transcribe the relevant fragment instead. - Never store a schema under
spec/. Thespec/tree is governance-only. - Never edit a schema in place once its
$idis referenced from outside its repository by absolute URI. Bump the version (-v<major>.<minor+1>or-v<major+1>.0) and migrate consumers explicitly. - Never silence a meta-validation or data-validation failure with
--no-fail,|| true, or equivalent. A failing schema or data file is a stop-and-fix event. - Never treat absence of an installed validator as a passing gate. Emit an install hint and report the gate as blocked.
- Never perform silent writes. Every file change requires explicit per-item user confirmation; every audit finding is presented before any fix is written.
- Never take on
project-structure-applywork. If the audit reveals thatschemas/directories are absent at the structural level, the README is missing entirely, or the Taskfile has nolinttarget, stop and route the user toproject-structure-apply— don't silently scaffold those out of scope. - Never modify the spec while applying it. If a real-world need conflicts with
spec/project/yaml-json-schema/, report it and ask the user to update the spec via thenolte-shared:specskill before proceeding. - Never invoke this skill on OpenAPI Schema Objects, AsyncAPI Schema Objects, or JSON-encoded JSON Schema documents. Those formats are explicitly out of scope per the spec's §Delimitation.
Multi-model testing
Examples and operations in this skill are verified on Claude Sonnet as the default model; spot-checked on Haiku for cost-sensitive runs; Opus is appropriate for high-stakes audits that require deeper reasoning. The skill body has no model-specific assumptions beyond standard tool-call semantics.
Resumability
Per spec/claude/resumable-work/, this skill is resumable: true. State is persisted to .resume/yaml-json-schema/<run-id>.yml after every successful per-step user-approval gate (each property authored in the Author walk, each finding fixed in the Refactor walk, the separately approved README edit) and after each named phase boundary (audit pass complete). On re-invocation, scan that directory for files with status: in_progress whose inputs: snapshot matches the current invocation; if one matches, prompt the operator with Resume run <run_id> from phase <phase> (last checkpoint <last_checkpoint_at>)? [resume / start-new / discard]. The state-file envelope (schema_version, run_id, inputs, phase, decisions[], status, …) and the fail-closed semantics on schema or YAML errors are load-bearing in the spec; don't duplicate those rules here.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

