Synchronize and validate Claude documentation (CLAUDE.md files and skills) before commits. Ensures documentation accuracy by validating all claims against actual codebase state.
Use when: (1) Before...
Validate all Claude-related documentation before commits. Default mode is changed (branch-scoped); use full for exhaustive validation.
Full mode: Find all Claude docs in repository:
**/CLAUDE.md (excluding .terragrunt-cache/, .terragrunt-stack/).claude/skills/*/SKILL.md.claude/skills/*/references/*.mdChanged mode: Analyze branch diff:
git diff --name-only origin/main...HEADSpawn parallel Haiku agents organized by validation type:
One agent per major directory validates file/directory references:
infrastructure/ pathskubernetes/ paths.taskfiles/ pathsValidation checks:
[path/to/file](path/to/file)infrastructure/modules/**/*.tfValidate code-level claims:
Validate command examples:
task <name> commands exist in TaskfileValidate documentation consistency:
Collect results from all agents into a unified report grouped by severity (CRITICAL / WARNING / INFO), showing doc path, line number, the broken reference, and a suggested fix. Count valid references. Present issues before proposing edits.
Spawn Opus agent to:
Discovery Agent (Haiku): Use discover-claude-docs.sh (or discover-claude-docs.sh --changed) to enumerate files. For each file, run extract-references.sh to get path refs, dir refs, commands, skill refs, and CLI tools as structured JSON. Scripts are in .claude/skills/sync-claude/scripts/.
Path Validator Agents (Haiku, one per directory domain): Verify each path ref exists using Glob/Read. For misses, fuzzy-search for renames. Return valid/invalid lists with suggestions.
Command Validator Agent (Haiku): Verify task <name> commands exist in Taskfile.yaml or .taskfiles/*. Verify CLI tools appear in Brewfile. kubectl/git: syntax check only. Return valid/invalid with suggestions.
Change Impact Analyzer (Haiku, changed mode only): Parse git diff --name-only origin/main...HEAD. Find docs directly modified. Search all docs for references to changed paths/directories. Return impacted doc list.
Opus Validator Agent: Deduplicate all Haiku findings. Categorize severity (CRITICAL: broken refs users will hit; WARNING: outdated but functional; INFO: cosmetic). Generate proposed Edit operations (old_string/new_string). Present for user approval before applying.
IF user specifies mode:
USE specified mode
ELSE IF on main branch:
USE full mode
ELSE IF branch has commits ahead of origin/main:
USE changed mode
ELSE:
USE full mode (no changes to analyze)
Always exclude from scanning:
.terragrunt-cache/.terragrunt-stack/node_modules/.git/*.rendered/If an agent fails: