fix(skill): accept YAML block scalars in SKILL.md frontmatter#76
Conversation
The frontmatter parser only handled single-line `key: value` scalars, so a
`description: |` (literal) or `description: >` (folded) block — valid YAML,
and the common way to write a long multi-line description — was rejected with
"unexpected indented line in frontmatter", which fails skill discovery on the
first Prompt and takes the whole session down.
Parse block scalars: collect the following more-indented lines as the value,
dedented, joined with newlines (literal) or spaces (folded), ending at the
next non-indented key or end of frontmatter, with an optional +/- chomping
indicator accepted. Description length validation still applies to the
assembled value. The explicit indentation-indicator form ("|2") stays out of
scope. TDD: literal, folded, chomped, and block-before-next-key cases.
📦 Previous Review (superseded by newer review)Claude finished @andybons's task in 2m 31s —— View job Code review — PR #76: accept YAML block scalars in SKILL.md frontmatter
Solid, well-scoped fix. The parser is careful: the One real issue and two minor notes. 🟠 The package doc now contradicts the code (
|
…h test Address PR #76 review: - The package doc listed block scalars and multi-line values as deliberately unsupported, which the parser now contradicts. Move them to the supported- constructs list with the exact semantics (dedent, literal/folded join, |2 out of scope, + normalized to clip); the package doc is this package's spec. - Note at blockScalarIndicator that the +/- chomping indicator is accepted for a valid header but + (keep) is normalized to clip, matching parseBlockScalar. - Add TestLoadBlockScalarDescriptionLengthLimit: a block scalar whose joined value exceeds 1024 runes is still rejected, locking the value through the same length guard as inline scalars.
|
Claude finished @andybons's task in 1m 39s —— View job Code review — PR #76: accept YAML block scalars in SKILL.md frontmatter
Re-review of the follow-up commit ( Prior findings — all addressed:
Fresh pass on the parser — still clean:
Build/test: LGTM. Nothing blocking; ready to merge from my side. |
Summary
The Agent-Skills
SKILL.mdfrontmatter parser (skill/frontmatter.go) onlyunderstood single-line
key: valuescalars. A YAML block scalar —description: |(literal) ordescription: >(folded), the standard way towrite a long multi-line description and valid YAML — was rejected with
unexpected indented line in frontmatter. Because discovery fails loudly onthe first
Prompt, one skill with a block-scalar description takes the wholesession down.
Fix
parseFrontmatternow recognizes a block-scalar header (|/>with anoptional
+/-chomping indicator) and collects the following more-indentedlines as the value: dedented, joined with newlines (literal) or spaces
(folded), ending at the next non-indented key or end of frontmatter. Trailing
blank lines are dropped. Description length limits still apply to the assembled
value. The explicit indentation-indicator form (
|2) is intentionally out ofscope.
Testing
TestLoadBlockScalarDescription(red-verified before the fix) covers literal,folded, strip-chomped, and block-value-before-another-key cases. Full
skillpackage tests pass;
go build ./...andgo vet ./skill/clean.