[Bug] UTF-8 BOM prevents SKILL.md frontmatter from loading #1397
Replies: 2 comments
|
Confirmed your diagnosis against
The JSON config loaders have the same gap, and there it is worse because So a BOM'd Worth noting the repo already has the helper: If maintainers want this fixed as one change rather than only in the skill loader, the natural shape is stripping the BOM at each read boundary — |
|
Confirmed on Windows 11 with Prime Agent 0.7.2 and Node.js 24.x. The issue is particularly relevant on Windows because many Windows editors (Notepad, Visual Studio) historically saved UTF-8 files with a BOM by default. Users editing SKILL.md files in Notepad will silently produce BOM-prefixed files that Prime Agent silently ignores. Root cause confirmed in const normalized = normalizeNewlines(content);
if (!normalized.startsWith("---")) {
return { yamlString: null, body: normalized };
}
This affects not just SKILL.md but any file parsed through I can reproduce this on Windows with: import { parseFrontmatter } from "./src/utils/frontmatter.ts";
const withBom = "\uFEFF---\nname: test\ndescription: Test\n---\nBody";
console.log(parseFrontmatter(withBom).frontmatter); // {} — emptyA one-line fix in const normalized = normalizeNewlines(content).replace(/^\uFEFF/, "");Happy to test a patch on Windows if maintainers want this addressed. |
Uh oh!
There was an error while loading. Please reload this page.
Affected area
Coding agent and CLI
What happened?
On current
main, aSKILL.mdencoded as UTF-8 with an initial byte-order mark is skipped by the skill loader. The same content without the BOM loads normally.The shared frontmatter parser normalizes newlines but leaves the initial U+FEFF in place. Because it then checks whether the content starts with
---, the BOM-prefixed file is treated as having no frontmatter. The skill loader consequently reportsdescription is requiredand excludes the skill.Steps to reproduce
Using the current parser:
I also loaded two
demo/SKILL.mdfiles whose bytes differed only by the initial UTF-8 BOM:Expected behavior
An initial UTF-8 BOM should not change the parsed frontmatter or prevent the skill from loading.
Prime Agent version
mainat9f9501146e869466acaca66dac49cff857b7b4f9Environment
macOS 26.3.2 arm64, Node.js 24.14.1
Additional context
Prompt templates use the same parser. In a separate check, a BOM-prefixed template also lost its frontmatter metadata and retained the frontmatter block as template content.
I can add a focused regression and narrow fix if maintainers confirm that BOM-prefixed Markdown resources should be supported.
All reactions