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
test: add committed regression coverage for validate-skills.sh false-negatives
dchukkapalli-dev3b40e4bbfe6d
diff --git a/tests/fixtures/invalid/page--cro/SKILL.md.fixture b/tests/fixtures/invalid/page--cro/SKILL.md.fixturenew file mode 100644index 0000000..da54477--- /dev/null+++ b/tests/fixtures/invalid/page--cro/SKILL.md.fixture@@ -0,0 +1,11 @@+---+name: page--cro+description: Regression fixture — use this when verifying that validate-skills.sh rejects a name with consecutive hyphens. See PR #451 / issue #450.+---++# page--cro (regression fixture)++Intentionally invalid: the `name` contains consecutive hyphens (`--`), which is+not allowed. `validate-skills.sh` must reject this. Not a real skill — the file is+named SKILL.md.fixture so it is not picked up by the validator or CI directly; the+regression runner copies it into a temp SKILL.md before validating.diff --git a/tests/fixtures/invalid/page--cro/expected-error.txt b/tests/fixtures/invalid/page--cro/expected-error.txtnew file mode 100644index 0000000..a3ec4b9--- /dev/null+++ b/tests/fixtures/invalid/page--cro/expected-error.txt@@ -0,0 +1 @@+consecutive hyphens ('--' not allowed)diff --git a/tests/fixtures/invalid/versiontest/SKILL.md.fixture b/tests/fixtures/invalid/versiontest/SKILL.md.fixturenew file mode 100644index 0000000..44b3432--- /dev/null+++ b/tests/fixtures/invalid/versiontest/SKILL.md.fixture@@ -0,0 +1,12 @@+---+name: versiontest+description: Regression fixture — use this when verifying that validate-skills.sh rejects a top-level version field with no metadata block. See PR #451 / issue #450.+version: 1.0.0+---++# versiontest (regression fixture)++Intentionally invalid: `version:` is declared at the top level with no `metadata:`+block. `validate-skills.sh` must reject this. Not a real skill — the file is named+SKILL.md.fixture so it is not picked up by the validator or CI directly; the+regression runner copies it into a temp SKILL.md before validating.diff --git a/tests/fixtures/invalid/versiontest/expected-error.txt b/tests/fixtures/invalid/versiontest/expected-error.txtnew file mode 100644index 0000000..f164082--- /dev/null+++ b/tests/fixtures/invalid/versiontest/expected-error.txt@@ -0,0 +1 @@+'version' is top-level (should be under 'metadata:')diff --git a/tests/run-regression.sh b/tests/run-regression.shnew file mode 100755index 0000000..d608a7e--- /dev/null+++ b/tests/run-regression.sh@@ -0,0 +1,76 @@+#!/bin/bash+#+# Regression tests for validate-skills.sh false-negatives (issue #450 / PR #451).+#+# Guards two bugs where spec-violating skills used to PASS the validator:+# 1. a `name` with consecutive hyphens (e.g. page--cro)+# 2. a top-level `version:` with no `metadata:` block+#+# Each fixture lives in its own directory under tests/fixtures/invalid/:+# <name>/SKILL.md.fixture the intentionally-invalid skill (named .fixture so+# it is not treated as a real skill by the validator+# or the SKILL.md-triggered CI workflow)+# <name>/expected-error.txt the error substring validate-skills.sh must emit+#+# For each fixture the runner builds a temp skills dir containing only that skill+# and points validate-skills.sh at it via the SKILLS_DIR override, then asserts a+# non-zero exit with the expected error.++set -uo pipefail++ROOT="$(cd "$(dirname "$0")/.." && pwd)"+FIXTURES="$ROOT/tests/fixtures/invalid"+fail=0+ran=0++echo "Running validate-skills.sh regression tests..."+echo ""++for fixture_dir in "$FIXTURES"/*/; do+ name="$(basename "$fixture_dir")"+ src="$fixture_dir/SKILL.md.fixture"+ expected_file="$fixture_dir/expected-error.txt"++ if [[ ! -f "$src" || ! -f "$expected_file" ]]; then+ echo "FAIL: '$name' — fixture is missing SKILL.md.fixture or expected-error.txt"+ fail=1+ continue+ fi+ expected="$(cat "$expected_file")"++ tmp="$(mktemp -d)"+ mkdir "$tmp/$name"+ cp "$src" "$tmp/$name/SKILL.md"++ out="$(cd "$ROOT" && SKILLS_DIR="$tmp" bash validate-skills.sh 2>&1)"+ code=$?+ rm -rf "$tmp"+ ((ran++))++ if [[ $code -eq 0 ]]; then+ echo "FAIL: '$name' — validator exited 0, expected non-zero"+ fail=1+ continue+ fi+ if ! grep -qF "$expected" <<<"$out"; then+ echo "FAIL: '$name' — missing expected error: $expected"+ echo "----- validator output -----"+ echo "$out"+ echo "----------------------------"+ fail=1+ continue+ fi+ echo "PASS: '$name' rejected (exit $code): $expected"+done++echo ""+if [[ $ran -eq 0 ]]; then+ echo "No fixtures found under $FIXTURES — nothing to test."+ exit 1+fi+if [[ $fail -eq 0 ]]; then+ echo "All $ran regression test(s) passed."+else+ echo "Regression tests FAILED."+fi+exit $faildiff --git a/validate-skills.sh b/validate-skills.shindex c920a3d..2965e1b 100755--- a/validate-skills.sh+++ b/validate-skills.sh@@ -7,7 +7,8 @@ YELLOW='\033[1;33m'BLUE='\033[0;34m'NC='\033[0m' # No Color-SKILLS_DIR="skills"+# Directory to audit; overridable so regression tests can point at fixtures.+SKILLS_DIR="${SKILLS_DIR:-skills}"ISSUES=0WARNINGS=0PASSED=0