davila7/claude-code-templates · warning

Warning: Could not parse YAML frontmatter for ${skillDirName

Error message

Warning: Could not parse YAML frontmatter for ${skillDirName}

What it means

parseSkill reads a SKILL.md, extracts the YAML frontmatter between --- markers, and parses it with yaml.load. If YAML parsing throws, it warns 'Could not parse YAML frontmatter' and continues with undefined frontmatter — the skill loads with missing metadata (name, description) rather than being skipped. Note this warning deliberately omits the underlying error message.

Source

Thrown at cli-tool/src/skill-dashboard.js:185

      return skills;
    }
  }

  async parseSkill(skillMdPath, skillPath, skillDirName, source) {
    try {
      const content = await fs.readFile(skillMdPath, 'utf8');

      // Parse YAML frontmatter
      const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
      let frontmatter = {};
      let markdownContent = content;

      if (frontmatterMatch) {
        try {
          frontmatter = yaml.load(frontmatterMatch[1]);
          markdownContent = content.substring(frontmatterMatch[0].length).trim();
        } catch (error) {
          console.warn(chalk.yellow(`Warning: Could not parse YAML frontmatter for ${skillDirName}`));
        }
      }

      // Get file stats
      const stats = await fs.stat(skillMdPath);

      // Scan for supporting files
      const supportingFiles = await this.scanSupportingFiles(skillPath);

      // Categorize files by loading strategy
      const categorizedFiles = this.categorizeFiles(supportingFiles, markdownContent);

      return {
        name: frontmatter.name || skillDirName,
        description: frontmatter.description || 'No description available',
        allowedTools: frontmatter['allowed-tools'] || frontmatter.allowedTools || null,
        source,
        path: skillPath,

View on GitHub (pinned to a0851ed10c)

Solutions

  1. Lint the frontmatter: `sed -n '/^---$/,/^---$/p' SKILL.md | sed '1d;$d' | yq -P`
  2. Quote scalar values containing colons or special chars, and replace tabs with spaces
  3. Ensure exactly two `---` delimiter lines with YAML only between them
  4. Re-run the skill dashboard and confirm the skill shows its name/description

Example fix

# before
---
description: Deploy things: fast
---
# after
---
description: "Deploy things: fast"
---
Defensive patterns

Strategy: validation

Validate before calling

function frontmatterParses(content) {
  const m = content.match(/^---\n([\s\S]*?)\n---\n/);
  if (!m) return false;
  try { require('js-yaml').load(m[1]); return true; } catch { return false; }
}

Try / catch

catch (error) {
  console.warn(`Invalid frontmatter, loading skill without metadata: ${error.message}`);
  frontmatter = {}; // explicit default instead of undefined
}

Prevention

When it happens

Trigger: Calling parseSkill on a SKILL.md whose frontmatter block contains invalid YAML: tabs for indentation, unquoted strings with YAML special characters (:, {, }, *, &), duplicate keys, or non-UTF8 bytes.

Common situations: Skill authored in an editor that inserts tabs; description containing an unquoted colon (e.g. `description: Deploy: production`); copy-pasted frontmatter from markdown docs with smart quotes; frontmatter delimiters miscounted so body text gets parsed as YAML.

Related errors


AI-assisted analysis of davila7/claude-code-templates@a0851ed10c (2026-08-28). Data as JSON: /api/errors/00d1a8c145f2573b. Report an issue: GitHub.