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
ci: enforce version bumps and validate all skill files (#607)
Corey Haines4821ba165ac1
diff --git a/.github/workflows/check-versions.yml b/.github/workflows/check-versions.ymlnew file mode 100644index 0000000..e9a165f--- /dev/null+++ b/.github/workflows/check-versions.yml@@ -0,0 +1,31 @@+name: Check Versions++on:+ pull_request:+ types: [opened, synchronize, reopened, ready_for_review]+ branches: [main]+ paths:+ - "skills/**"+ - "VERSIONS.md"+ - ".claude-plugin/**"+ - "scripts/check-versions.mjs"++permissions:+ contents: read++concurrency:+ group: check-versions-${{ github.ref }}+ cancel-in-progress: true++jobs:+ check:+ runs-on: ubuntu-slim+ if: github.event.pull_request.draft != true && github.actor != 'dependabot[bot]'+ steps:+ - name: Checkout repository+ uses: actions/checkout@v6+ with:+ fetch-depth: 0++ - name: Check skill and repo versions+ run: node scripts/check-versions.mjs --base origin/${{ github.base_ref }}diff --git a/.github/workflows/validate-skill.yml b/.github/workflows/validate-skill.ymlindex 35e31b9..5f59a04 100644--- a/.github/workflows/validate-skill.yml+++ b/.github/workflows/validate-skill.yml@@ -4,11 +4,12 @@ on:push:branches: [main]paths:- - "**/SKILL.md"+ - "skills/**"pull_request:+ types: [opened, synchronize, reopened, ready_for_review]branches: [main]paths:- - "**/SKILL.md"+ - "skills/**"concurrency:group: validate-skill-${{ github.ref }}@@ -37,11 +38,11 @@ jobs:HEAD=${{ github.event.after }}fi- # Find changed SKILL.md files and extract skill directories+ # Find skill directories with any changed file (skip deleted skills)SKILLS=$(git diff --name-only $BASE $HEAD | \- grep 'SKILL.md$' | \- xargs -I {} dirname {} | \+ grep -oE '^skills/[^/]+' | \sort -u | \+ while read -r d; do if [ -f "$d/SKILL.md" ]; then echo "$d"; fi; done | \jq -R -s -c 'split("\n") | map(select(length > 0))')echo "skills=$SKILLS" >> $GITHUB_OUTPUTdiff --git a/AGENTS.md b/AGENTS.mdindex 71f13c1..5f1247e 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -61,6 +61,14 @@ Do not bump y for content added to an existing skill, no matter how substantialBump the repo release version in the same PR that ships the change (2.7.0 and 2.8.0 shipped without touching plugin.json/marketplace.json and needed a catch-up later).+CI enforces both layers on PRs. Fetch first so `origin/main` is current, then run it locally before pushing:++```bash+node scripts/check-versions.mjs --base origin/main+```++It fails if a changed skill didn't bump `metadata.version`, if `VERSIONS.md` disagrees with any SKILL.md, if the repo version didn't bump (or has no `### x.y.z` block), or if a file in `references/` isn't linked from anywhere in its skill. Changes only under a skill's `evals/` don't need a bump, since they don't change what installed users get.+## Agent Skills SpecificationSkills follow the [Agent Skills spec](https://agentskills.io/specification.md).diff --git a/scripts/check-versions.mjs b/scripts/check-versions.mjsnew file mode 100644index 0000000..d52ee9c--- /dev/null+++ b/scripts/check-versions.mjs@@ -0,0 +1,105 @@+#!/usr/bin/env node+// Enforce the versioning rules in AGENTS.md.+//+// node scripts/check-versions.mjs # consistency checks only+// node scripts/check-versions.mjs --base origin/main # also require bumps vs base (CI)+//+// Consistency:+// - every skill's metadata.version matches its VERSIONS.md row, and every skill has a row+// - plugin.json and marketplace.json share one repo version with a `### x.y.z` block in VERSIONS.md+// - every file in skills/<name>/references/ is linked from that skill's SKILL.md+// or from another of its reference files (no orphans)+// With --base:+// - a skill whose files changed must bump metadata.version (evals/ is exempt: it doesn't ship behavior)+// - if any skill changed, was added, or was removed, the repo version must bump++import { readFileSync, readdirSync, existsSync } from "node:fs";+import { resolve, dirname } from "node:path";+import { fileURLToPath } from "node:url";+import { execFileSync } from "node:child_process";++const HERE = dirname(fileURLToPath(import.meta.url));+const ROOT = resolve(HERE, "..");+const baseIdx = process.argv.indexOf("--base");+const base = baseIdx > -1 ? process.argv[baseIdx + 1] : null;++const errors = [];+const read = (p) => readFileSync(resolve(ROOT, p), "utf8");+const git = (...args) => execFileSync("git", args, { cwd: ROOT, encoding: "utf8" });++const frontmatter = (text) => text.replace(/\r\n/g, "\n").match(/^---\n([\s\S]*?)\n---/)?.[1] ?? "";+const skillVersion = (text) => frontmatter(text).match(/^metadata:\s*\n(?:[ \t]+.*\n)*?[ \t]+version:\s*["']?([\d.]+)/m)?.[1];+const repoVersion = (json) => JSON.parse(json).version;+const marketVersion = (json) => JSON.parse(json).metadata?.version;++const skills = readdirSync(resolve(ROOT, "skills"), { withFileTypes: true })+ .filter((d) => d.isDirectory() && existsSync(resolve(ROOT, "skills", d.name, "SKILL.md")))+ .map((d) => d.name);++// VERSIONS.md table <-> SKILL.md metadata+const versionsMd = read("VERSIONS.md").replace(/\r\n/g, "\n");+const table = Object.fromEntries(+ [...versionsMd.matchAll(/^\|\s*([a-z0-9-]+)\s*\|\s*(\d+\.\d+\.\d+)\s*\|/gm)].map((m) => [m[1], m[2]])+);++for (const name of skills) {+ const v = skillVersion(read(`skills/${name}/SKILL.md`));+ if (!v) errors.push(`skills/${name}/SKILL.md: missing metadata.version`);+ else if (!table[name]) errors.push(`VERSIONS.md: no row for ${name}`);+ else if (table[name] !== v) errors.push(`${name}: SKILL.md is ${v} but VERSIONS.md says ${table[name]}`);+}+for (const name of Object.keys(table)) {+ if (!skills.includes(name)) errors.push(`VERSIONS.md: row for ${name}, but skills/${name}/SKILL.md doesn't exist`);+}++// Repo version+const plugin = repoVersion(read(".claude-plugin/plugin.json"));+const market = marketVersion(read(".claude-plugin/marketplace.json"));+if (plugin !== market) errors.push(`plugin.json is ${plugin} but marketplace.json metadata.version is ${market}`);+if (!new RegExp(`^### ${plugin.replaceAll(".", "\\.")}(\\s|$)`, "m").test(versionsMd)) errors.push(`VERSIONS.md: no "### ${plugin}" changelog block`);++// Orphan references+for (const name of skills) {+ const dir = resolve(ROOT, "skills", name, "references");+ if (!existsSync(dir)) continue;+ const files = readdirSync(dir);+ const skillMd = read(`skills/${name}/SKILL.md`);+ for (const file of files) {+ if (skillMd.includes(file)) continue;+ const linkedFromSibling = files.some((other) => other !== file && read(`skills/${name}/references/${other}`).includes(file));+ if (!linkedFromSibling) errors.push(`skills/${name}/references/${file}: not linked from SKILL.md or any sibling reference`);+ }+}++// Bumps vs base+if (base) {+ const atBase = (path) => {+ try {+ return git("show", `${base}:${path}`);+ } catch {+ return null;+ }+ };+ const changed = git("diff", "--name-only", `${base}...HEAD`).split("\n").filter(Boolean);+ const touched = (paths) => [...new Set(paths.map((p) => p.match(/^skills\/([^/]+)\//)?.[1]).filter(Boolean))];+ const changedSkills = touched(changed.filter((p) => !/^skills\/[^/]+\/evals\//.test(p)));++ for (const name of changedSkills.filter((n) => skills.includes(n))) {+ const before = atBase(`skills/${name}/SKILL.md`);+ if (!before) continue;+ const was = skillVersion(before);+ const now = skillVersion(read(`skills/${name}/SKILL.md`));+ if (was === now) errors.push(`${name}: files changed but metadata.version is still ${now}`);+ }++ const basePlugin = atBase(".claude-plugin/plugin.json");+ if (changedSkills.length && basePlugin && repoVersion(basePlugin) === plugin) {+ errors.push(`skills changed (${changedSkills.join(", ")}) but repo version is still ${plugin}`);+ }+}++if (errors.length) {+ console.error(errors.map((e) => `✗ ${e}`).join("\n"));+ process.exit(1);+}+console.log(`✓ versions consistent across ${skills.length} skills (repo ${plugin})${base ? `, bumps checked against ${base}` : ""}`);