← Back to skills
Structured Output & Schema EnforcementHigh ReliabilityModerate-Risk Workflow

JSON Schema Enforcer

Validates AI-generated JSON against explicit contracts with deterministic checks for required keys, type safety, allowed values, and forbidden fields.

Version

0.1.0

Last Updated

Apr 22, 2026

Verification Type

schema validation, lint/type checks

Downloads

0

Required inputs

  • contract_definition (json)

    Required fields, expected types, allowed values, and forbidden fields.

  • candidate_output (json)

    Generated JSON to validate.

Expected outputs

  • validated_output (json)

    JSON payload that passes all contract checks.

  • validation_report (markdown)

    Deterministic list of schema violations and fixes.

Included checks and assets

  • scripts/assert_contract.py (script)

    Validates JSON output against a lightweight contract spec.

  • references/contract-format.md (reference)

    Defines the contract JSON format used by the validator.

  • references/edge-cases.md (reference)

    Covers nullability, enum drift, and nested-structure edge cases.

  • references/repair-playbook.md (reference)

    Defines deterministic repair ordering and retry policy.

Failure modes

  • Semantically incorrect values can still pass if contract is incomplete.
  • Nested object constraints are limited in the lightweight checker.
  • Human review is still needed for business-rule correctness.

Ideal use cases

  • Agent output for API calls
  • Structured tool invocation payloads
  • Automated compliance checks for JSON responses

Example runs

Order status payload validation

Validated sample run

Rejects unexpected enum values and missing required keys.

Input preview

contract.json + candidate_fail.json

Output preview

3 deterministic failures with field paths

Changelog summary

  • 0.1.0 · Apr 22, 2026

    Initial release with deterministic contract checks.

Links

Inspect the source, read authored documentation, or download the published skill bundle.