Skip to main content
skill CX Codex

output-contract-enforcer — Claude Code skill: JSON schema checks

output-contract-enforcer is a Claude Code skill that checks DAG node JSON against its schema and traces mismatches when a downstream node receives unexpected input.

MIT 141 installs ★ 274 updated 2026-10-30

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add curiositech/some_claude_skills --skill output-contract-enforcer -a claude-code
Open on GitHub

What output-contract-enforcer does

The skill checks whether an output parses as JSON, includes required fields, and meets type, enum, and constraint rules. For connected nodes, it compares one node’s output schema with the next node’s required input, then identifies missing fields or incompatible requirements.

It can also build a JSON Schema from a node description. The examples cover a base DAG contract and a schema for recommendation items with priorities. Supply the output JSON and schema for validation; the skill has access to Read, Write, Edit, and Grep.

Its scope is structural validation within DAGs. It does not judge whether the content is good or correct, and it is not intended for general JSON Schema work outside a DAG. The README points to dag-quality for content assessment.

What it helps with

  • validate a DAG node’s output against a JSON Schema
  • find required fields missing from an output
  • catch wrong field types or enum values
  • compare one node’s output contract with the next node’s input
  • generate a schema from a node’s output description

Example prompts for the agent

  • Validate this DAG node’s JSON output against the attached schema and list any failures.
  • Create a JSON Schema for a node that returns recommendations with priorities.
  • Compare Node A’s output with Node B’s input and explain the contract mismatch.

How to install output-contract-enforcer

1Skills CLI (Vercel)

npx skills add curiositech/some_claude_skills --skill output-contract-enforcer -a claude-code

2Manually: put the files in place

~/.claude/skills/output-contract-enforcer/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/output-contract-enforcer/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about output-contract-enforcer

How do I install output-contract-enforcer in Claude Code?

Run npx skills add curiositech/some_claude_skills --skill output-contract-enforcer -a claude-code. The skill file is at ~/.claude/skills/output-contract-enforcer/SKILL.md.

What does output-contract-enforcer do?

It checks DAG node outputs against JSON schemas, including required fields, types, and constraints. It can also compare contracts between connected nodes.

Does the skill assess the quality of JSON content?

No. It checks structural compliance with a schema. The README recommends dag-quality for content assessment.

Source text

SKILL.md · MIT
---
name: output-contract-enforcer
description: Validates that a DAG node's output matches its declared JSON schema before passing to downstream nodes. The glue that makes multi-agent DAGs reliable. Use when checking output contract compliance,
  generating validation schemas from descriptions, or debugging contract mismatches between nodes. Activate on "validate output", "output contract", "schema validation", "contract mismatch", "output doesn't
  match". NOT for content quality assessment (use dag-quality), skill grading (use skill-grader), or general JSON schema work outside DAG context.
allowed-tools: Read,Write,Edit,Grep
argument-hint: '[output-json] [schema]'
metadata:
  tags:
  - output
  - contract
  - enforcer
  - validate-output
  - output-contract
  pairs-with:
  - skill: task-decomposer
    reason: Decomposed tasks define the output schemas that the enforcer validates between nodes
  - skill: human-gate-designer
    reason: Human gate inputs/outputs need the same schema validation as automated node outputs
  - skill: typescript-advanced-patterns
    reason: Branded types and Zod schemas implement runtime output contract validation in TypeScript
---

# Output Contract Enforcer

Validates that a DAG node's output matches its declared JSON schema before passing to downstream nodes. The glue that makes multi-agent DAGs reliable. Without this, downstream nodes receive unpredictable input and the DAG breaks.

---

## When to Use

✅ **Use for**:
- Validating a node's output against its declared schema
- Generating output schemas from natural-language output descriptions
- Debugging why a downstream node rejected its input
- Ensuring contract compatibility between connected nodes

❌ **NOT for**:
- Assessing content quality or correctness (use `dag-quality`)
- Grading skill quality (use `skill-grader`)
- General JSON schema work outside DAG context

---

## Validation Process

```mermaid
flowchart TD
  O[Node output] --> P[Parse as JSON]
  P -->|Parse error| E1[FAIL: Not valid JSON]
  P -->|Valid JSON| S[Check against schema]
  S --> R{Required fields?}
  R -->|Missing| E2[FAIL: Missing required field X]
  R -->|Present| T{Type check?}
  T -->|Wrong type| E3[FAIL: Field X expected string, got number]
  T -->|Correct| C{Constraints?}
  C -->|Violated| E4[FAIL: Field X violates constraint Y]
  C -->|Met| V[PASS: Contract satisfied]
```

### What Gets Checked

