anthropics/skills · error · ValueError

SKILL.md missing frontmatter (no closing ---)

Error message

SKILL.md missing frontmatter (no closing ---)

What it means

parse_skill_md() found the opening `---` on line 1 but no second `---` line anywhere after it, so the frontmatter block never closes and name/description cannot be delimited. Raised from the same loop that scans for the closing delimiter.

Source

Thrown at skills/skill-creator/scripts/utils.py:22



def parse_skill_md(skill_path: Path) -> tuple[str, str, str]:
    """Parse a SKILL.md file, returning (name, description, full_content)."""
    content = (skill_path / "SKILL.md").read_text()
    lines = content.split("\n")

    if lines[0].strip() != "---":
        raise ValueError("SKILL.md missing frontmatter (no opening ---)")

    end_idx = None
    for i, line in enumerate(lines[1:], start=1):
        if line.strip() == "---":
            end_idx = i
            break

    if end_idx is None:
        raise ValueError("SKILL.md missing frontmatter (no closing ---)")

    name = ""
    description = ""
    frontmatter_lines = lines[1:end_idx]
    i = 0
    while i < len(frontmatter_lines):
        line = frontmatter_lines[i]
        if line.startswith("name:"):
            name = line[len("name:"):].strip().strip('"').strip("'")
        elif line.startswith("description:"):
            value = line[len("description:"):].strip()
            # Handle YAML multiline indicators (>, |, >-, |-)
            if value in (">", "|", ">-", "|-"):
                continuation_lines: list[str] = []
                i += 1
                while i < len(frontmatter_lines) and (frontmatter_lines[i].startswith("  ") or frontmatter_lines[i].startswith("\t")):
                    continuation_lines.append(frontmatter_lines[i].strip())
                    i += 1

View on GitHub (pinned to f6656c1256)

Solutions

  1. Add a line containing exactly `---` after the last frontmatter key (name, description)
  2. Verify with: awk 'NR==1{next} /^---[[:space:]]*$/{print "closes at line " NR; exit}' SKILL.md — no output means it never closes
  3. Keep frontmatter minimal (name + description) so a stray `---` inside long descriptions cannot confuse you

Example fix

# before
---
name: my-skill
description: Long text that never ended

# Body...
# after
---
name: my-skill
description: Long text that never ended
---

# Body...
Defensive patterns

Strategy: validation

Validate before calling

def frontmatter_closes(skill_path: Path) -> bool:
    lines = (skill_path / "SKILL.md").read_text().split("\n")
    return lines[0].strip() == "---" and any(l.strip() == "---" for l in lines[1:])

Try / catch

try:
    parse_skill_md(path)
except ValueError as e:
    if "closing" in str(e):
        print(f"{path}: add a closing --- line")
    raise

Prevention

When it happens

Trigger: Calling parse_skill_md() on a SKILL.md whose frontmatter opens but the body begins without a closing `---`; a horizontal rule written as `---` was intended as content but the file genuinely never closes the block; the closing delimiter was indented with tabs or written as `----` (any line whose .strip() != '---' is not accepted, though ---- also fails).

Common situations: Truncated files cut off mid-frontmatter; hand-editing that deletes the closing delimiter; using `-----` or `—--` (typo/autocorrect) instead of exactly three hyphens.

Related errors


AI-assisted analysis of anthropics/skills@f6656c1256 (2026-08-14). Data as JSON: /api/errors/460369b2ead1b780. Report an issue: GitHub.