github.com/daymade/claude-code-skills
Optimize user CLAUDE.md files by applying progressive disclosure principles. This skill should be used when users want to reduce CLAUDE.md bloat, move detailed content to references, extract reusable patterns into skills, or improve context efficiency. Triggers include "optimize CLAUDE.md", "reduce CLAUDE.md size", "apply progressive disclosure", or complaints about CLAUDE.md being too long.
Review Score
17%
Validation Score
12/16
Implementation Score
0%
Activation Score
0%
Analyze and optimize user CLAUDE.md files to reduce context overhead while preserving functionality.
Analyze each section and classify:
| Category | Criteria | Action |
|---|---|---|
| Keep in CLAUDE.md | Core principles, short rules (<10 lines), frequently needed | Keep as-is |
| Move to references/ | Detailed procedures, code examples, troubleshooting guides | Create ~/.claude/references/<name>.md |
| Extract to skill | Reusable workflows, scripts, domain-specific knowledge | Create skill in skills repository |
| Remove | Duplicates existing skills, outdated, or unnecessary | Delete after confirmation |
Even if a section is >50 lines, KEEP in CLAUDE.md if any of these apply:
| Exception | Reason | Example |
|---|---|---|
| Safety-critical | Consequences of forgetting are severe | Deployment protocols, "never force push to main" |
| High-frequency | Referenced in most conversations | Core development patterns, common commands |
| Easy to violate | Claude tends to ignore when not visible | Code style rules, permission requirements |
| Security-sensitive | Must be always enforced | Production access restrictions, data handling rules |
Rule of thumb: If forgetting the rule could cause production incidents, data loss, or security breaches, keep it visible regardless of length.
CRITICAL: Always create a backup before any changes.
# Create timestamped backup
cp ~/.claude/CLAUDE.md ~/.claude/CLAUDE.md.bak.$(date +%Y%m%d_%H%M%S)
# For project-level CLAUDE.md
cp CLAUDE.md CLAUDE.md.bak.$(date +%Y%m%d_%H%M%S)If issues found after optimization:
# Restore from backup
cp ~/.claude/CLAUDE.md.bak.YYYYMMDD_HHMMSS ~/.claude/CLAUDE.mdTask Progress:
- [ ] Create backup (Step 0)
- [ ] Read ~/.claude/CLAUDE.md
- [ ] Count total lines
- [ ] List all ## sections with line counts
- [ ] Identify sections >20 linesFor each section >20 lines, determine:
Present optimization plan in this format:
## Optimization Proposal
**Current**: X lines
**After**: Y lines (Z% reduction)
| Section | Lines | Action | Destination |
|---------|-------|--------|-------------|
| Section A | 50 | Move to references | ~/.claude/references/section_a.md |
| Section B | 80 | Extract to skill | skill-name/ |
| Section C | 5 | Keep | - |CRITICAL: Before executing any changes, verify information completeness.
For each section being moved or modified:
Extract key items to verify:
Create verification checklist:
## Verification Checklist for [Section Name]
| Key Item | Original Location | New Location | Verified |
|----------|-------------------|--------------|----------|
| Server IP 47.96.x.x | Line 123 | infrastructure.md:15 | [ ] |
| "Never push to main" rule | Line 45 | Kept in CLAUDE.md | [ ] |
| Login credentials | Line 200 | api-login.md:30 | [ ] |Check cross-references:
After user approval AND verification checklist complete:
~/.claude/references/Verify that Claude can still discover moved content:
Test discoverability - Ask questions that require moved content:
Test queries to run:
- "How do I connect to the production database?"
- "What are the deployment steps for [service]?"
- "Show me the credentials for [system]"Verify pointer functionality - Each "See reference.md" link should work:
# Check all referenced files exist
grep -oh '`~/.claude/references/[^`]*`' ~/.claude/CLAUDE.md | \
sed 's/`//g' | while read f; do
eval test -f "$f" && echo "✓ $f" || echo "✗ MISSING: $f"
doneCompare with backup - Ensure no unintended deletions:
diff ~/.claude/CLAUDE.md.bak.* ~/.claude/CLAUDE.md | grep "^<" | head -20Document results:
## Optimization Results
| Metric | Before | After |
|--------|--------|-------|
| Total lines | X | Y |
| Reduction | - | Z% |
| References created | - | N files |
| Skills extracted | - | M skills |
**Verification**: All N checklist items verified ✓
**Testing**: All K test queries returned correct information ✓When moving content to ~/.claude/references/:
# [Section Title]
[Full original content, possibly enhanced with additional examples]Replace moved sections with:
## [Section Title]
[One-line summary]. See `~/.claude/references/[filename].md`Before: Full API examples, deployment scripts, server lists
After: One-line pointer to ~/.claude/references/infrastructure.md
Before: 50+ lines of coding standards with examples After: Keep bullet-point rules, move examples to references
Before: Complete scripts embedded in CLAUDE.md After: Extract to skill with scripts/ directory
This skill handles both types, but strategies differ:
~/.claude/CLAUDE.md)| Aspect | Approach |
|---|---|
| Reference location | ~/.claude/references/ |
| Scope | Personal preferences, global rules |
| Sharing | Not shared, personal only |
| Size target | 100-200 lines ideal |
/path/to/project/CLAUDE.md)| Aspect | Approach |
|---|---|
| Reference location | docs/ or .claude/ in project root |
| Scope | Project-specific patterns, architecture |
| Sharing | Committed to git, shared with team |
| Size target | 300-600 lines acceptable (more project context needed) |
docs/best-practices/)## [Section Title]
[Summary]. See `docs/06-best-practices/[topic].md`Note: For project CLAUDE.md, prefer docs/ over hidden directories for discoverability by human team members.