| Check | Example | Failure Message |
|-------|---------|----------------|
| JSON parseable | `{broken json` | "Output is not valid JSON" |
| Required fields | `status` missing | "Missing required field: status" |
| Field types | `status: 42` (expected string) | "Field 'status' expected string, got number" |
| Enum values | `status: "maybe"` | "Field 'status' must be one of: pass, warn, fail" |
| String constraints | `summary: ""` (minLength: 1) | "Field 'summary' must have minLength 1" |
| Number constraints | `score: 1.5` (maximum: 1.0) | "Field 'score' must be ≤ 1.0" |
| Array constraints | `items: []` (minItems: 1) | "Field 'items' must have at least 1 item" |
| Nested objects | Missing sub-field | "Field 'metadata.cost' is required" |

### The Standard Output Contract

Every DAG node should produce output matching this base schema (fields can be extended):

```json
{
  "type": "object",
  "required": ["status", "summary"],
  "properties": {
    "status": {
      "type": "string",
      "enum": ["pass", "warn", "fail"]
    },
    "summary": {
      "type": "string",
      "minLength": 1,
      "description": "1-3 sentence description of what was produced"
    },
    "artifacts": {
      "type": "array",
      "items": { "type": "string" },
      "description": "List of files created or modified"
    },
    "data": {
      "type": "object",
      "description": "Node-specific output data (schema varies per node)"
    },
    "risks": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Remaining risks or assumptions"
    }
  }
}
```

### Contract Compatibility Check

When connecting Node A's output to Node B's input, verify:
1. Every field B requires is present in A's output schema
2. Types match (A produces string, B expects string)
3. A's output constraints are compatible with B's input constraints
4. If A produces optional fields that B requires → incompatible

```
Node A output: { status: string, recommendations: string[] }
Node B input:  { status: string, recommendations: string[], priority: number }

Result: INCOMPATIBLE — Node B requires 'priority' but Node A doesn't produce it.
Fix: Add 'priority' to Node A's output, or add a transformer node between A and B.
```

---

## Schema Generation

When a node description says "produces a list of recommendations with priorities," generate:

```json
{
  "type": "object",
  "required": ["status", "summary", "data"],
  "properties": {
    "status": { "type": "string", "enum": ["pass", "warn", "fail"] },
    "summary": { "type": "string", "minLength": 1 },
    "data": {
      "type": "object",
      "required": ["recommendations"],
      "properties": {
        "recommendations": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": ["text", "priority"],
            "properties": {
              "text": { "type": "string" },
              "priority": { "type": "integer", "minimum": 1, "maximum": 5 }
            }
          }
        }
      }
    }
  }
}
```

---

## Anti-Patterns

### No Contract at All
**Wrong**: Nodes produce free-form text with no schema.
**Why**: Downstream nodes can't reliably parse the input. The DAG is fragile.
**Right**: Every node declares its output schema. Every output is validated before passing downstream.

### Overly Strict Contracts
**Wrong**: Requiring exact character counts, specific formatting, or field values that depend on runtime context.
**Right**: Constrain structure (types, required fields), not content. Let dag-quality handle content assessment.

### Ignoring Optional Fields
**Wrong**: Treating all fields as required.
**Right**: Use `required` only for fields that downstream nodes absolutely need. Mark everything else as optional.

© curiositech · MIT · curiositech/some_claude_skills

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set180

The whole set →
docker-containerization docker-containerization generates production-ready Dockerfiles, optimizes layer caching, and writes docker-compose setups for local development. CX Codex +1 143installs cost-optimizer cost-optimizer monitors cumulative LLM expenses across DAG execution and downgrades model tiers or skips optional nodes to prevent budget overruns. CX Codex +1 143installs git-workflow-expert git-workflow-expert — a git skill covering branching strategies, merge conflicts, rebase workflows, and recovery commands like bisect and reflog. Handy when history gets messy or a commit goes missing. CX Codex +1 143installs microservices-patterns The microservices-patterns skill helps plan service boundaries and communication patterns. Use it when assessing a monolith or designing a distributed system. CX Codex +1 142installs anthropic-technical-deep-dive anthropic-technical-deep-dive builds deep technical preparation for Anthropic interviews: Constitutional AI, RLHF, interpretability, scaling laws, MCP, agentic systems, and AI safety. CX Codex +1 141installs human-gate-designer human-gate-designer designs human-in-the-loop review points for DAG workflows: what to show a person, how to collect feedback, and how to route it back. Fits when you add approval gates to agent pipelines. CX Codex +1 141installs error-handling-patterns The error-handling-patterns skill for Claude Code designs error handling in TypeScript and Python, supporting the choice between exceptions and Result types and the design of recovery flows. CX Codex +1 140installs dependency-management dependency-management guides agents through evaluating third-party packages, locking strict versions, and setting up security audits with Dependabot or Renovate. CX Codex +1 140installs

Project sponsors

Companies that keep this analytics open