Schema guard
Check a proposed JSON Schema against the current one for breaking changes, validate sample payloads, and emit a gated publish proposal only when the change is compatible — never writing a live schema.
Overview
In the manual
Runner
default
Declared by its execution profile. Read the profile
SKILL.md
What this skill does
This skill catches silent API and data-contract breakage before a migration
lands. It reads a current_schema, a proposed_schema, optional
sample_payloads, and a compatibility_policy. It reports every breaking change
by field path (with the old contract, the new contract, and the policy rule it
trips), validates each sample payload against the proposed schema, writes
migration notes, and emits a publish_schema_proposal only when the change
is compatible under the policy.
The skill is read-only and offline. It makes no network calls and never writes,
publishes, or mutates a live schema. Publishing a schema is the gated
schema-publisher executor's effect, performed only after approval.
When to use this skill
Use this skill in a pull-request or migration pipeline to decide whether a schema
change is safe to ship. It is appropriate as a gate before a schema registry
update, an API version bump, or a database migration, and as the evidence step
before a human or the schema-publisher executor applies the change.
When not to use this skill
Do not use it to apply or publish a schema — it only proposes. Do not treat a compatible result as a guarantee of correctness beyond the declared policy and the supplied samples: coverage is bounded by the schemas and payloads provided. It checks a JSON-Schema subset (object properties, required, type, enum, nested objects); it is not a full JSON-Schema validator for every keyword.
Procedure
- Read
current_schemaandproposed_schema; record a stable digest of each. - Diff the schemas field by field: a removed field, a narrowed type, a removed enum value, a newly required field, or a field made required is a breaking change; an added optional field or a relaxed requirement is additive.
- Apply the
compatibility_policy:required_fieldsmust remain (violations always block), andbreaking_alloweddecides whether other breaking changes are permitted;versioning_ruleis recorded. - Validate each
sample_payloadsentry against the proposed schema; a failing sample means the change breaks existing data. - Set
compatibility.compatibletrue only when there are no policy violations, no failing samples, and either no breaking changes orbreaking_allowed. - Emit
publish_schema_proposalonly when compatible; otherwise withhold it and write migration notes. - If a caller sets
apply/publish/write, refuse and stop.
Edge cases and stop conditions
Stop with an error when current_schema or proposed_schema is missing or is
not a JSON object. If a caller asks the skill to apply, publish, or write
the schema, it refuses and stops — that effect belongs to the gated
schema-publisher executor.
block is true whenever the change is not compatible (the migration should be
held); it is false when compatible. Breaking changes never silently pass:
each is reported with its field path and the policy rule it trips.
Output schema
The primary output is schema_guard_result, with schema schema.guard.result.v1:
A compatible (additive) change — proposal emitted:
{
"schema": "schema.guard.result.v1",
"skill": "schema-guard",
"version": "0.1.0",
"block": false,
"compatibility": {
"compatible": true,
"breaking_changes": [],
"breaking_allowed": false,
"versioning_rule": "additive-only",
"required_fields": ["id"],
"policy_violations": []
},
"validation_results": [{ "payload_index": 0, "valid": true, "errors": [] }],
"migration_notes": ["Additive-only change (1 field(s) added or relaxed); existing consumers remain valid."],
"publish_schema_proposal": {
"decision": "proposed",
"performed_by": "schema-publisher",
"requires_approval": true,
"to_schema_digest": "sha256:...",
"versioning_rule": "additive-only",
"note": "Proposal only. schema-guard performs no live schema write..."
},
"summary": {
"breaking_count": 0,
"additive_count": 1,
"policy_violation_count": 0,
"samples_validated": 1,
"samples_failed": 0,
"proposal_status": "proposed"
}
}A breaking change withholds the proposal: compatibility.compatible is false,
block is true, publish_schema_proposal is null, proposal_status is
withheld, and each breaking change is listed with its field_path, kind,
old_contract, new_contract, and policy_rule.
When output_dir is provided, the runner also writes evidence.json and
report.md inside that directory.
Worked example
An additive change adds an optional email field. The harness confirms it is
compatible and emits a proposal:
runx skill "$PWD" \
--input-json current_schema='{"type":"object","properties":{"id":{"type":"integer"}},"required":["id"]}' \
--input-json proposed_schema='{"type":"object","properties":{"id":{"type":"integer"},"email":{"type":"string"}},"required":["id"]}' \
--input-json sample_payloads='[{"id":1}]' \
--input-json compatibility_policy='{"breaking_allowed":false,"required_fields":["id"],"versioning_rule":"additive-only"}' \
--jsonExpected: compatibility.compatible is true, publish_schema_proposal.performed_by
is schema-publisher. Removing the required id field instead makes
compatible false, withholds the proposal, and lists the breaking change.
Inputs
current_schema: the current JSON Schema (required).proposed_schema: the proposed JSON Schema (required).sample_payloads: representative payloads validated against the proposed schema.compatibility_policy:{ breaking_allowed, required_fields[], versioning_rule }.apply: must be absent or false; if set, the skill refuses (it never writes a schema).output_dir: optional directory forevidence.jsonandreport.md.
Outputs
schema_guard_result: the complete packet.block: boolean migration gate, true when the change is not compatible.compatibility:{ compatible, breaking_changes[], ... }.validation_results: per-sample validation against the proposed schema.migration_notes: human-readable guidance for each breaking change.publish_schema_proposal: gated proposal for theschema-publisherexecutor (only when compatible).
Published execution profile
The execution profile published with sha-d16db076181e, shown as its exact bytes.
| Runner |
|
|---|---|
| Profile digest | sha256:76e4ce12d23b90d82476dc8c730a210efc04929dcf83b438121b4f54348051c0 |
skill: schema-guard
version: 0.1.1
catalog:
kind: skill
audience: public
visibility: public
role: canonical
tags:
- schema
- compatibility
- migration
category: code
runners:
default:
default: true
inputs:
current_schema:
type: object
required: true
description: The current JSON Schema (the contract in force).
proposed_schema:
type: object
required: true
description: The proposed JSON Schema to check for compatibility.
sample_payloads:
type: array
required: false
description: Representative payloads validated against the proposed schema.
compatibility_policy:
type: object
required: false
description: "{ breaking_allowed, required_fields[], versioning_rule } governing whether breaking changes are permitted."
apply:
type: boolean
required: false
description: Must be absent or false. If set, the skill refuses and stops — it never writes a live schema.
output_dir:
type: string
required: false
description: Directory inside the skill directory where evidence.json and report.md are written.
steps:
- id: default
tool:
command: /usr/bin/env
args:
- node
- run.mjs
inputs:
current_schema: $input.current_schema
proposed_schema: $input.proposed_schema
sample_payloads: $input.sample_payloads
compatibility_policy: $input.compatibility_policy
apply: $input.apply
output_dir: $input.output_dir
outputs:
block:
required: false
compatibility:
required: false
validation_results:
required: false
migration_notes:
required: false
publish_schema_proposal:
required: false
schema_guard_result:
required: false
policy:
required: false
schema:
required: false
skill:
required: false
source:
required: false
summary:
required: false
validation:
required: false
version:
required: false
scopes:
- schema.read
harness:
cases:
- name: additive-change-compatible-yields-proposal
runner: default
inputs:
current_schema:
type: object
properties:
id:
type: integer
name:
type: string
required:
- id
proposed_schema:
type: object
properties:
id:
type: integer
name:
type: string
email:
type: string
required:
- id
sample_payloads:
- id: 1
name: ada
- id: 2
name: grace
email: grace@example.com
compatibility_policy:
breaking_allowed: false
required_fields:
- id
versioning_rule: additive-only
expect:
status: sealed
receipt:
schema: runx.receipt.v1
output:
subset:
block: false
compatibility:
compatible: true
publish_schema_proposal:
performed_by: schema-publisher
operator_journeys:
- mode: standalone
confusors:
- extract
- skill-review
request: Check whether this schema change breaks existing callers.
expected_outcome: Return a compatibility verdict and enforce the policy before anything publishes.
- mode: composed
request: Continue this schema-guard work from evidence already gathered upstream.
expected_outcome: Return a compatibility verdict and enforce the policy before anything publishes.
prior_evidence:
- The current schema, proposed schema and samples already supplied.
must_not_repeat:
- Do not publish the schema.
- name: breaking-change-withholds-proposal
runner: default
inputs:
current_schema:
type: object
properties:
id:
type: integer
name:
type: string
required:
- id
- name
proposed_schema:
type: object
properties:
id:
type: string
required:
- id
sample_payloads:
- id: 1
name: ada
compatibility_policy:
breaking_allowed: false
required_fields:
- id
versioning_rule: additive-only
expect:
status: sealed
receipt:
schema: runx.receipt.v1
output:
subset:
block: true
compatibility:
compatible: false
publish_schema_proposal: null
- name: refuses-to-apply-schema
runner: default
inputs:
current_schema:
type: object
properties:
id:
type: integer
proposed_schema:
type: object
properties:
id:
type: integer
email:
type: string
apply: true
expect:
status: failure
Published package and test evidence.
This exact version passed its recorded harness run: 3 checks passed · 0 failed.
Test result
| Harness result | Passed |
|---|---|
| Tested version | sha-d16db076181e |
| Recorded result | 3 checks passed · 0 failed |
| Result source | Reported by the publisher (runx_registry_publish) |
| Suite | runx-harness |
| Test recorded | |
| Declared cases | 3 |
| Test record | Open the recorded run |
Inspect receipt references
sha256:c50a2af759e4cdf8e3fb94c00d2c2ca7924920cc00f881abbe543906d3f871b1sha256:1dcc476ad8d338a5819e9c707bd81c66927ab5dc430e151ef0ce41b3807b736dsha256:79383cb506e88d10ed0eeaa942e8817f72e45cadeee2922dbbe0f9117d8fdbbfPackage identity
| Published revision | sha-d16db076181e |
|---|---|
| Content digest | sha256:d16db076181e4c07f8b752c7b039029d06cc621cb9b8baea5bf22de89f249458 |
| SKILL.md digest | sha256:53363e20a9035958d0426619a250d626be088006872c1d8e031471f1579cba27 |
| Execution profile digest | sha256:76e4ce12d23b90d82476dc8c730a210efc04929dcf83b438121b4f54348051c0 |
| Publisher identity | Unverified publisher · epistemedeus |
| Trust tier | CommunityPublished through the registry without publisher verification. This tier is not a code assessment. |
| Attestations |
|
| Source provenance | Not published with this version |
Version history
sha-d16db076181eViewingContent digest sha256:d16db076181e4c07f8b752c7b039029d06cc621cb9b8baea5bf22de89f249458sha-0b362bc6bd55Content digest sha256:0b362bc6bd5521fe861707ed1a0718d53df3d1cd72434a52063fd2993bfb9d07sha-9623d68d8c6cContent digest sha256:9623d68d8c6cde85b874aa8808a6db07077c8f3a81e6dcda4ea3ef5aea2278fbsha-fdd26d479beaContent digest sha256:fdd26d479bea90e8189cecdf7aa4ef8c32dcd19372c9ede7feb161e273247e9f