Skip to content

fix(integrations): escape multiline/control chars in SKILL.md frontmatter#3392

Open
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/skill-frontmatter-yaml-escape
Open

fix(integrations): escape multiline/control chars in SKILL.md frontmatter#3392
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/skill-frontmatter-yaml-escape

Conversation

@Quratulain-bilal

@Quratulain-bilal Quratulain-bilal commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

fixes #3391

the skills setup path builds SKILL.md frontmatter by hand and its _quote helper only escaped backslash and quote. a double-quoted yaml scalar can't carry a raw newline or control character, so a multiline (block-scalar) description reparsed with its newlines collapsed to spaces, and a control character broke yaml loading entirely. the description comes from the template frontmatter, so any command with a block-scalar description hits the multiline corruption.

this is the SKILL.md sibling of the toml escaping in #3341 and the goose yaml issue #3382 — a different code path in the same file, plus the identical _quote twin in the hermes integration.

fix: add a shared specify_cli/_yaml_string.quote_yaml_double helper that emits a valid double-quoted scalar (newline/cr/tab short escapes, other control chars as \xXX) and route both renderers through it, so there's one implementation to keep correct.

added a regression test that round-trips a multiline description through the yaml parser. i confirmed it fails on the pre-fix code by stashing the source and re-running (first line\nsecond line -> 'first line second line '); it passes with the fix, and the skills suites stay green.

…tter

the hand-built SKILL.md frontmatter in the skills setup path (base.py, and
the hermes twin) wrapped values in a double-quoted yaml scalar but only
escaped backslash and quote. a multiline (block-scalar) description was then
emitted with raw newlines inside the quoted scalar and reparsed with those
newlines collapsed to spaces; a control character would break yaml loading
outright. the description comes from the template frontmatter, so this is
reachable for any command with a block-scalar description.

add a shared specify_cli/_yaml_string.quote_yaml_double helper that emits a
valid double-quoted scalar (newline/cr/tab short escapes, other control chars
as \xXX) and route both renderers through it. added a regression test that
round-trips a multiline description through the yaml parser.
@Quratulain-bilal Quratulain-bilal requested a review from mnriem as a code owner July 7, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SKILL.md frontmatter corrupts multiline descriptions and breaks on control characters

1 participant