agentskills icon indicating copy to clipboard operation
agentskills copied to clipboard

skills-ref: a quoted frontmatter description containing `---` is rejected as "Invalid YAML"

Open scks1 opened this issue 1 month ago • 0 comments

Environment

  • skills-ref 0.1.0, at agentskills/agentskills commit 69ef37e9424c0a7ea9dd2293b559e43ec8176379, installed editable per the skills-ref README
  • strictyaml 1.7.3, Python 3.12.15, Linux (x86_64)

Summary

skills-ref validate and skills-ref read-properties reject a skill whose frontmatter is valid YAML if a quoted description contains the literal substring ---. The reported error ("Invalid YAML in frontmatter") points at the YAML, but the YAML parses cleanly; the frontmatter is being cut at the --- inside the string before the YAML parser sees it.

Fixtures

Control skill (description without ---):

---
name: control
description: "Read separated receipts"
---

# Receipts

Read the receipts and summarise them.

Counterexample skill (identical except for the description):

---
name: counterexample
description: "Read --- separated receipts"
---

# Receipts

Read the receipts and summarise them.

Observed behaviour

  • Control: skills-ref validate exits 0 ("Valid skill"); skills-ref read-properties exits 0 and returns the description intact.

  • Counterexample: both commands exit 1 with:

    Invalid YAML in frontmatter: while scanning a quoted scalar
      in "<unicode string>", line 3, column 14:
        description: "Read
                     ^ (line: 3)
    found unexpected end of stream
    

Expected behaviour

The counterexample frontmatter is valid YAML: both PyYAML and strictyaml 1.7.3 return description: 'Read --- separated receipts' when the frontmatter block is delimited by its opening and closing delimiter lines. The description field's spec constraints (non-empty, ≤ 1024 characters) are met. The skill should validate and read back with the description intact.

Cause (reporter's finding)

In skills-ref/src/skills_ref/parser.py, parse_frontmatter() splits the file content on the bare substring rather than on a delimiter line (line 45: parts = content.split("---", 2)). For the counterexample, parts[1] — the string handed to the YAML parser — is '\nname: counterexample\ndescription: "Read ', truncated inside the quoted scalar, which produces the unterminated-string YAML error. parts[2] starts with ' separated receipts"\n---\n…', so the remainder of the description would land in the parsed body if the truncated frontmatter happened to parse.

A missing-required-field skill (frontmatter with name only) is still correctly rejected by both commands ("Missing required field in frontmatter: description", exit 1), so the issue is the boundary split, not validation strictness.

Disclosure: this contribution was written by Árbol, an AI assistant working under the direction of the account holder, who set the acceptance criteria and verified the results before submission.

scks1 avatar Oct 31 '26 02:10 scks1