{"record":{"id":"22efd7434f946cde","repo":"zed-industries/zed","slug":"skill-md-missing-closing-frontmatter-delimiter","errorCode":null,"errorMessage":"SKILL.md missing closing frontmatter delimiter (---)","messagePattern":"SKILL\\.md missing closing frontmatter delimiter \\(---\\)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/agent_skills/agent_skills.rs","lineNumber":390,"sourceCode":"        let after_dashes = line_start + 3;\n        let end = if after_dashes == bytes.len() {\n            after_dashes\n        } else if bytes[after_dashes] == b'\\n' {\n            after_dashes + 1\n        } else if after_dashes + 1 < bytes.len()\n            && bytes[after_dashes] == b'\\r'\n            && bytes[after_dashes + 1] == b'\\n'\n        {\n            after_dashes + 2\n        } else {\n            // Line is something like `---trailing` or `----`; not a candidate.\n            continue;\n        };\n        candidates.push(end);\n    }\n\n    if candidates.is_empty() {\n        anyhow::bail!(\"SKILL.md missing closing frontmatter delimiter (---)\");\n    }\n\n    // Try each candidate in order: slice content up through the candidate's\n    // terminator and ask `serde_yaml_ng` to parse it as a YAML stream. If the\n    // first document deserializes into `SkillMetadata`, that candidate is the\n    // real closer. Otherwise an earlier candidate may have cut the YAML in the\n    // middle of a scalar / quoted string; try the next one.\n    let mut last_error: Option<anyhow::Error> = None;\n    for end in candidates {\n        let prefix = &content[..end];\n        let mut docs = serde_yaml_ng::Deserializer::from_str(prefix);\n        let Some(first_doc) = docs.next() else {\n            continue;\n        };\n        match SkillMetadata::deserialize(first_doc) {\n            Ok(metadata) => return Ok((metadata, &content[end..])),\n            Err(e) => last_error = Some(anyhow::Error::new(e)),\n        }","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/agent_skills/agent_skills.rs#L372-L408","documentation":"After the opening `---`, `extract_frontmatter` scans for a closing delimiter: a line consisting exactly of `---` at column 0 (followed by newline or EOF). Lines like `----`, `--- trailing`, or an indented `  ---` are deliberately not candidates. If no candidate exists, the YAML block is unterminated and the file is rejected.","triggerScenarios":"A SKILL.md with an opening `---` but no closing one; a closer written as `----` (four dashes); a closer with trailing spaces/text; horizontal rules in the body being mistaken for the closer while the real closer is missing.","commonSituations":"Hand-writing frontmatter and forgetting the terminator; markdown formatters converting the closer into a longer rule; editing the file and accidentally deleting the second `---`.","solutions":["Add a line containing exactly `---` after the metadata block.","Check for trailing characters after the dashes (`--- ` with trailing spaces is fine only if the line is otherwise exactly dashes — remove any text).","Use exactly three dashes; `----` is treated as body content, not a delimiter.","Keep the closer at column 0 with no indentation."],"exampleFix":"# SKILL.md — before (no closer)\n---\nname: my-skill\ndescription: ...\n# Body starts here\n\n# SKILL.md — after\n---\nname: my-skill\ndescription: ...\n---\n# Body starts here","handlingStrategy":"validation","validationCode":"fn has_frontmatter_closer(content: &str) -> bool {\n    let mut lines = content.trim_start().lines();\n    lines.next(); // opener\n    lines.any(|line| line == \"---\")\n}","typeGuard":null,"tryCatchPattern":"match agent_skills::parse_skill_file_content(&content) {\n    Err(e) if e.to_string().contains(\"missing closing frontmatter delimiter\") => {\n        // insert `---` after the metadata block and reload\n    }\n    rest => rest,\n}","preventionTips":["Always close the frontmatter with a bare `---` line at column 0.","Use exactly three dashes; `----` is treated as body content.","Disable markdown formatters' rule-normalization around frontmatter blocks."],"tags":["rust","zed","agent-skills","yaml","frontmatter","skills","parse-error"],"backgroundTag":"yaml-frontmatter-invalid","analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}