Synchronizes docs across a repository. Use when user asks to sync docs.
Maintains the CLAUDE.md navigation hierarchy and README.md invisible knowledge docs across a repository. This skill is self-contained and performs all documentation work directly.
For authoritative CLAUDE.md and README.md format specification:
<file working-dir=".claude" uri="conventions/documentation.md" />The conventions/ directory contains all universal documentation standards.
Determine scope FIRST:
| User Request | Scope |
|---|---|
| "sync docs" / "update documentation" / no specific path | REPOSITORY-WIDE |
| "sync docs in src/validator/" | DIRECTORY: src/validator/ and descendants |
| "update CLAUDE.md for parser.py" | FILE: single file's parent directory |
For REPOSITORY-WIDE scope, perform a full audit. For narrower scopes, operate only within the specified boundary.
Map directories requiring CLAUDE.md verification:
# Find all directories (excluding .git, node_modules, __pycache__, etc.)
find . -type d \( -name .git -o -name node_modules -o -name __pycache__ -o -name .venv -o -name target -o -name dist -o -name build \) -prune -o -type d -print
For each directory in scope, record:
For each directory, check for drift and misplaced content:
<audit_check dir="[path]">
CLAUDE.md exists: [YES/NO]
Has table-based index: [YES/NO]
Files in directory: [list]
Files in index: [list]
Missing from index: [list]
Stale in index (file deleted): [list]
Triggers are task-oriented: [YES/NO/PARTIAL]
Contains misplaced content: [YES/NO] (architecture/design docs that belong in README.md)
README.md exists: [YES/NO]
README.md warranted: [YES/NO] (invisible knowledge present?)
</audit_check>
Critical: If CLAUDE.md contains content that does NOT belong there, migrate it:
Content that MUST be moved from CLAUDE.md to README.md:
Content that MAY stay in CLAUDE.md (operational sections):
Test: Ask "is this explaining WHY or telling HOW?" Explanatory content (architecture, decisions, rationale) goes to README.md. Operational content (commands, procedures) stays in CLAUDE.md.
Migration process:
For each directory needing work:
Creating/Updating CLAUDE.md:
Creating README.md (when invisible knowledge exists):
After all updates complete, verify:
## Doc Sync Report
### Scope: [REPOSITORY-WIDE | directory path]
### Changes Made
- CREATED: [list of new CLAUDE.md files]
- UPDATED: [list of modified CLAUDE.md files]
- MIGRATED: [list of content moved from CLAUDE.md to README.md]
- CREATED: [list of new README.md files]
- FLAGGED: [any issues requiring human decision]
### Verification
- Directories audited: [count]
- CLAUDE.md coverage: [count]/[total] (100%)
- CLAUDE.md format: [count] pure index / [count] needed migration
- Drift detected: [count] entries fixed
- Content migrations: [count] (prose moved to README.md)
- README.md files: [count] (wherever invisible knowledge exists)
- Self-contained: [YES/NO] (no external authoritative references)
DO NOT create CLAUDE.md for:
.gitkeep or no code files) - these do not
require CLAUDE.md until code is addedDO NOT index (skip these files in CLAUDE.md):
DO index:
Too vague (matches everything):
| `config/` | Configuration | Working with configuration |
Content description instead of trigger:
| `cache.rs` | Contains the LRU cache implementation | - |
Missing action verb:
| `parser.py` | Input parsing | Input parsing and format handling |
| `cache.rs` | LRU cache with O(1) get/set | Implementing caching, debugging misses, tuning eviction |
| `config/` | YAML config parsing, env overrides | Adding config options, changing defaults, debugging config loading |
For additional trigger pattern examples, see references/trigger-patterns.md.