Skip to content

Python: Fix YAML block scalar parsing in file skill frontmatter #5713

@SergeyMenshykh

Description

@SergeyMenshykh

Port of .NET PR #5610.

Python's _extract_frontmatter() uses a simple regex (YAML_KV_RE) that only matches single-line key: value pairs. YAML block scalars (|, >, |-, >+) are silently truncated to just the scalar indicator character.

For example, this SKILL.md:

---
name: my-skill
description: |
  This is a multi-line
  description block
---

Would parse description as | instead of the full multi-line text.

Changes needed

  • Update _extract_frontmatter() to detect block scalar indicators and consume subsequent indented lines
  • Handle literal (|) and folded (>) block scalars with chomping variants (-, +)
  • Add unit tests for block scalar parsing

Metadata

Metadata

Type

No type

Projects

Status

Planned

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions