{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://desirecore.net/market/schema/skill-frontmatter.schema.json",
  "title": "DesireCore Market Skill Frontmatter (i18n)",
  "description": "JSON Schema for the YAML frontmatter of a SKILL.md in the DesireCore market. Compatible with the agentskills.io specification: https://agentskills.io/specification",
  "type": "object",
  "required": ["name", "description", "version", "metadata"],
  "additionalProperties": true,
  "properties": {
    "name": {
      "description": "Spec-required. Must equal the parent directory name. Lowercase ASCII letters, digits, hyphens. 1-64 chars. Must not start/end with hyphen, must not contain consecutive hyphens, must not be 'anthropic' or 'claude'.",
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "pattern": "^(?!-)(?!.*--)(?!anthropic$)(?!claude$)[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$"
    },
    "description": {
      "description": "Spec-required. 1-1024 chars. Single field used by Claude for skill discovery. Multilingual trigger keywords are accepted (Anthropic-recommended pattern for multilingual users).",
      "type": "string",
      "minLength": 1,
      "maxLength": 1024
    },
    "license": {
      "type": "string"
    },
    "compatibility": {
      "type": "string",
      "maxLength": 500
    },
    "version": {
      "description": "SemVer string. Required by DesireCore market.",
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$"
    },
    "type": {
      "description": "DesireCore extension. Skill behavior class.",
      "type": "string",
      "enum": ["procedural", "meta", "knowledge", "tool"]
    },
    "risk_level": {
      "description": "DesireCore extension.",
      "type": "string",
      "enum": ["low", "medium", "high", "critical"]
    },
    "status": {
      "description": "DesireCore extension. Whether the skill is enabled by default.",
      "type": "string",
      "enum": ["enabled", "disabled", "deprecated", "experimental"]
    },
    "disable-model-invocation": {
      "description": "Must be true or omitted. Market skills may only load their full instructions on demand; automatic full-content injection is prohibited.",
      "type": "boolean",
      "const": true,
      "default": true
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[a-z0-9][a-z0-9-]*$"
      },
      "uniqueItems": true
    },
    "allowed-tools": {
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "required": ["author", "i18n"],
      "additionalProperties": true,
      "properties": {
        "author": { "type": "string" },
        "updated_at": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "i18n": { "$ref": "#/$defs/i18nBlock" }
      }
    },
    "market": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "icon": { "type": "string" },
        "category": {
          "type": "string",
          "enum": [
            "productivity",
            "development",
            "business",
            "creative",
            "design",
            "media",
            "communication",
            "research",
            "data",
            "management"
          ]
        },
        "channel": {
          "type": "string",
          "enum": ["latest", "stable", "canary", "beta"]
        },
        "maintainer": {
          "type": "object",
          "properties": {
            "name": { "type": "string" },
            "verified": { "type": "boolean" }
          },
          "required": ["name"]
        },
        "compatible_agents": {
          "type": "array",
          "items": { "type": "string" }
        }
      }
    }
  },
  "$defs": {
    "bcp47Locale": {
      "description": "BCP-47 locale tag: ll-RR (lowercase language, uppercase region).",
      "type": "string",
      "pattern": "^[a-z]{2,3}(?:-[A-Z]{2})?$"
    },
    "i18nBlock": {
      "type": "object",
      "required": ["default_locale", "source_locale", "locales"],
      "properties": {
        "default_locale": { "$ref": "#/$defs/bcp47Locale" },
        "source_locale": { "$ref": "#/$defs/bcp47Locale" },
        "locales": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": { "$ref": "#/$defs/bcp47Locale" }
        }
      },
      "additionalProperties": {
        "$ref": "#/$defs/localePayload"
      }
    },
    "localePayload": {
      "description": "Per-locale display strings and body pointer. Keyed by BCP-47 locale tag.",
      "type": "object",
      "required": ["name", "short_desc"],
      "properties": {
        "name": { "type": "string", "minLength": 1, "maxLength": 200 },
        "short_desc": { "type": "string", "minLength": 1, "maxLength": 300 },
        "description": { "type": "string", "minLength": 1, "maxLength": 2000 },
        "body": {
          "description": "Relative path to the body Markdown for this locale, e.g. ./SKILL.zh-CN.md or ./SKILL.md.",
          "type": "string",
          "pattern": "^\\./[A-Za-z0-9._/-]+\\.md$"
        },
        "source_hash": {
          "description": "sha256:<8-hex> of source body+i18n strings at translation time. Written by translate.py.",
          "type": "string",
          "pattern": "^sha256:[0-9a-f]{8,64}$"
        },
        "translated_by": {
          "description": "'human' for human-authored content; 'ai:<backend>:<model-id>' or 'ai:<model-id>' for machine-translated content. Examples: 'ai:github:openai/gpt-5-mini', 'ai:anthropic:claude-sonnet-4-6', 'ai:claude-opus-4-7'.",
          "type": "string",
          "pattern": "^(human|ai:[A-Za-z0-9._:/-]+)$"
        },
        "translated_at": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}(?:T\\d{2}:\\d{2}:\\d{2}Z?)?$"
        }
      },
      "additionalProperties": false
    }
  }
}
