"""The skills this repository ships must match the skills it uses. `init` writes `.claude/skills/*/SKILL.md` into every new repository from the constants in `skills_content`, so those constants are a distributed artifact with a second copy checked in here. Editing one and not the other shipped a stale skill into every repository created afterwards -- silently, because neither `validate` nor any other test compared them. """ from __future__ import annotations from pathlib import Path import pytest from stewardship import skills_content REPO_ROOT = Path(__file__).resolve().parents[1] DISTRIBUTED = { "repository-bootstrap": skills_content.REPOSITORY_BOOTSTRAP_SKILL, "repository-adoption": skills_content.REPOSITORY_ADOPTION_SKILL, "repo-handoff": skills_content.REPO_HANDOFF_SKILL, } @pytest.mark.parametrize("name", sorted(DISTRIBUTED)) def test_shipped_skill_matches_the_one_in_this_repository(name: str) -> None: on_disk = (REPO_ROOT / ".claude" / "skills" / name / "SKILL.md").read_text(encoding="utf-8") assert on_disk.strip() == DISTRIBUTED[name].strip(), ( f"{name}: .claude/skills/{name}/SKILL.md and skills_content.py have diverged. " "Update both, or the next `repoctl init` ships the stale one." ) def test_adoption_skill_does_not_offer_normalization() -> None: """CLAUDE.md: do not describe an operation the CLI does not offer. The skill may name `--strategy normalize` in order to say it is unavailable; what it must never do is instruct someone to use it. """ text = skills_content.REPOSITORY_ADOPTION_SKILL assert "Only use `--strategy normalize" not in text assert "not implemented" in text