{"record":{"id":"a251bb525d6b08df","repo":"Hmbown/CodeWhale","slug":"skill-md-is-missing-the-closing-frontmatter","errorCode":null,"errorMessage":"SKILL.md is missing the closing '---' frontmatter fence","messagePattern":"SKILL\\.md is missing the closing '---' frontmatter fence","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/skills/install.rs","lineNumber":1601,"sourceCode":"        std::borrow::Cow::Owned(rest.to_string())\n    } else if path == prefix {\n        std::borrow::Cow::Borrowed(\"\")\n    } else {\n        std::borrow::Cow::Borrowed(path)\n    }\n}\n\n/// Extract `name:` and ensure `description:` exist in the SKILL.md frontmatter.\n/// Also verifies the leading `---` fence so we reject malformed files early.\nfn parse_frontmatter_name(bytes: &[u8]) -> Result<String> {\n    let content = std::str::from_utf8(bytes).context(\"SKILL.md is not valid UTF-8\")?;\n    let trimmed = content.trim_start();\n    if !trimmed.starts_with(\"---\") {\n        bail!(\"SKILL.md is missing the leading '---' frontmatter fence\");\n    }\n    let after_open = &trimmed[3..];\n    let close = after_open.find(\"---\").ok_or_else(|| {\n        anyhow::anyhow!(\"SKILL.md is missing the closing '---' frontmatter fence\")\n    })?;\n    let frontmatter = &after_open[..close];\n\n    let mut name: Option<String> = None;\n    let mut has_description = false;\n    for raw in frontmatter.lines() {\n        let line = raw.trim();\n        if line.is_empty() || line.starts_with('#') {\n            continue;\n        }\n        if let Some((key, value)) = line.split_once(':') {\n            let key = key.trim().to_ascii_lowercase();\n            let value = value.trim().to_string();\n            match key.as_str() {\n                \"name\" if !value.is_empty() => name = Some(value),\n                \"description\" if !value.is_empty() => has_description = true,\n                _ => {}\n            }","sourceCodeStart":1583,"sourceCodeEnd":1619,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/skills/install.rs#L1583-L1619","documentation":"parse_frontmatter_name verified the leading '---' fence but the frontmatter was never closed by a second '---'; SKILL.md is rejected early as malformed rather than parsed with ambiguous frontmatter boundaries.","triggerScenarios":"Importing/installing a skill whose SKILL.md has an opening '---' but the closing '---' line is missing, misspelled, or nested inside content in a way that leaves none findable.","commonSituations":"Hand-edited SKILL.md where the closing fence was deleted; fence written as different characters (e.g. '–––' or '```'); file truncated by a bad copy/paste.","solutions":["Add a closing '---' line after the frontmatter block","Ensure both fences are exactly three ASCII hyphens on their own lines","Validate the SKILL.md frontmatter before packaging"],"exampleFix":"// before\n---\nname: my-skill\ndescription: does things\n// after\n---\nname: my-skill\ndescription: does things\n---","handlingStrategy":"validation","validationCode":"fn has_closed_frontmatter(md: &str) -> bool {\n    let t = md.trim_start();\n    t.starts_with(\"---\") && t[3..].contains(\"---\")\n}","typeGuard":null,"tryCatchPattern":"match parse_skill_md(content) {\n    Ok(fm) => /* use frontmatter */,\n    Err(e) if e.to_string().contains(\"closing '---'\") => eprintln!(\"SKILL.md frontmatter missing closing fence\"),\n    Err(e) => return Err(e),\n}","preventionTips":["Lint SKILL.md frontmatter before packaging skills","Always close '---' fences exactly on their own line","Avoid hand-editing frontmatter without re-validating"],"tags":["skills","frontmatter","validation","markdown"],"backgroundTag":"schema-validation-failed","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}