JuliusBrussee/caveman · error

SKILL.md contains credential-shaped material

Error message

SKILL.md contains credential-shaped material

What it means

The importer scans the decoded SKILL.md text for credential-shaped material: PEM private key headers and API-token patterns (sk-, ghp-, github_pat-, xoxb/p/a/r/s- prefixes). Matches cause an immediate rejection to prevent secrets from being committed into skills.

Solutions

  1. Remove or redact the private key / token-like string from SKILL.md and re-import.
  2. Replace example credentials with placeholders like <YOUR_API_KEY> or ${API_KEY}.
  3. If a false positive (e.g. a benign 'sk-' prefixed slug), rewrite the string to avoid the credential prefix pattern.

Example fix

// before (in SKILL.md)
api_key = sk-abc123def456ghi789jk

// after
api_key = ${MY_API_KEY}
Defensive patterns

Strategy: validation

Validate before calling

const text = readFileSync('SKILL.md', 'utf8');
const credPattern = /-----BEGIN [A-Z ]*PRIVATE KEY-----|\b(?:sk|ghp|github_pat|xox[baprs])[-_][A-Za-z0-9_-]{16,}/i;
if (credPattern.test(text)) throw new Error('remove credential-shaped material before import');

Prevention

When it happens

Trigger: Running skill import on a SKILL.md whose text matches /-----BEGIN [A-Z ]*PRIVATE KEY-----/ or contains a token-like string such as 'sk-...' (note: the generic sk- prefix also matches non-OpenAI strings of sufficient length).

Common situations: Authoring a skill that embeds example API keys or real secrets; documentation that quotes a private key block; a long random slug beginning with 'sk-' or 'xoxa-' tripping the heuristic.

Related errors


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

Appendix: source

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

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;
	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;

View on GitHub (pinned to 3ee70a1026)