Skip to content

Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.

fix(tier3): parse SKILL.md frontmatter as YAML (#68)

genkey6e3910c29e174
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 817918d9..3d96098c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,11 @@ All notable changes to SkillEvaluator are documented in this file.
### Fixed
+- Tier 3 eval-dataset generation now parses `SKILL.md` frontmatter as YAML.
+ The previous line-based scan captured block-scalar indicators verbatim, so a
+ `description: >-` became the literal string `>-` in every generated prompt,
+ and multi-line quoted scalars were silently truncated to their first line.
+
- GitHub Actions pull request reports now link source targets to the checked-out
repository revision instead of the synthetic `<number>/merge` ref, preventing
broken or cross-repository links.
diff --git a/src/skillevaluator/tier3/generate_dataset.py b/src/skillevaluator/tier3/generate_dataset.py
index 1962f8fb..ca21d2dd 100644
--- a/src/skillevaluator/tier3/generate_dataset.py
+++ b/src/skillevaluator/tier3/generate_dataset.py
@@ -51,7 +51,10 @@ from collections.abc import Sequence
from pathlib import Path
from typing import Any
+import yaml
+
from skillevaluator.evaluation.results import DatasetGenerationError, DatasetGenerationResult
+from skillevaluator.validators.frontmatter_parser import FRONTMATTER_PATTERN
_INTERACTIVE_RE = re.compile(
r"interactive|opens?\s+a?\s*browser|waits?\s+for\s+(the\s+)?user|device.code\s+flow",
@@ -104,14 +107,20 @@ def _parse_skill(skill_path: Path, prompt_file: str | None = None) -> dict[str,
description = ""
scripts: list[str] = []
- # Parse frontmatter
- fm_match = re.match(r"^---\s*\n(.*?)\n---", content, re.DOTALL)
+ # Parse frontmatter as YAML. A line-based scan would capture block-scalar
+ # indicators (``>-``, ``|``) verbatim and truncate multi-line quoted scalars,
+ # so both fields go through the same loader Tier 2 uses.
+ fm_match = FRONTMATTER_PATTERN.match(content)
if fm_match:
- for line in fm_match.group(1).split("\n"):
- if line.startswith("name:"):
- name = line.split(":", 1)[1].strip().strip("'\"")
- elif line.startswith("description:"):
- description = line.split(":", 1)[1].strip().strip("'\"")
+ try:
+ frontmatter = yaml.safe_load(fm_match.group(1))
+ except yaml.YAMLError:
+ frontmatter = None
+ if isinstance(frontmatter, dict):
+ if frontmatter.get("name"):
+ name = str(frontmatter["name"]).strip()
+ if frontmatter.get("description"):
+ description = str(frontmatter["description"]).strip()
# Find scripts
scripts_dir = skill_path / "scripts"
diff --git a/tests/tier3/test_generate_dataset_results.py b/tests/tier3/test_generate_dataset_results.py
index e811da27..45d1175d 100644
--- a/tests/tier3/test_generate_dataset_results.py
+++ b/tests/tier3/test_generate_dataset_results.py
@@ -263,3 +263,38 @@ def test_agent_collect_stages_agentskills_dataset(tmp_path, monkeypatch):
assert data["skill_name"] == "my-skill"
assert data["evals"][0]["prompt"] == "Use my-skill."
assert data["evals"][0]["expected_output"] == "The agent uses the skill."
+
+
+def _parse(tmp_path, frontmatter: str):
+ skill = tmp_path / "my-skill"
+ skill.mkdir()
+ (skill / "SKILL.md").write_text(f"---\n{frontmatter}\n---\n\n# body\n", encoding="utf-8")
+ return generate_dataset._parse_skill(skill)
+
+
+def test_parse_skill_folds_block_scalar_description(tmp_path):
+ """``description: >-`` must fold, not be captured as the literal indicator."""
+ parsed = _parse(
+ tmp_path,
+ "name: my-skill\ndescription: >-\n Writing standards and a checklist.\n Use when revising docs.",
+ )
+ assert parsed["description"] == "Writing standards and a checklist. Use when revising docs."
+ assert parsed["name"] == "my-skill"
+
+
+def test_parse_skill_keeps_literal_block_scalar_newlines(tmp_path):
+ parsed = _parse(tmp_path, "name: my-skill\ndescription: |-\n first line\n second line")
+ assert parsed["description"] == "first line\nsecond line"
+
+
+def test_parse_skill_does_not_truncate_multiline_quoted_description(tmp_path):
+ """A quoted scalar spanning lines was silently cut at the first line."""
+ parsed = _parse(tmp_path, 'name: my-skill\ndescription: "first part\n second part"')
+ assert parsed["description"] == "first part second part"
+
+
+def test_parse_skill_falls_back_to_defaults_on_malformed_frontmatter(tmp_path):
+ """Unparseable YAML must degrade to the directory name and an empty description."""
+ parsed = _parse(tmp_path, "name: [unclosed\ndescription: broken")
+ assert parsed["name"] == "my-skill"
+ assert parsed["description"] == ""