Skip to content

fix(validate): catch unquoted YAML frontmatter that runtime drops#30

Closed
mxl wants to merge 1 commit into
antongulin:mainfrom
mxl:fix/yaml-frontmatter-validation
Closed

fix(validate): catch unquoted YAML frontmatter that runtime drops#30
mxl wants to merge 1 commit into
antongulin:mainfrom
mxl:fix/yaml-frontmatter-validation

Conversation

@mxl

@mxl mxl commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Problem

skill_validate accepted SKILL.md files with unquoted description: values containing : (colon-space). OpenCode runtime uses gray-matterjs-yaml which rejects these as malformed YAML mappings, silently dropping the skill from available skills.

Example that passed validation but failed at runtime:

description: Use when tasks involve PDF files: reading, extracting, creating.

Fix

Add strict YAML parse check via the yaml package before structural validation in validateSkill(). Returns clear error with line/column number and a hint to quote the value.

Changes

  • plugin/lib/validate.ts — Import yaml.parseDocument, add frontmatter parse check after extraction
  • plugin/package.json — Add yaml as explicit dependency
  • plugin/test/validate.test.ts — 11 regression tests covering valid quoted, invalid unquoted, and existing checks

Test results

55/55 tests pass, build succeeds.

skill_validate accepted SKILL.md files with unquoted description values
containing ': ' (colon-space). OpenCode runtime uses gray-matter → js-yaml
which rejects these as malformed YAML mappings, silently dropping the skill
from available skills.

Add strict YAML parse check via the yaml package before structural
validation. Returns clear error with line/column and quoting hint.

Closes antongulin#28
antongulin added a commit that referenced this pull request Jul 5, 2026
fix(validate): catch unquoted YAML frontmatter that runtime drops (reworks #30)
@antongulin

Copy link
Copy Markdown
Owner

Thanks @mxl — great catch on the validator/runtime mismatch. Couldn't take the yaml dependency (bundling it broke the compiled dist), so #33 reworked it as a targeted check in the existing parser, carrying over your test scenarios with you credited as co-author — now merged. Appreciate it!

pull Bot pushed a commit to Mu-L/opencode-skill-creator that referenced this pull request Jul 5, 2026
Reworks antongulin#30 without the yaml dependency (which broke the bundled dist
with a CJS interop error). The hand-rolled frontmatter parser now flags
top-level unquoted values containing ': ' — invalid YAML that the
opencode runtime parser silently drops — with the offending key, line
number, and a quoting hint. Quoted values, block scalars, continuation
lines, and list items are unaffected.

Co-authored-by: Michael Ledin <mledin89@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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