{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://yao.example/skill-ir.schema.json",
  "title": "Yao Skill IR",
  "description": "Platform-neutral capability contract for Yao Meta Skill 2.0.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "name",
    "job_to_be_done",
    "trigger_surface",
    "workflow",
    "resources",
    "eval_plan",
    "risk",
    "governance"
  ],
  "properties": {
    "schema_version": {
      "const": "2.0.0"
    },
    "name": {
      "type": "string",
      "minLength": 1
    },
    "title": {
      "type": "string"
    },
    "job_to_be_done": {
      "type": "string",
      "minLength": 1
    },
    "trigger_surface": {
      "type": "object",
      "additionalProperties": false,
      "required": ["description", "should_trigger", "should_not_trigger", "edge_cases"],
      "properties": {
        "description": {"type": "string", "minLength": 1},
        "should_trigger": {
          "type": "array",
          "items": {"type": "string"}
        },
        "should_not_trigger": {
          "type": "array",
          "items": {"type": "string"}
        },
        "edge_cases": {
          "type": "array",
          "items": {"type": "string"}
        }
      }
    },
    "workflow": {
      "type": "object",
      "additionalProperties": false,
      "required": ["steps", "decision_points", "failure_modes"],
      "properties": {
        "steps": {
          "type": "array",
          "items": {"type": "string"}
        },
        "decision_points": {
          "type": "array",
          "items": {"type": "string"}
        },
        "failure_modes": {
          "type": "array",
          "items": {"type": "string"}
        }
      }
    },
    "resources": {
      "type": "object",
      "additionalProperties": false,
      "required": ["references", "scripts", "assets", "reports"],
      "properties": {
        "references": {
          "type": "array",
          "items": {"type": "string"}
        },
        "scripts": {
          "type": "array",
          "items": {"type": "string"}
        },
        "assets": {
          "type": "array",
          "items": {"type": "string"}
        },
        "reports": {
          "type": "array",
          "items": {"type": "string"}
        }
      }
    },
    "eval_plan": {
      "type": "object",
      "additionalProperties": false,
      "required": ["trigger", "output", "adversarial", "baseline"],
      "properties": {
        "trigger": {
          "type": "array",
          "items": {"type": "string"}
        },
        "output": {
          "type": "array",
          "items": {"type": "string"}
        },
        "adversarial": {
          "type": "array",
          "items": {"type": "string"}
        },
        "baseline": {
          "type": "string"
        }
      }
    },
    "risk": {
      "type": "object",
      "additionalProperties": false,
      "required": ["output_risk", "execution_risk", "trust_boundary"],
      "properties": {
        "output_risk": {
          "enum": ["low", "medium", "high"]
        },
        "execution_risk": {
          "enum": ["low", "medium", "high"]
        },
        "trust_boundary": {
          "enum": ["personal", "team", "external"]
        }
      }
    },
    "governance": {
      "type": "object",
      "additionalProperties": false,
      "required": ["owner", "maturity", "review_cadence", "review_due"],
      "properties": {
        "owner": {"type": "string"},
        "maturity": {
          "enum": ["scaffold", "production", "library", "governed"]
        },
        "review_cadence": {"type": "string"},
        "review_due": {"type": "string"}
      }
    },
    "targets": {
      "type": "array",
      "items": {"type": "string"}
    },
    "source_files": {
      "type": "array",
      "items": {"type": "string"}
    }
  }
}
