Hmbown/CodeWhale · error
SKILL.md is missing the leading '---' frontmatter fence
Error message
SKILL.md is missing the leading '---' frontmatter fence
What it means
parse_frontmatter_name requires SKILL.md to begin with a leading '---' YAML frontmatter fence (after leading whitespace). Skills are validated early so malformed packages are rejected before extraction and install.
Solutions
- Add a frontmatter block at the very top of SKILL.md starting with '---'
- Include at least 'name:' and 'description:' fields inside the frontmatter
- Verify the file is the SKILL.md for the skill, not a README or other doc
Example fix
// before (SKILL.md) # My Skill Some text... // after (SKILL.md) --- name: my-skill description: Does something useful. --- # My Skill
Defensive patterns
Strategy: validation
Validate before calling
let head = std::fs::read_to_string(path.join("SKILL.md"))?;
if !head.trim_start().starts_with("---") {
return Err(anyhow!("SKILL.md must start with '---' frontmatter fence"));
} Type guard
fn has_frontmatter(md: &str) -> bool { md.trim_start().starts_with("---") } Try / catch
match install_skill(pkg) {
Err(e) if e.to_string().contains("frontmatter fence") => eprintln!("SKILL.md lacks '---' frontmatter; add a name/description block at the top"),
other => other?,
} Prevention
- Always author SKILL.md with a leading '---' frontmatter block
- Lint skill packages before distributing them
- Ensure your skill template/generator emits the fence first, with no BOM or shebang before it
When it happens
Trigger: Installing/importing a skill whose SKILL.md starts with prose, a BOM-influenced prefix, markdown headers, or otherwise lacks the opening '---' frontmatter delimiter.
Common situations: Hand-written skill files missing frontmatter; files generated by tools that omit the fence; SKILL.md downloaded from a repo where only the README was authoritative.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- SKILL.md is missing the closing '---' frontmatter fence
- SKILL.md `name` must be a single path-safe segment
- import source must be a compatible external skill
- install source must not be empty
- only Codewhale managed skills can be removed
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/43af76432550e519.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/skills/install.rs:1597
return std::borrow::Cow::Borrowed(path);
}
let with_slash = format!("{prefix}/");
if let Some(rest) = path.strip_prefix(&with_slash) {
std::borrow::Cow::Owned(rest.to_string())
} else if path == prefix {
std::borrow::Cow::Borrowed("")
} else {
std::borrow::Cow::Borrowed(path)
}
}
/// Extract `name:` and ensure `description:` exist in the SKILL.md frontmatter.
/// Also verifies the leading `---` fence so we reject malformed files early.
fn parse_frontmatter_name(bytes: &[u8]) -> Result<String> {
let content = std::str::from_utf8(bytes).context("SKILL.md is not valid UTF-8")?;
let trimmed = content.trim_start();
if !trimmed.starts_with("---") {
bail!("SKILL.md is missing the leading '---' frontmatter fence");
}
let after_open = &trimmed[3..];
let close = after_open.find("---").ok_or_else(|| {
anyhow::anyhow!("SKILL.md is missing the closing '---' frontmatter fence")
})?;
let frontmatter = &after_open[..close];
let mut name: Option<String> = None;
let mut has_description = false;
for raw in frontmatter.lines() {
let line = raw.trim();
if line.is_empty() || line.starts_with('#') {
continue;
}
if let Some((key, value)) = line.split_once(':') {
let key = key.trim().to_ascii_lowercase();
let value = value.trim().to_string();
match key.as_str() {View on GitHub (pinned to 73e0f67d83)