{"record":{"id":"23797c6907d221fd","repo":"JuliusBrussee/caveman","slug":"skill-md-must-be-1-262144-bytes","errorCode":null,"errorMessage":"SKILL.md must be 1..262144 bytes","messagePattern":"SKILL\\.md must be 1\\.\\.262144 bytes","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/index.ts","lineNumber":1585,"sourceCode":"\tbenchmarks: { status: \"required\"; fixtures: string[] };\n\tevidence_status: \"unevaluated\";\n\tpublication: { status: \"blocked\"; blockers: string[] };\n};\n\nfunction importedSkillSource(input: string): { root: string; file: string } {\n\tlet resolved: string;\n\ttry { resolved = realpathSync(resolve(process.cwd(), expandTilde(input))); } catch {\n\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;","sourceCodeStart":1567,"sourceCodeEnd":1603,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/cli/src/index.ts#L1567-L1603","documentation":"cavemannifyImportedSkill validates the raw SKILL.md bytes before processing. An empty file or one larger than 256*1024 bytes (262144) is rejected with this size-limit error, keeping imported skills within a sane size budget.","triggerScenarios":"Importing a SKILL.md that is 0 bytes or exceeds 262144 bytes, e.g. a skill containing huge generated tables, logs, or embedded datasets.","commonSituations":"Machine-generated skill files; concatenating docs into one manifest; empty placeholder files created by a scaffold; pasting large transcripts into SKILL.md.","solutions":["Trim the SKILL.md to under 262144 bytes — move bulky reference material to separate linked files","Populate the empty SKILL.md with real frontmatter and instructions","Minify/compress tables and examples inside the manifest","Verify size with wc -c SKILL.md before importing"],"exampleFix":"// before\n// SKILL.md is 400000 bytes of embedded logs\n// after\n// split: keep SKILL.md < 262144 bytes, move logs to reference/logs.md\nwc -c skills/my-skill/SKILL.md","handlingStrategy":"validation","validationCode":"import { statSync } from \"node:fs\";\nconst { size } = statSync(manifestPath);\nif (size === 0 || size > 256 * 1024) throw new Error(`SKILL.md size ${size} outside 1..262144`);","typeGuard":"null","tryCatchPattern":"try { import(input); } catch (e) { if (e.message === \"SKILL.md must be 1..262144 bytes\") { console.error(\"Trim SKILL.md below 256 KiB or fill the empty file\"); } else throw e; }","preventionTips":["Add a CI check that skill manifests stay under 256 KiB","Keep generated data out of SKILL.md; link to auxiliary files","Fail fast on zero-byte placeholders before shipping skills"],"tags":["skills","size-limit","validation"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}