Skip to content

fix: reject invalid SKILL.md YAML frontmatter#202

Merged
nikomatsakis merged 4 commits into
symposium-dev:mainfrom
jlizen:main
May 8, 2026
Merged

fix: reject invalid SKILL.md YAML frontmatter#202
nikomatsakis merged 4 commits into
symposium-dev:mainfrom
jlizen:main

Conversation

@jlizen
Copy link
Copy Markdown
Member

@jlizen jlizen commented May 8, 2026

What does this PR do?

Problem

Symposium parsed SKILL.md frontmatter with a loose line-based parser, so malformed YAML like description: [Critical] ... could pass validation and be installed by hook-managed sync. Agents then rejected the copied skill at startup because they parse the same frontmatter as YAML.

We are also serving some broken frontmatter in symposium/recommendations. That package's CI will now fail due to our tighter validation, and I'll fix it over there (symposium-dev/recommendations#9)

Solution

Parse skill frontmatter as YAML before matching or installing skills, require metadata fields to be strings, and add a sync regression test proving invalid skill frontmatter is skipped instead of copied into .agents/skills.

symposium will warn when it skips loading due to misformatted files. That might not be the right ux choice long-term, but whilst most of our users are people also developing symposium, it's probably good :)

I didn't add a snapshot test since the sync output is not designed to have i/o injected and it would have exploded the diff. Happy to follow up with that if desired.

Here's a manual test though:

 Running `/Users/jess/workplace/symposium/target/debug/cargo-agents sync`
⚠️  skipping /tmp/symposium-home/plugins/bad-skill/SKILL.md: failed to load standalone skill: failed to parse frontmatter in /tmp/symposium-home/plugins/bad-skill/SKILL.md
ℹ️  scanning 2 workspace dependencies
🟢 /private/tmp/symposium-workspace/.codex/hooks.json: hooks already registered
➖ removed skill rust-best-practice from /private/tmp/symposium-workspace/.agents/skills/rust-best-practice
ℹ️  no applicable skills found for workspace dependencies

AI disclosure.

  • I used an AI tool for research, autocomplete, or in other minimal ways
  • The AI tool authored small parts of the code (e.g., autocomplete, comments)
  • The AI tool authored large parts of the code

Confidence level.

  • I am very happy with it

Copy link
Copy Markdown
Member

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good

Comment thread src/skills.rs Outdated
bail!("SKILL.md frontmatter keys must be strings");
};

if key == "applies-when" {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should just remove this if, I thikn it .. serves no purpose?

Comment thread tests/init_sync.rs
&["invalid-skill0", "workspace0"],
async |mut ctx| {
ctx.symposium(&["init", "--add-agent", "codex"]).await?;
ctx.symposium(&["sync"]).await?;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like a test that plugin validate will reject a plugin repo with a standalone skill that is illformed

@nikomatsakis nikomatsakis added this pull request to the merge queue May 8, 2026
Merged via the queue into symposium-dev:main with commit fbd83e6 May 8, 2026
12 checks passed
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.

2 participants