Complete schema for a Skill directory. Attributes: skill_id: Unique identifier for the Skill name: Skill name (max 64 characters) description: Skill description (max 1024 characters) content: Content of SKILL.md file files: List of files in the Skill
| 65 | |
| 66 | @dataclass |
| 67 | class SkillSchema: |
| 68 | """ |
| 69 | Complete schema for a Skill directory. |
| 70 | |
| 71 | Attributes: |
| 72 | skill_id: Unique identifier for the Skill |
| 73 | name: Skill name (max 64 characters) |
| 74 | description: Skill description (max 1024 characters) |
| 75 | content: Content of SKILL.md file |
| 76 | files: List of files in the Skill directory |
| 77 | skill_path: Absolute path to current skill directory |
| 78 | version: Skill version (format: v0.1.2, default: latest) |
| 79 | author: Skill author (optional) |
| 80 | tags: List of tags for categorization (optional) |
| 81 | scripts: List of script files (optional) |
| 82 | references: List of reference documents (optional) |
| 83 | """ |
| 84 | skill_id: str |
| 85 | name: str |
| 86 | description: str |
| 87 | content: str |
| 88 | files: List[SkillFile] |
| 89 | version: str = 'latest' |
| 90 | author: Optional[str] = None |
| 91 | tags: List[str] = field(default_factory=list) |
| 92 | scripts: List[SkillFile] = field(default_factory=list) |
| 93 | references: List[SkillFile] = field(default_factory=list) |
| 94 | resources: List[SkillFile] = field(default_factory=list) |
| 95 | skill_path: Path = field(default_factory=lambda: Path.cwd().resolve()) |
| 96 | |
| 97 | def __post_init__(self): |
| 98 | """ |
| 99 | Validate schema after initialization. |
| 100 | |
| 101 | Raises: |
| 102 | ValueError: If schema is invalid |
| 103 | """ |
| 104 | if not self.skill_id: |
| 105 | raise ValueError('Skill ID cannot be empty') |
| 106 | if not self.name or len(self.name) > 64: |
| 107 | raise ValueError('Skill name must be 1-64 characters') |
| 108 | if not self.description or len(self.description) > 1024: |
| 109 | raise ValueError('Skill description must be 1-1024 characters') |
| 110 | if not self.files: |
| 111 | raise ValueError('Skill must contain at least one file') |
| 112 | |
| 113 | # Ensure SKILL.md exists |
| 114 | has_skill_md = any(f.name == 'SKILL.md' for f in self.files) |
| 115 | if not has_skill_md: |
| 116 | raise ValueError('Skill must contain SKILL.md file') |
| 117 | |
| 118 | def validate(self) -> bool: |
| 119 | """ |
| 120 | Validate the complete Skill schema. |
| 121 | |
| 122 | Returns: |
| 123 | True if valid, False otherwise |
| 124 | """ |