Detect documentation drift against filesystem state.
Deterministic 4-phase drift detector that compares the filesystem against README entries. Each phase (Scan, Cross-Reference, Detect, Report) has a gate that must pass before proceeding. The skill produces a sync score (percentage of tools properly documented) and actionable fix suggestions for every detected issue.
This skill checks presence, absence, and version alignment only -- it does not judge description quality, generate documentation content, resolve merge conflicts, validate cross-references, or track when drift occurred. Suggested fixes use YAML descriptions verbatim; content generation and quality assessment require different skills.
Optional flags: --auto-fix (experimental, requires explicit opt-in), --strict (exit code 1 on issues), --format json (machine-readable output for CI/CD).
| Signal | Load These Files | Why |
|---|---|---|
| documentation work | documentation-structure.md |
Loads detailed guidance from documentation-structure.md. |
| example-driven tasks | examples.md | Loads detailed guidance from examples.md. |
| tasks related to this reference | integration-guide.md | Loads detailed guidance from integration-guide.md. |
| tasks related to this reference | markdown-formats.md | Loads detailed guidance from markdown-formats.md. |
| tasks related to this reference | sync-rules.md | Loads detailed guidance from sync-rules.md. |
Goal: Discover all skills, agents, and commands in the repository filesystem. All discovery (file existence checks, YAML parsing, markdown extraction) must be deterministic -- no AI judgment on content quality.
Step 1: Run the scan script
python3 skills/docs-sync-checker/scripts/scan_tools.py --repo-root $HOME/claude-code-toolkit
Step 2: Validate discovery results
For each tool type, verify:
Skills (skills/*/SKILL.md):
--- and closing --- YAML delimitersname, description, and version fieldsname field matches directory name (e.g., skills/code-linting/ has name: code-linting)Agents (agents/*.md):
name fieldname valueCommands (commands/**/*.md):
commands/code/cleanup.md) are detectedStep 3: Count and verify
## Scan Results
Skills found: [N]
Agents found: [N]
Commands found: [N]
YAML errors: [N] (must be 0 to proceed)
Gate: All tools discovered, all YAML valid, counts >0 for each type. Do NOT proceed until gate passes.
Goal: Extract documented tools from README files and compare with discovered tools. Each tool type has a primary documentation file: skills belong in skills/README.md, agents in agents/README.md, commands in commands/README.md.
Step 1: Run the documentation parser
python3 skills/docs-sync-checker/scripts/parse_docs.py --repo-root $HOME/claude-code-toolkit --scan-results /tmp/scan_results.json
Step 2: Parse each documentation file
These are the five documentation files to check -- no others:
| File | Format | What to Extract |
|---|---|---|
skills/README.md | Markdown table | Name, Description, Command, Hook columns |
agents/README.md | Table or list | Name, Description fields |
commands/README.md | Markdown list | /command-name - Description items |
README.md | Inline references | Pattern-match skill: X, /command, agent-name |
docs/REFERENCE.md | Section headers | ### tool-name headers with descriptions |
Step 3: Build documented-tools registry
For each documentation file, collect the set of tool names found. This creates a mapping of {file -> [tool_names]} that Phase 3 will compare against the filesystem scan.
Step 4: Verify parse completeness
Gate: All documentation files parsed without errors. Do NOT proceed until gate passes.
Goal: Compare discovered tools with documented tools to identify drift. This is a point-in-time snapshot -- it cannot tell you when drift occurred, only that it exists now.
Step 1: Compute set differences
For each tool type and its primary documentation file:
missing = filesystem_tools - documented_tools (tools that exist but are not documented)stale = documented_tools - filesystem_tools (documented tools that no longer exist -- users waste time trying to invoke non-existent tools, so always flag these)Step 2: Check version consistency
For tools that appear in both sets, compare:
version field vs. documented version (if version is documented)Step 3: Categorize and assign severity
Severity reflects user impact: missing entries mean tools are undiscoverable, stale entries waste time, version mismatches cause confusion.
| Category | Condition | Severity |
|---|---|---|
| Missing Entry | Tool in filesystem, not in primary README | HIGH |
| Stale Entry | Tool in README, not in filesystem | MEDIUM |
| Version Mismatch | YAML version differs from documented | LOW |
| Incomplete Entry | Documentation missing required fields | LOW |
Step 4: Record issue details
For each issue, capture: tool type, tool name, tool path, affected documentation file(s), severity, and suggested fix action.
Gate: All issues categorized with severity. Do NOT proceed until gate passes.
Goal: Generate human-readable report with actionable fix suggestions. Report facts concisely -- show data, not self-congratulatory descriptions. Target 100% sync score; even one missing entry erodes trust in all documentation.
Step 1: Run the report generator
python3 skills/docs-sync-checker/scripts/generate_report.py --issues /tmp/issues.json --output /tmp/sync-report.md
Step 2: Verify report structure
Report must include these sections:
Summary -- Total tools, issue counts by severity, sync score
sync_score = (total_tools - total_issues) / total_tools * 100
HIGH Priority: Missing Entries -- For each missing tool, provide the exact markdown row/item to add to the appropriate README file
MEDIUM Priority: Stale Entries -- For each stale tool, identify the file and line to remove
LOW Priority: Version Mismatches -- For each mismatch, show YAML version (authoritative) vs. documented version
Files Checked -- List each documentation file with count of tools parsed from it
Step 3: Validate actionability
Every issue in the report must have a concrete suggested fix. No issue should say "review manually" without specifying what to review and where. The fix should enable a single-commit resolution -- tool files and documentation entries should be added/removed together.
Step 4: Report format for missing entries
For each missing skill, generate a suggested table row:
| skill-name | Description from YAML | `skill: skill-name` | - |
For each missing agent, generate a suggested table row:
| agent-name | Description from YAML |
For each missing command, generate a suggested list item:
- `/command-name` - Description from command file
Step 5: Cleanup
Remove any helper scripts and debug outputs created during execution.
Gate: Report generated with actionable suggestions for every issue.
User created skills/my-new-skill/SKILL.md but forgot to update skills/README.md.
Actions:
my-new-skill in filesystemmy-new-skillUser deleted agents/old-agent.md but agents/README.md still lists it.
Actions:
old-agent in filesystemold-agent in agents/README.mdUser updated version: 2.0.0 in skills/code-linting/SKILL.md but docs/REFERENCE.md still shows Version: 1.5.0.
Actions:
User created 3 new skills and deleted 2 old ones in a refactoring PR. Actions:
Cause: Invalid frontmatter -- missing --- delimiters, tabs instead of spaces, or missing required fields
Solution:
--- on line 1 and closing --- after YAML blockname, description, versionhead -20 {file_path} and check syntaxCause: Expected README file does not exist at expected path Solution:
Cause: Wrong --repo-root path, empty directories, or no SKILL.md files Solution:
Cause: Table missing separator row, mismatched column counts, or malformed list items Solution:
|---|---|), and data rows- /command - Descriptionreferences/markdown-formats.md for complete format specifications${CLAUDE_SKILL_DIR}/references/documentation-structure.md: Documentation file matrix, required fields per location, cross-reference requirements${CLAUDE_SKILL_DIR}/references/markdown-formats.md: Expected table/list formats for each README file, parsing rules, common formatting errors${CLAUDE_SKILL_DIR}/references/sync-rules.md: Synchronization rules, severity levels, deprecation handling, namespace rules${CLAUDE_SKILL_DIR}/references/examples.md: Before/after examples for adding, removing, updating, and batch documentation changes${CLAUDE_SKILL_DIR}/references/integration-guide.md: CI/CD setup, pre-commit hooks, auto-fix mode, JSON output, workflow integration