Skip to content

[Bug] SKILL.md YAML parsing fails silently when description contains unescaped double quotes #859

Open

Description

@easonLiangWorldedtech

Problem (one or two sentences)

SKILL.md frontmatter parsing fails silently when the description field contains unescaped double quotes (e.g., "TDD", "test-driven development"), causing gray-matter/js-yaml to throw a YAMLException. The error message shown is misleading: "missing required 'name' field" — but the name IS present; it just couldn't be parsed because of the YAML syntax error.

Context (who is affected and when)

Affects any user or AI creating skills via the UI (createSkill tool), skill-writer mode, or manual file creation when the description contains double quotes. The skill silently fails to load — no visible indication in the Skills UI that parsing failed (only shown in Developer Tools console). This is a UX issue because users have no way to discover the real error without opening DevTools.

Reproduction steps

  1. Create a skill file at ~/.roo/skills/test-skill/SKILL.md with this content:
---
name: test-skill
description: Use when implementing features. Triggers on: "TDD", "test-driven development"
---

# Test Skill

Instructions here.
  1. Open Zoo Code → Settings → Skills tab
  2. The skill does not appear in the list (even though SKILL.md exists)
  3. Check Developer Tools console (Help → Toggle Developer Tools) — see:
    [Extension Host] Skill at <path> is missing required 'name' field
    

Programmatic reproduction:

cd /c/work/Zoo-Code
node -e "const matter = require('./node_modules/.pnpm/[email protected]/node_modules/gray-matter'); const fs = require('fs'); const content = fs.readFileSync('C:/Users/eason/.roo/skills/test-driven-development/SKILL.md', 'utf-8'); console.log(JSON.stringify(matter(content).data, null, 2));"

Output:

YAMLException: incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line at line 3, column 128

Expected result

Either:

  • The skill loads successfully (gray-matter handles unescaped quotes gracefully), OR
  • A clear error message explains the YAML parsing failure and points to the exact issue (e.g., "description contains unescaped double quotes")

Actual result

The skill silently fails to load. The console shows a misleading error: missing required 'name' field even though the name IS present in the frontmatter. Users/AI have no way to discover the real cause without opening DevTools.

Variations tried (optional)

  • Wrapping description in single quotes (description: 'Use when ... "TDD" ...') — works ✅
  • Using backticks instead of double quotes (Triggers on: \TDD``) — works ✅
  • Removing all quotes from description — works ✅

App Version

Current main (v3.58.x+)

API Provider

Not Applicable / Other

Relevant logs or errors

[Extension Host] Skill at C:\Users\eason\.roo\skills\test-driven-development is missing required 'name' field

Root cause: In src/services/skills/SkillsManager.ts line 102-115, when matter(fileContent) throws a YAML parsing error (from [email protected]), it's caught by the outer try/catch block at line 173. The specific YAML syntax error is lost — only "missing required 'name' field" is logged.

Proposed approach

Option A: Separate gray-matter parsing error (recommended)

In loadSkillMetadata(), catch the matter() parse error separately before checking fields:

// Before (line ~102-115)
const fileContent = await fs.readFile(skillMdPath, "utf-8")
const { data: frontmatter, content: body } = matter(fileContent)

if (!frontmatter.name || typeof frontmatter.name !== "string") {
    console.error(`Skill at ${skillDir} is missing required 'name' field`)
    return
}

// After
try {
    const fileContent = await fs.readFile(skillMdPath, "utf-8")
    let parsedResult
    try {
        parsedResult = matter(fileContent)
    } catch (parseError) {
        console.error(`Failed to parse SKILL.md at ${skillDir}: YAML syntax error - ${parseError.message}`)
        return
    }
    
    const frontmatter = parsedResult.data
    if (!frontmatter.name || typeof frontmatter.name !== "string") {
        console.error(`Skill at ${skillDir} is missing required 'name' field`)
        return
    }
    // ... rest of validation
} catch (error) {
    console.error(`Failed to load skill at ${skillDir}:`, error)
}

Option B: Auto-wrap description in createSkill() tool

In the handleCreateSkill method, automatically wrap the description value in single quotes if it contains double quotes or other special YAML characters. This prevents the issue for skills created via the UI tool.

Trade-offs / risks

  • Option A: Minimal risk — only changes error message clarity. No behavior change for valid SKILL.md files.
  • Option B: Could introduce unexpected formatting (e.g., single quotes in description might look odd). Requires careful escaping logic.
  • Both options are backward-compatible — existing valid skills continue to work.

Related

N/A — new issue.

Activity

  1. changed the title [-]Bug: SKILL.md YAML parsing fails silently when description contains unescaped double quotes[/-] [+][Bug] SKILL.md YAML parsing fails silently when description contains unescaped double quotes[/+] on Jul 7, 2026
  2. easonLiangWorldedtech commented on Dec 2, 2026

    @easonLiangWorldedtech
    ContributorAuthor

    Split plan for the #859 fix, recorded before the split PR opened

    The pre-merge "Out of Scope Changes" check at head ffe19c1fb4 of #1321 asks for the mechanisms that #859 does not name to leave that diff. This comment records the plan, per the repository split policy. #1321 and the unit PR cite this comment.

    Content source of record: ffe19c1fb4208d7283e163ae084d1ad00f4fd87f. Each unit ports its content from that commit only.

    Unit Branch PR Scope Delta vs its own base Changed executable lines
    U0 u0/skill-diagnostics #1321 YAML parse-error diagnostics: parse-error catch, line-scoped quote hint, parse options, SkillDiagnostic type, getSkillDiagnostics(), getSkillsState() test API, skillDiagnostics on the skills message, settings pane, snapshot, 18 skills.diagnostics.* locales, e2e suite. Plus createSkill/updateSkillModes serialization through gray-matter with lineWidth: -1. 36 files, +1,738 / −40 extension 76, webview 37
    U1 u1/skill-publish new draft PR Crash-safe SKILL.md publish: temp sidecar and rename, per-directory queue keyed by realpath, permission-bit preservation and a named publish mode, realpath containment with skills:errors.outside_skills_root, stale-sidecar sweep with one bounded retry, disposal and queued-work rejection, memoized initialize(). Tracked as #2804. 22 files, +1,373 / −176 extension 218

    Topology and merge order: stacked chain, U0 then U1. U1 replaces content only. After U0 merges, U1 rebases onto main and its diff stops carrying U0.

    Cross-unit contract points:

    • U0 owns getFrontmatterLine, SkillYamlDumpOptions, SKILL_YAML_DUMP_OPTIONS, recordDiagnostic, getSkillDiagnostics.
    • U1 owns writeSkillFileAtomically, withDirectoryLock, assertTargetWithinSkillsRoots, sweepStaleSkillTempFiles, activeTempFiles, and the disposal guards.
    • U1 consumes SKILL_YAML_DUMP_OPTIONS from U0. It does not redefine it. No shared helper is duplicated across the two units.

    Budgets: both units sit under the CI caps of scripts/stryker-diff.mjs (MAX_CHANGED_LINES = 500, MAX_MUTANTS = 400). Both exceed the 400 soft a+d cap. The excess is tests, one PNG snapshot and 36 locale files in U0, and the spec rows of the moved mechanisms in U1.

    Reproduction of the numbers: selectFromGit(repo, base, head) from scripts/stryker-diff.mjs, base 7d8053fefa1c1b489866aece98d4c12691c4c9fa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions