{"record":{"id":"9447ebe5da9df56e","repo":"JuliusBrussee/caveman","slug":"skill-md-needs-closed-yaml-frontmatter","errorCode":null,"errorMessage":"SKILL.md needs closed YAML frontmatter","messagePattern":"SKILL\\.md needs closed YAML frontmatter","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/index.ts","lineNumber":1365,"sourceCode":"\t\tthrow new Error(`source does not exist: ${input}`);\n\t}\n\tconst stat = lstatSync(resolved);\n\tconst file = stat.isDirectory() ? join(resolved, SKILL_MD) : resolved;\n\tif (!stat.isDirectory() && basename(resolved) !== SKILL_MD) throw new Error(\"source file must be named SKILL.md\");\n\tif (!hasFile(file)) throw new Error(`SKILL.md missing under ${resolved}`);\n\treturn { root: stat.isDirectory() ? resolved : dirname(resolved), file };\n}\n\nfunction cavemannifyImportedSkill(bytes: Buffer): { body: string; removedDuplicates: number; removedSeparators: number } {\n\tif (bytes.length === 0 || bytes.length > 256 * 1024) throw new Error(\"SKILL.md must be 1..262144 bytes\");\n\tif (bytes.includes(0)) throw new Error(\"SKILL.md contains NUL bytes\");\n\tconst text = bytes.toString(\"utf8\");\n\tif (!Buffer.from(text, \"utf8\").equals(bytes)) throw new Error(\"SKILL.md must be valid UTF-8\");\n\tif (/-----BEGIN [A-Z ]*PRIVATE KEY-----|\\b(?:sk|ghp|github_pat|xox[baprs])[-_][A-Za-z0-9_-]{16,}/i.test(text)) {\n\t\tthrow new Error(\"SKILL.md contains credential-shaped material\");\n\t}\n\tconst split = splitSkillMarkdown(bytes);\n\tif (!split) throw new Error(\"SKILL.md needs closed YAML frontmatter\");\n\tconst blocks = split.bodyText.trim().split(/\\r?\\n(?:[ \\t]*\\r?\\n)+/);\n\tconst seen = new Set<string>();\n\tconst kept: string[] = [];\n\tlet removedDuplicates = 0;\n\tlet removedSeparators = 0;\n\tfor (const block of blocks) {\n\t\tconst clean = block.trim();\n\t\tif (/^(?:---+|\\*\\*\\*+|___+)$/.test(clean)) {\n\t\t\tremovedSeparators++;\n\t\t\tcontinue;\n\t\t}\n\t\tconst identity = clean.replace(/\\s+/g, \" \");\n\t\tif (seen.has(identity)) {\n\t\t\tremovedDuplicates++;\n\t\t\tcontinue;\n\t\t}\n\t\tseen.add(identity);\n\t\tkept.push(clean);","sourceCodeStart":1347,"sourceCodeEnd":1383,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/cli/src/index.ts#L1347-L1383","documentation":"Error \"SKILL.md needs closed YAML frontmatter\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at packages/cli/src/index.ts:1365 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add closed YAML frontmatter (--- ... ---) at the top of SKILL.md."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}