Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Create, test, and iteratively improve Claude skills with eval benchmarks and description optimization
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
scripts/utils.py
1"""Shared utilities for skill-creator scripts."""23from pathlib import Path4567def parse_skill_md(skill_path: Path) -> tuple[str, str, str]:8"""Parse a SKILL.md file, returning (name, description, full_content)."""9content = (skill_path / "SKILL.md").read_text()10lines = content.split("\n")1112if lines[0].strip() != "---":13raise ValueError("SKILL.md missing frontmatter (no opening ---)")1415end_idx = None16for i, line in enumerate(lines[1:], start=1):17if line.strip() == "---":18end_idx = i19break2021if end_idx is None:22raise ValueError("SKILL.md missing frontmatter (no closing ---)")2324name = ""25description = ""26frontmatter_lines = lines[1:end_idx]27i = 028while i < len(frontmatter_lines):29line = frontmatter_lines[i]30if line.startswith("name:"):31name = line[len("name:"):].strip().strip('"').strip("'")32elif line.startswith("description:"):33value = line[len("description:"):].strip()34# Handle YAML multiline indicators (>, |, >-, |-)35if value in (">", "|", ">-", "|-"):36continuation_lines: list[str] = []37i += 138while i < len(frontmatter_lines) and (frontmatter_lines[i].startswith(" ") or frontmatter_lines[i].startswith("\t")):39continuation_lines.append(frontmatter_lines[i].strip())40i += 141description = " ".join(continuation_lines)42continue43else:44description = value.strip('"').strip("'")45i += 14647return name, description, content48