claude-skills/scripts/build_verified_tier.py
Claude ca9d6499db
feat(growth): verified tier, hero repos, README first screen, contributor credit
- VERIFIED.md lists the 152 skills that loaded on every plain-language test
  prompt, built by scripts/build_verified_tier.py from the latest measurement
  of each live description; gate G15 keeps it current.
- heroes/heroes.json + scripts/export_hero.py generate standalone repos for
  agent-run-forensics, human-gate and skill-retro; hero-sync.yml pushes them
  once HERO_SYNC_TOKEN and the repos exist.
- README opens with the tested-library promise, one install line per path,
  a pick-your-role table and six verified starting skills; stale counts gone.
- release.yml thanks community contributors by handle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L8KYFKjWjYmERFxzdP2kKu
2026-11-05 05:42:09 +00:00

129 lines
5.4 KiB
Python

#!/usr/bin/env python3
"""Build VERIFIED.md: the skills that loaded on every plain-language test prompt.
Reads audit/verified-tier/trigger_results.json (the latest trigger-eval result
per skill) and writes VERIFIED.md, grouped by domain. A skill is verified when
its latest measurement is FIRES: every positive prompt loaded that exact skill
and the negative prompt loaded nothing.
Usage:
python3 scripts/build_verified_tier.py # write VERIFIED.md
python3 scripts/build_verified_tier.py --check # exit 1 if VERIFIED.md is stale
# or a listed skill no longer exists
Stdlib only.
"""
from __future__ import annotations
import argparse
import json
import re
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
DATA = ROOT / "audit" / "verified-tier" / "trigger_results.json"
OUT = ROOT / "VERIFIED.md"
MARKETPLACE_NAME = "claude-code-skills"
def first_sentence(skill_md: Path) -> str:
text = skill_md.read_text(encoding="utf-8")
m = re.search(r"^---\n(.*?)\n---", text, re.S)
front = m.group(1) if m else ""
d = re.search(r"^description:\s*(.*?)(?=^\w[\w-]*:|\Z)", front, re.S | re.M)
desc = d.group(1) if d else ""
desc = re.sub(r"^[>|][-+]?\s*", "", desc.strip())
desc = " ".join(desc.split()).strip("\"'")
sentence = re.split(r"(?<=[.!?])\s", desc, maxsplit=1)[0]
return sentence.replace("|", "\\|")
def build(data: dict) -> tuple[str, list[str]]:
errors: list[str] = []
plugins = {p["name"] for p in json.loads(
(ROOT / ".claude-plugin" / "marketplace.json").read_text(encoding="utf-8"))["plugins"]}
verified = [s for s in data["skills"] if s["verdict"] == "FIRES"]
by_domain: dict[str, list[dict]] = {}
for s in verified:
skill_md = ROOT / s["skill"] / "SKILL.md"
if not skill_md.exists():
errors.append(f"{s['skill']}: SKILL.md not found (renamed or removed?)")
continue
if s["plugin"] not in plugins:
errors.append(f"{s['skill']}: plugin '{s['plugin']}' not in marketplace.json")
continue
s = dict(s, summary=first_sentence(skill_md))
by_domain.setdefault(s["skill"].split("/")[0], []).append(s)
measured = len(data["skills"])
lines = [
"# Verified skills",
"",
"<!-- Generated by scripts/build_verified_tier.py from "
"audit/verified-tier/trigger_results.json. Do not edit by hand. -->",
"",
f"**{len(verified)} of the {measured} skills we tested loaded on every plain-language "
"test prompt and stayed quiet on the unrelated one.** Install any of them and Claude Code "
"picks it up when you describe the task in your own words, without naming the skill.",
"",
"A skill whose description doesn't match how people ask for help sits installed and unused, "
"and few skill libraries publish whether theirs load. We measure it, and CI blocks a new skill "
"that loads on fewer than half of its test prompts.",
"",
"## How we test",
"",
f"- Claude Code {data['claude_version']}, model `{data['model']}`, only the skill's own plugin installed.",
"- Each skill gets positive prompts written the way a user would ask, without the skill's name, "
"and one negative prompt that is close but should not load it.",
"- **Verified** means every positive prompt loaded that exact skill and the negative prompt loaded nothing.",
"- The latest measurement wins. Measurements used:",
]
for tag, desc in data["measurements"].items():
lines.append(f" - `{tag}`: {desc}")
lines += [
"",
"Two prompts per skill is a small sample, so read this as a strong signal rather than a guarantee. "
"A skill missing from this list may still work when you ask for it by name.",
"",
"## Install",
"",
"```bash",
"/plugin marketplace add alirezarezvani/claude-skills",
f"/plugin install <plugin>@{MARKETPLACE_NAME}",
"```",
"",
]
for domain in sorted(by_domain):
rows = sorted(by_domain[domain], key=lambda s: s["name"])
lines += [f"## {domain} ({len(rows)})", "", "| Skill | What it does | Plugin |", "|---|---|---|"]
for s in rows:
lines.append(f"| [{s['name']}]({s['skill']}/SKILL.md) | {s['summary']} | `{s['plugin']}` |")
lines.append("")
return "\n".join(lines), errors
def main() -> int:
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
ap.add_argument("--check", action="store_true", help="fail if VERIFIED.md is stale or a listed skill is gone")
args = ap.parse_args()
data = json.loads(DATA.read_text(encoding="utf-8"))
text, errors = build(data)
for e in errors:
print(f"ERROR: {e}", file=sys.stderr)
if args.check:
current = OUT.read_text(encoding="utf-8") if OUT.exists() else ""
if current != text:
print("ERROR: VERIFIED.md is stale. Run: python3 scripts/build_verified_tier.py", file=sys.stderr)
return 1
if errors:
return 1
print(f"VERIFIED.md is current ({text.count('](')} skills).")
return 0
OUT.write_text(text, encoding="utf-8")
print(f"Wrote {OUT.relative_to(ROOT)}")
return 1 if errors else 0
if __name__ == "__main__":
sys.exit(main())