Skip to content

Marketing skills for Claude Code and AI agents. CRO, copywriting, SEO, analytics, and growth engineering.

fix(validation): accept Windows frontmatter line endings

Rudy Celeklib93ee831e73a
diff --git a/tests/clis/sync-skills-frontmatter.test.cjs b/tests/clis/sync-skills-frontmatter.test.cjs
index 0408189..c462c79 100644
--- a/tests/clis/sync-skills-frontmatter.test.cjs
+++ b/tests/clis/sync-skills-frontmatter.test.cjs
@@ -37,3 +37,20 @@ test('quoted descriptions are still unquoted after CRLF normalization', () => {
test('body fields outside frontmatter do not become skill descriptions', () => {
assert.doesNotMatch(sync('No frontmatter\r\ndescription: Body-only value\r\n'), /Body-only value/)
})
+
+for (const ending of ['\n', '\r\n']) {
+ test(`the skill validator accepts valid ${ending === '\n' ? 'LF' : 'CRLF'} frontmatter`, () => {
+ const root = mkdtempSync(path.join(tmpdir(), 'marketing-validate-frontmatter-'))
+ try {
+ mkdirSync(path.join(root, 'example'))
+ writeFileSync(path.join(root, 'example/SKILL.md'), frontmatter.replace(/\n/g, ending))
+ const result = spawnSync('bash', [path.resolve(__dirname, '../../validate-skills.sh')], {
+ encoding: 'utf8', timeout: 10000, env: { ...process.env, SKILLS_DIR: root },
+ })
+ assert.equal(result.status, 0, result.stdout + result.stderr)
+ assert.match(result.stdout, /All skills are valid/)
+ } finally {
+ rmSync(root, { recursive: true, force: true })
+ }
+ })
+}
diff --git a/validate-skills.sh b/validate-skills.sh
index 2965e1b..de246f9 100755
--- a/validate-skills.sh
+++ b/validate-skills.sh
@@ -42,7 +42,7 @@ for skill_dir in "$SKILLS_DIR"/*/; do
fi
# Extract frontmatter (between the first two `---` markers, exclusive)
- frontmatter=$(awk '/^---$/{count++; next} count==1' "$skill_file")
+ frontmatter=$(awk '{sub(/\r$/, "")} /^---$/{count++; next} count==1' "$skill_file")
# Validate frontmatter exists
if [[ -z "$frontmatter" ]]; then