Schema guard

Check API or data schema changes against sample payloads and a compatibility policy before a schema proposal is published.

Overview

schema-guard checks whether a proposed API or data contract can move forward without silently breaking callers. It reads the current schema, proposed schema, real sample payloads, and a compatibility policy. It reports breaking changes, validates samples against the proposed contract, and emits a publish_schema_proposal only when the change is allowed by policy.

The skill never writes a live schema. Its proposal is a gated handoff for a human schema approver or a separate schema-publisher executor.

SKILL.md

Schema Guard

schema-guard checks whether a proposed API or data contract can move forward without silently breaking callers. It reads the current schema, proposed schema, real sample payloads, and a compatibility policy. It reports breaking changes, validates samples against the proposed contract, and emits a publish_schema_proposal only when the change is allowed by policy.

The skill never writes a live schema. Its proposal is a gated handoff for a human schema approver or a separate schema-publisher executor.

Use This Skill When

  • A migration, API version, or event contract is about to land.
  • A maintainer needs a deterministic compatibility report before publishing.
  • A workflow needs a receipt showing why a schema proposal was allowed or held.

Do Not Use This Skill For

  • Live schema writes or registry publication.
  • Inventing sample coverage. If a sample does not cover a path, the report says that directly.
  • Broad API design review. This skill only checks the supplied contract delta, policy, and payload samples.

Inputs

  • current_schema: JSON-schema-like object contract currently in force.
  • proposed_schema: JSON-schema-like object contract being reviewed.
  • sample_payloads: array of real sample payload objects.
  • compatibility_policy: object with:
    • breaking_allowed: boolean.
    • required_fields: array of field paths that must remain present.
    • versioning_rule: string such as minor_allows_additive_only.

Outputs

  • compatibility: object with status, breaking_changes, and policy result.
  • validation_results: array of sample validation results against the proposed schema.
  • migration_notes: array of notes about additive, removed, or changed fields and sample coverage.
  • publish_schema_proposal: emitted only when the proposal is compatible under the supplied policy. It is a proposal, not a live schema write.

Procedure

  1. Normalize both schemas into field paths.
  2. Compare field paths, required status, type, enum, and object shape.
  3. Mark removals, type changes, enum narrowing, newly required fields, and required policy-field removals as breaking changes.
  4. Validate every supplied sample payload against the proposed schema.
  5. Record sample coverage by field path without inventing missing coverage.
  6. Emit publish_schema_proposal only when policy permits the change and all samples validate.

Refusal Conditions

  • breaking_allowed is false and at least one breaking change is found.
  • Any sample payload fails the proposed schema.
  • A field named in compatibility_policy.required_fields is absent from the proposed schema.
  • Inputs are malformed or sample_payloads is not an array.

Published execution profile

The execution profile published with sha-bbf14daccae2, shown as its exact bytes.

Runner
  • default
Profile digestsha256:02f5f61873c03072e402584938d01e5a434f32935e82db3c7cdb0f2f31fe17f5
skill: schema-guard
version: 0.1.1
catalog:
  kind: skill
  audience: public
  visibility: public
  role: canonical
  category: code
runners:
  default:
    default: true
    inputs:
      current_schema:
        type: json
        required: true
        description: Current JSON-schema-like object contract.
      proposed_schema:
        type: json
        required: true
        description: Proposed JSON-schema-like object contract.
      sample_payloads:
        type: json
        required: true
        description: Array of real sample payloads to validate against the proposed schema.
      compatibility_policy:
        type: json
        required: true
        description: Policy object with breaking_allowed, required_fields, and versioning_rule.
    steps:
      - id: default
        tool:
          command: node
          args:
            - run.mjs
          timeout_seconds: 15
        inputs:
          current_schema: $input.current_schema
          proposed_schema: $input.proposed_schema
          sample_payloads: $input.sample_payloads
          compatibility_policy: $input.compatibility_policy
        artifacts:
          named_emits:
            compatibility: runx.schema_guard.compatibility.v1
            validation_results: runx.schema_guard.validation_results.v1
            migration_notes: runx.schema_guard.migration_notes.v1
            publish_schema_proposal: runx.schema_guard.publish_schema_proposal.v1
