INNER CODE UNIT · Python
main
Mr-funny/hbg-classical-poem-silk-video · tools/validate_skill.py:12
def main() -> int:
errors: list[str] = []
skill_md = SKILL / "SKILL.md"
text = skill_md.read_text(encoding="utf-8")
match = re.match(r"\A---\n(.*?)\n---\n", text, re.S)
if not match:
errors.append("SKILL.md has no valid YAML frontmatter block")
else:
lines = [line for line in match.group(1).splitlines() if line.strip()]
keys = [line.split(":", 1)[0].strip() for line in lines if ":" in line]
if keys != ["name", "description"]:
errors.append(f"frontmatter keys must be name, description; got {keys}")
if "name: classical-poem-silk-video" not in match.group(1):
errors.append("skill name mismatch")
required = [
"agents/openai.yaml",
"references/runtime-contract.md",