Marketing skills for Claude Code and AI agents. CRO, copywriting, SEO, analytics, and growth engineering.
JavaScript agent-skillsai-agentsai-seoclaudeclaude-codeclaude-code-pluginclaude-skillscodexcontent-marketingconversion-rate-optimizationcopywritingcursoremail-marketinggenerative-engine-optimizationgrowth-marketingmarketingmarketing-automationsaas-marketingseoskill-md
fix(validation): require closed frontmatter at start of skill files
Rudy Celekli6023a144700d
diff --git a/tests/fixtures/invalid/body-frontmatter/SKILL.md.fixture b/tests/fixtures/invalid/body-frontmatter/SKILL.md.fixturenew file mode 100644index 0000000..1733e47--- /dev/null+++ b/tests/fixtures/invalid/body-frontmatter/SKILL.md.fixture@@ -0,0 +1,8 @@+# This file has no frontmatter++---+name: body-frontmatter+description: Use when reviewing evidence; for reporting see analysis.+metadata:+ version: 1.0.0+---diff --git a/tests/fixtures/invalid/body-frontmatter/expected-error.txt b/tests/fixtures/invalid/body-frontmatter/expected-error.txtnew file mode 100644index 0000000..db9a626--- /dev/null+++ b/tests/fixtures/invalid/body-frontmatter/expected-error.txt@@ -0,0 +1 @@+Missing or unclosed YAML frontmatter (---)diff --git a/tests/fixtures/invalid/unclosed-frontmatter/SKILL.md.fixture b/tests/fixtures/invalid/unclosed-frontmatter/SKILL.md.fixturenew file mode 100644index 0000000..ac5d965--- /dev/null+++ b/tests/fixtures/invalid/unclosed-frontmatter/SKILL.md.fixture@@ -0,0 +1,6 @@+---+name: unclosed-frontmatter+description: Use when reviewing evidence; for reporting see analysis.+metadata:+ version: 1.0.0+# Missing closing markerdiff --git a/tests/fixtures/invalid/unclosed-frontmatter/expected-error.txt b/tests/fixtures/invalid/unclosed-frontmatter/expected-error.txtnew file mode 100644index 0000000..db9a626--- /dev/null+++ b/tests/fixtures/invalid/unclosed-frontmatter/expected-error.txt@@ -0,0 +1 @@+Missing or unclosed YAML frontmatter (---)diff --git a/validate-skills.sh b/validate-skills.shindex 2965e1b..fa39853 100755--- a/validate-skills.sh+++ b/validate-skills.sh@@ -41,13 +41,19 @@ for skill_dir in "$SKILLS_DIR"/*/; docontinuefi- # Extract frontmatter (between the first two `---` markers, exclusive)- frontmatter=$(awk '/^---$/{count++; next} count==1' "$skill_file")-- # Validate frontmatter exists- if [[ -z "$frontmatter" ]]; then+ # Frontmatter must start the file and have a closing marker. Body sections+ # containing `---` must not supply skill metadata.+ frontmatter=$(awk '+ NR == 1 && $0 != "---" { exit 1 }+ /^---$/ { count++; if (count == 2) exit; next }+ count == 1 { print }+ END { if (count != 2) exit 1 }+ ' "$skill_file")++ # Validate both marker boundaries before using the extracted metadata.+ if [[ $? -ne 0 || -z "$frontmatter" ]]; thenecho -e "${RED}❌ $skill_name${NC}"- echo " Missing YAML frontmatter (---)"+ echo " Missing or unclosed YAML frontmatter (---)"((ISSUES++))continuefi