JuliusBrussee/caveman · error

SKILL.md missing under

Error message

SKILL.md missing under ${resolved}

What it means

After resolving the source, importedSkillSource computes the manifest path (directory + SKILL.md, or the file itself) and checks it exists via hasFile. If a directory was given but no SKILL.md exists directly under it, this error is thrown.

Solutions

  1. Create a SKILL.md at the root of the directory being imported
  2. If the manifest is nested, point the import at the directory that directly contains SKILL.md
  3. Fix filename casing to exactly SKILL.md
  4. Verify with ls <dir>/SKILL.md before importing

Example fix

// before
// skills/my-skill/docs/SKILL.md
importSkillSource("./skills/my-skill");
// after
// move to skills/my-skill/SKILL.md (or pass the subdir)
importSkillSource("./skills/my-skill/docs");
Defensive patterns

Strategy: validation

Validate before calling

const manifest = stat.isDirectory() ? join(resolved, "SKILL.md") : resolved;
if (!existsSync(manifest)) throw new Error("SKILL.md not found at " + manifest);

Type guard

null

Try / catch

try { import(input); } catch (e) { if (e.message.startsWith("SKILL.md missing under")) { console.error("Create a SKILL.md at the directory root"); } else throw e; }

Prevention

When it happens

Trigger: Importing a directory that lacks a top-level SKILL.md, e.g. ./my-skill when the manifest lives at ./my-skill/docs/SKILL.md.

Common situations: Skill folders scaffolded without a manifest; SKILL.md nested in a subdirectory; case mismatch (skill.md) on Linux; manifest deleted during refactoring.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/ca93052b4022a3e8. Report an issue: GitHub.

Appendix: source

Thrown at packages/cli/src/index.ts:1580

	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;
	let removedSeparators = 0;

View on GitHub (pinned to 3ee70a1026)