CLAUDE.md Maintenance Guide¶
Overview¶
GetCimple uses a distributed hub-and-spoke architecture for CLAUDE.md files. This guide explains how to maintain these files to ensure Claude Code always has the right context.
Architecture¶
Hub-and-Spoke Model¶
Root CLAUDE.md (hub) - High-level project context & navigation
βββ docs-internal/CLAUDE.md - Internal documentation workflows
βββ docs-customer/CLAUDE.md - Customer documentation guidelines
βββ scripts/CLAUDE.md - Validation scripts & rules
βββ ai-docs/CLAUDE-ai.md - AI development methodology
βββ specs/CLAUDE-specs.md - Code style & tech stack
Design Principles¶
- Slim root - Keep root CLAUDE.md under 120 lines
- Domain-specific context - Each directory has targeted guidance
- Single source of truth - No duplication across files
- Clear navigation - Backlinks connect hub to spokes
- Context efficiency - AI loads only relevant context
File Sizes & Scope¶
| File | Target Size | Current | Scope |
|---|---|---|---|
| Root CLAUDE.md | <120 lines | 111 | Project identity, navigation |
| docs-internal/CLAUDE.md | <200 lines | 272 | MkDocs, validation, standards |
| docs-customer/CLAUDE.md | <200 lines | 258 | Customer docs, tone, guidelines |
| scripts/CLAUDE.md | <300 lines | 429 | Scripts, validation, rules (ok) |
| ai-docs/CLAUDE-ai.md | <200 lines | 160 | MCP tools, AI methodology |
| specs/CLAUDE-specs.md | <200 lines | 131 | Code style, tech stack, commands |
| Total distributed | - | 1,361 | Well-organized across 6 files |
| Original monolithic (backup) | - | 186 | All in one file (anti-pattern) |
Maintenance Workflow¶
When to Update CLAUDE.md Files¶
Update CLAUDE.md files when:
- β Adding new npm scripts or commands
- β Changing validation rules or processes
- β Adding new MCP tools or AI patterns
- β Updating tech stack or coding standards
- β Restructuring directories or files
- β Adding new documentation standards
- β Changing development workflows
Do NOT update for:
- β Minor content edits in documentation
- β Fixing typos in markdown files
- β Adding individual feature docs
- β Updating business process docs
Which File to Update¶
| Change Type | Update File(s) |
|---|---|
| New npm command | Relevant domain file + root if critical |
| Documentation standard | docs-internal/CLAUDE.md |
| Customer content guideline | docs-customer/CLAUDE.md |
| Validation rule | scripts/CLAUDE.md |
| MCP tool or AI pattern | ai-docs/CLAUDE-ai.md |
| Code style or tech stack | specs/CLAUDE-specs.md |
| Critical instruction | Root CLAUDE.md |
| New domain directory | Create new CLAUDE.md + update root |
| Cross-cutting workflow change | Multiple files (ensure consistency) |
| Project phase change (e.g., "MVP | launching") |
Update Process¶
1. Identify Impact
- What changed?
- Which domain(s) does it affect?
- Is it critical or domain-specific?
2. Update Relevant File(s)
# Edit the appropriate CLAUDE.md file
# For example, adding a new validation command:
vim scripts/CLAUDE.md
3. Check for Duplication
- Search other CLAUDE.md files for similar content
- Remove or consolidate duplicates
- Update cross-references if needed
4. Format and Validate
5. Test Context
- Navigate to the directory
- Verify Claude Code would load correct context
- Check backlinks work
6. Commit with Clear Message
Anti-Patterns to Avoid¶
1. Context Duplication¶
β WRONG:
# In root CLAUDE.md
npm run docs:check:consistency # Validation command
# In scripts/CLAUDE.md
npm run docs:check:consistency # Same command duplicated
β RIGHT:
# In root CLAUDE.md
npm run docs:check:all # Only most common command
# In scripts/CLAUDE.md
npm run docs:check:consistency # Lenient mode
npm run docs:check:consistency:strict # Strict mode
# ... detailed validation commands
2. Over-Fragmentation¶
β WRONG:
docs-internal/docs/04-business/CLAUDE.md
docs-internal/docs/05-architecture/CLAUDE.md
docs-internal/docs/06-features/CLAUDE.md
# Too many tiny context files
β RIGHT:
3. Stale Context¶
β WRONG:
- Command changed 3 months ago
- CLAUDE.md still shows old command
- AI gets confused
β RIGHT:
- Include "Update CLAUDE.md" in PR checklist
- Quarterly review of all CLAUDE.md files
- Update immediately when commands change
4. Ambiguous Boundaries¶
β WRONG:
- Same information in specs/CLAUDE-specs.md and docs-internal/CLAUDE.md
- Unclear which one to update
- Content drifts out of sync
β RIGHT:
- Clear scope: specs = code, docs-internal = documentation
- Explicit boundaries documented
- Cross-references where needed
Quarterly Maintenance Checklist¶
Perform these checks every quarter:
1. Content Audit¶
- Review each CLAUDE.md file for accuracy
- Check commands are current
- Verify links work
- Remove outdated information
- Update examples if needed
2. Size Check¶
wc -l /home/vic/projects/vichong/getcimple/CLAUDE.md \
/home/vic/projects/vichong/getcimple/docs-internal/CLAUDE.md \
/home/vic/projects/vichong/getcimple/docs-customer/CLAUDE.md \
/home/vic/projects/vichong/getcimple/scripts/CLAUDE.md \
/home/vic/projects/vichong/getcimple/ai-docs/CLAUDE-ai.md \
/home/vic/projects/vichong/getcimple/specs/CLAUDE-specs.md
- Root CLAUDE.md under 120 lines?
- Domain files under 200 lines (scripts ok at <300)?
- If over limit, consider splitting or trimming
3. Duplication Scan¶
- No duplicate commands
- No duplicate instructions
- Single source of truth maintained
4. Navigation Verification¶
- All backlinks work (../CLAUDE.md)
- Hub links to all spoke files
- Related context files linked correctly
5. Scope Validation¶
- Each file has clear, distinct scope
- No overlap or ambiguity
- Boundaries well-defined
Adding New Domain Files¶
When adding a new CLAUDE.md file:
1. Determine Need¶
Only create new CLAUDE.md if:
- β
New major domain emerges (e.g.,
/tests,/src) - β Domain has unique context (different from existing files)
- β Domain will have 5+ unique instructions/patterns
- β Content would exceed 50 lines
Don't create if:
- β Subdirectory of existing domain
- β Only 1-2 unique points
- β Already covered in parent CLAUDE.md
2. Template¶
# CLAUDE.md - [Domain Name]
_Parent context: [Root CLAUDE.md](../CLAUDE.md)_
This file provides context-specific guidance for [domain description].
## Overview
[Brief description of the domain]
## Quick Command Reference
[Commands specific to this domain]
## [Domain-Specific Sections]
[Content relevant to this domain only]
## Related Context Files
- [Root CLAUDE.md](../CLAUDE.md) - Project overview, critical instructions
- [Other Domain 1](../path/CLAUDE.md) - Description
- [Other Domain 2](../path/CLAUDE.md) - Description
3. Update Root CLAUDE.md¶
Add to the "Domain-Specific Context" section:
4. Test and Validate¶
# Format new file
npm run format:docs
# Test context loading
cd [new-domain-directory]
# Verify Claude would load correct context
# Check for issues
npm run docs:check:all
Troubleshooting¶
Problem: Context Not Loading¶
Symptom: Claude doesn't seem to have domain-specific context
Solution:
- Check file exists:
ls [domain]/CLAUDE.md - Verify backlink:
head -n 5 [domain]/CLAUDE.md - Ensure file is formatted:
npm run format:docs - Check Claude Code is reading from correct directory
Problem: Duplicate Information¶
Symptom: Same instruction appears in multiple files
Solution:
- Identify canonical location (single source of truth)
- Remove from other locations
- Add cross-reference if needed
- Document in this guide which file owns that content
Problem: File Too Large¶
Symptom: CLAUDE.md file exceeds recommended size
Solution:
- Review for unnecessary detail
- Move examples to separate docs
- Use references instead of full content
- Consider if subdomain should split out
- Ensure no duplication with other files
Problem: Unclear Which File to Update¶
Symptom: Change could go in multiple files
Solution:
- Consult "Which File to Update" table above
- Choose most specific domain
- If truly cross-cutting, update all relevant files
- Ensure consistency across updates
- Consider if abstraction needed
Best Practices¶
Writing Style¶
- Be concise - Every line should add value
- Be specific - Use exact commands, not generalities
- Be current - Update immediately when things change
- Be clear - Avoid ambiguity
- Be actionable - Provide commands, not just descriptions
Organization¶
- Most common first - Put frequent operations at top
- Group related items - Keep similar content together
- Use clear headings - Make sections easy to scan
- Include examples - Show, don't just tell
- Link related context - Help Claude navigate
Maintenance¶
- Update with changes - Don't let context drift
- Review quarterly - Catch stale information
- Remove duplication - Maintain single source of truth
- Test context - Verify Claude loads correctly
- Document decisions - Why this goes here, not there
Related Documentation¶
- Documentation Guide - Overall documentation standards
- Context Separation Guide - Internal vs customer context
- Scripts CLAUDE.md - Validation rules and scripts
Backup & Recovery¶
Backup Location¶
Original monolithic CLAUDE.md backed up at: CLAUDE.md.backup (186 lines)
Rollback Process¶
If restructure causes issues:
# Restore original
cp CLAUDE.md.backup CLAUDE.md
# Remove domain files
rm docs-internal/CLAUDE.md docs-customer/CLAUDE.md scripts/CLAUDE.md
# Restore backlinks in existing files
# (manual edit of ai-docs/CLAUDE-ai.md and specs/CLAUDE-specs.md)
Note: Only rollback if critical issue. Distributed model is best practice.
Change Log¶
2025-01-13: Initial Restructure¶
- Slimmed root CLAUDE.md from 186 β 111 lines
- Created docs-internal/CLAUDE.md (272 lines)
- Created docs-customer/CLAUDE.md (258 lines)
- Created scripts/CLAUDE.md (429 lines)
- Added backlinks to ai-docs/CLAUDE-ai.md and specs/CLAUDE-specs.md
- Created this maintenance guide
Remember: The goal is context efficiency. Each CLAUDE.md file should give Claude exactly what it needs for that domain, nothing more, nothing less.