JuliusBrussee/caveman · error
SKILL.md needs closed YAML frontmatter
Error message
SKILL.md needs closed YAML frontmatter
What it means
splitSkillMarkdown must parse SKILL.md into YAML frontmatter plus body; a null result means the frontmatter is absent or not properly closed with a --- delimiter. The importer requires well-formed frontmatter to extract skill metadata.
Solutions
- Add a closed YAML frontmatter block at the top: start the file with '---' and close it with a '---' line.
- Ensure the frontmatter contains required metadata (e.g. name/description) inside the delimiters.
- Check line endings — save with consistent \n and no stray characters on the delimiter lines.
Example fix
// before (SKILL.md) # My Skill body... // after --- name: my-skill description: Does things --- # My Skill body...
Defensive patterns
Strategy: validation
Validate before calling
const text = readFileSync('SKILL.md', 'utf8');
if (!text.startsWith('---')) throw new Error('missing opening --- frontmatter delimiter');
const close = text.indexOf('\n---', 3);
if (close === -1) throw new Error('frontmatter is not closed with ---'); Prevention
- Start every SKILL.md with a closed --- YAML frontmatter block
- Copy a known-good skill template as the starting point
- Lint frontmatter with a YAML parser in CI before import
When it happens
Trigger: Importing a SKILL.md that does not start with '---', is missing the closing '---' line, or has malformed frontmatter delimiters (e.g. extra spaces or '--- ' with trailing text).
Common situations: Hand-written skills without frontmatter; editors that stripped the leading dashes; frontmatter closed with '---\r' line-ending issues or wrong fence style.
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
- catalog
- : currency must be USD
- : must be a safe non-empty identifier
- : catalog must be a non-empty list
- Aider config has duplicate openai-api-base keys; refusing…
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/9447ebe5da9df56e.
Report an issue: GitHub.
Appendix: source
Thrown at packages/cli/src/index.ts:1593
throw new Error(`source does not exist: ${input}`);
}
const stat = lstatSync(resolved);
const file = stat.isDirectory() ? join(resolved, SKILL_MD) : resolved;
if (!stat.isDirectory() && basename(resolved) !== SKILL_MD) throw new Error("source file must be named SKILL.md");
if (!hasFile(file)) throw new Error(`SKILL.md missing under ${resolved}`);
return { root: stat.isDirectory() ? resolved : dirname(resolved), file };
}
function cavemannifyImportedSkill(bytes: Buffer): { body: string; removedDuplicates: number; removedSeparators: number } {
if (bytes.length === 0 || bytes.length > 256 * 1024) throw new Error("SKILL.md must be 1..262144 bytes");
if (bytes.includes(0)) throw new Error("SKILL.md contains NUL bytes");
const text = bytes.toString("utf8");
if (!Buffer.from(text, "utf8").equals(bytes)) throw new Error("SKILL.md must be valid UTF-8");
if (/-----BEGIN [A-Z ]*PRIVATE KEY-----|\b(?:sk|ghp|github_pat|xox[baprs])[-_][A-Za-z0-9_-]{16,}/i.test(text)) {
throw new Error("SKILL.md contains credential-shaped material");
}
const split = splitSkillMarkdown(bytes);
if (!split) throw new Error("SKILL.md needs closed YAML frontmatter");
const blocks = split.bodyText.trim().split(/\r?\n(?:[ \t]*\r?\n)+/);
const seen = new Set<string>();
const kept: string[] = [];
let removedDuplicates = 0;
let removedSeparators = 0;
for (const block of blocks) {
const clean = block.trim();
if (/^(?:---+|\*\*\*+|___+)$/.test(clean)) {
removedSeparators++;
continue;
}
const identity = clean.replace(/\s+/g, " ");
if (seen.has(identity)) {
removedDuplicates++;
continue;
}
seen.add(identity);
kept.push(clean);View on GitHub (pinned to 3ee70a1026)