{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "name", "description"],
  "properties": {
    "schemaVersion": { "enum": [1, 2] },
    "name": { "type": "string", "pattern": "^[a-z0-9-]+$" },
    "description": { "type": "string", "minLength": 1 },
    "components": {
      "type": "object",
      "additionalProperties": false,
      "required": ["policies", "bundledSkills", "externalSkills", "contextMode", "serena", "astGrep"],
      "properties": {
        "policies": { "type": "boolean" },
        "bundledSkills": { "type": "boolean" },
        "externalSkills": { "type": "boolean" },
        "contextMode": { "type": "boolean" },
        "serena": { "type": "boolean" },
        "astGrep": { "type": "boolean" }
      }
    },
    "capabilities": {
      "type": "object",
      "additionalProperties": { "$ref": "#/definitions/selection" }
    },
    "externalSkillSets": { "type": "array", "items": { "type": "string" }, "uniqueItems": true }
  },
  "anyOf": [{ "required": ["components"] }, { "required": ["capabilities"] }],
  "definitions": {
    "selection": {
      "type": "object",
      "additionalProperties": false,
      "required": ["mode"],
      "properties": {
        "mode": { "enum": ["off", "registered", "auto", "project", "always"] },
        "provider": { "type": "string" },
        "options": { "type": "object" }
      }
    }
  }
}