harness:
  cases:
    - name: schema-guard-additive-compatible
      runner: default
      inputs:
        current_schema:
          type: object
          title: OrderEvent
          version: 1.2.0
          required:
            - order_id
            - status
          properties:
            order_id:
              type: string
            status:
              type: string
              enum:
                - pending
                - paid
            total_cents:
              type: integer
        proposed_schema:
          type: object
          title: OrderEvent
          version: 1.3.0
          required:
            - order_id
            - status
          properties:
            order_id:
              type: string
            status:
              type: string
              enum:
                - pending
                - paid
                - refunded
            total_cents:
              type: integer
            coupon_code:
              type: string
        sample_payloads:
          - order_id: ord_1001
            status: paid
            total_cents: 2599
          - order_id: ord_1002
            status: refunded
            total_cents: 1200
            coupon_code: WELCOME10
        compatibility_policy:
          breaking_allowed: false
          required_fields:
            - order_id
            - status
          versioning_rule: minor_allows_additive_only
      expect:
        status: sealed
        receipt:
          schema: runx.receipt.v1
      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: schema-guard-breaking-refused
      runner: default
      inputs:
        current_schema:
          type: object
          title: OrderEvent
          version: 1.2.0
          required:
            - order_id
            - status
          properties:
            order_id:
              type: string
            status:
              type: string
              enum:
                - pending
                - paid
            total_cents:
              type: integer
        proposed_schema:
          type: object
          title: OrderEvent
          version: 2.0.0
          required:
            - order_id
            - status
            - currency
          properties:
            order_id:
              type: integer
            status:
              type: string
              enum:
                - paid
            currency:
              type: string
        sample_payloads:
          - order_id: ord_2001
            status: pending
            total_cents: 500
        compatibility_policy:
          breaking_allowed: false
          required_fields:
            - order_id
            - status
          versioning_rule: major_required_for_breaking
      expect:
        status: sealed
        receipt:
          schema: runx.receipt.v1

Published package and test evidence.

This exact version passed its recorded harness run: 2 checks passed · 0 failed.

Test result

Harness resultPassed
Tested versionsha-bbf14daccae2
Recorded result2 checks passed · 0 failed
Result sourceReported by the publisher (runx_registry_publish)
Suiterunx-harness
Test recorded
Declared cases2
Test recordOpen the recorded run
Inspect receipt referencessha256:8f79c62ab695a978ae395251b34ab77d57730178a066059110ee73131ecd1215sha256:9e3557ea8a111b3b0a7132108ee284bca83657a50277b4dec05fdb5ef6924fd6

Package identity

Published revisionsha-bbf14daccae2
Content digestsha256:bbf14daccae2149af8dbd732c3244d56ea4f769f590d54576a2252c8ffda7f67
SKILL.md digestsha256:a7319fa1ea06745c3d807f5e735ea5f9e5a3ca7b10e62d434902916ceb66dee5
Execution profile digestsha256:02f5f61873c03072e402584938d01e5a434f32935e82db3c7cdb0f2f31fe17f5
Publisher identityUnverified publisher · zhtwangk
Trust tierCommunityPublished through the registry without publisher verification. This tier is not a code assessment.
Attestations
  • Publisher · Declaredzhtwangk · 17 Oct 2026
Source provenanceNot published with this version

Version history

  1. sha-bbf14daccae2ViewingContent digest sha256:bbf14daccae2149af8dbd732c3244d56ea4f769f590d54576a2252c8ffda7f67
  2. sha-c2976b4be165Content digest sha256:c2976b4be1656f70b5349f3e63ae7b1fc007432fb28387b6108df3714198c814
  3. sha-87218315b28fContent digest sha256:87218315b28f1694402a001aabb443072d599ad2db4831772cb5e6658e3461f0
  4. sha-9f1f50fac384Content digest sha256:9f1f50fac3841921039749ad49614a4c25e4b84656ca61b302d5bd0e0c3a9177