JuliusBrussee/caveman · error
source file must be named SKILL.md
Error message
source file must be named SKILL.md
What it means
When the skill import source is a file (not a directory), importedSkillSource requires that the file be named SKILL.md, since only that filename is treated as a skill manifest. Importing any other single file throws this error.
Solutions
- Point the source at the SKILL.md file itself
- Pass the containing directory instead — the importer then looks for SKILL.md inside it
- Rename the file to SKILL.md (exact case) on case-sensitive filesystems
Example fix
// before
importSkillSource("./my-skill/README.md");
// after
importSkillSource("./my-skill/SKILL.md"); Defensive patterns
Strategy: validation
Validate before calling
const stat = lstatSync(resolve(input));
if (!stat.isDirectory() && basename(resolve(input)) !== "SKILL.md") throw new Error("pass the SKILL.md file or its directory"); Type guard
null
Try / catch
try { import(input); } catch (e) { if (e.message === "source file must be named SKILL.md") { input = join(dirname(input), "SKILL.md"); } else throw e; } Prevention
- Always import either a directory or the SKILL.md file itself
- Keep the manifest named exactly SKILL.md (mind case on Linux)
- Document in skill templates that README.md is not the manifest
When it happens
Trigger: Passing a file path like ./notes.md or ./my-skill/README.md directly as the import source.
Common situations: Pointing the importer at README.md or a prompt file instead of the skill manifest; renamed manifests (skill.md lowercase on case-sensitive filesystems); exporting a single doc and trying to import it.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- SKILL.md missing under
- awscreds: read container authorization token file
- cannot persist MCP ownership journal at
- cannot safely launch Windows command shim
- cave_sandbox_source_read_root_refused
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/60dffd3ddf860a3c.
Report an issue: GitHub.
Appendix: source
Thrown at packages/cli/src/index.ts:1579
entry_condition: { status: string; value?: string };
stop_condition: { status: string; value?: string };
prompt: { bytes: number; byte_budget: number; status: string };
resources: { scripts: string[]; references: string[]; assets: string[]; status: string };
transformations: { exact_duplicate_blocks_removed: number; decorative_separators_removed: number };
conflicts: { status: "needs_review"; declared: string[] };
benchmarks: { status: "required"; fixtures: string[] };
evidence_status: "unevaluated";
publication: { status: "blocked"; blockers: string[] };
};
function importedSkillSource(input: string): { root: string; file: string } {
let resolved: string;
try { resolved = realpathSync(resolve(process.cwd(), expandTilde(input))); } catch {
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;View on GitHub (pinned to 3ee70a1026)