Scan the Claude Code configuration ecosystem to find items that can be cleaned up or optimized. Cover CLAUDE.md, MEMORY.md, and all skills in one pass.
Step 0: Scan all sources
Read CLAUDE.md
Read in order (each counts toward tokens):
- Global
~/.claude/CLAUDE.md - Project
CLAUDE.md(current directory) - Project private
.claude/CLAUDE.md(if it exists)
Read MEMORY.md
- Auto Memory — project-level
.claude/projects/*/memory/MEMORY.md - All
.mdattachments under that directory
Scan Skills
- Global skills —
~/.claude/skills/*/SKILL.md(including references/ subdirectories) - Project skills — any subdirectory under the current directory that contains
SKILL.mdsubdirectories
For each skill, record:
- Number of lines in SKILL.md
- Number of files and total lines in references/
- Estimated token count (rough estimate: lines × 4)
ARGUMENTS filtering
If ARGUMENTS specifies a focus (claude / memory / skills), execute only the corresponding section. Default all。
Step 1: CLAUDE.md review
Analyze file by file, identifying the following issues:
1A. Redundant instructions
- Instructions duplicated across files (global vs project-level saying the same thing)
- The same rule expressed repeatedly within the same file
1B. Bloated content
- Examples or explanations longer than 3 lines → can they be compressed?
- Historical context descriptions ("we tried X before but it failed") → move to memory
- Low-frequency instructions → convert into a skill or slash command
1C. Outdated content
- Mentions files, features, or tools that no longer exist
- Version numbers/dates that look outdated
- Descriptions that contradict the existing codebase
1D. Token estimation
| 檔案 | 行數 | 預估 tokens | 問題數 |
|------|------|------------|--------|
| ~/.claude/CLAUDE.md | 200 | ~3,200 | 3 |
| CLAUDE.md | 50 | ~800 | 1 |
Step 2: MEMORY.md review
2A. Outdated entries
- Describe features that are completed/no longer exist
- Technical findings that contradict the existing code
- Old records superseded by later entries
2B. Duplication with CLAUDE.md
- memory and CLAUDE.md say the same thing → keep one place, delete the other
- Criterion: keep high-frequency lookups in CLAUDE.md, keep low-frequency ones in memory
2C. Organization issues
- Entries that are too long → split into a separate
.mdfile - Entries with unclear categorization → suggest a category
- Approaching the 200-line limit → mark as needing slimming down
Step 3: Skills review
3A. Overview table
| Skill | SKILL.md 行 | Refs 行 | 預估 tokens | 觸發詞 |
|-------|-------------|---------|------------|--------|
| good-writing-zh | 165 | 158 | ~1,300 | /good-writing |
| humanizer-tw | 122 | 450 | ~2,300 | humanize |
| ... | | | | |
3B. Scope overlap
Scan all skills' description + trigger words, identifying:
- Pairs of skills with overlapping functionality (e.g., is the boundary between good-writing-zh ↔ humanizer-tw clear?)
- Trigger word conflicts (different skills responding to the same keyword)
3C. Token efficiency
- SKILL.md over 200 lines → suggest slimming down (extract to references/)
- references/ over 500 lines → is there low-frequency content that can be deleted?
- Are there skills that are actually rarely used, but expensive to load every time?
3D. Structural issues
- Missing frontmatter (name / description / user_invocable)
- Missing argument_hint
- Orphan files in references/ that are not referenced by SKILL.md
Step 4: Present results + interactive execution
Produce a review report
## System Audit 報告
### Token 預算概覽
| 類別 | 每次對話載入 | 按需載入 |
|------|------------|---------|
| CLAUDE.md(全域+專案) | ~4,000 | — |
| MEMORY.md | ~3,200 | — |
| Skills(平均每次觸發) | — | ~2,000 |
### 發現問題
| # | 類別 | 嚴重度 | 描述 | 建議動作 |
|---|------|--------|------|---------|
| 1 | CLAUDE.md | 高 | 重複指令 X 出現在全域和專案級 | 刪除專案級 |
| 2 | MEMORY.md | 中 | 條目 Y 已過時 | 刪除 |
| 3 | Skills | 低 | skill Z 的 refs 有孤立檔案 | 清理 |
AskUserQuestion interaction
Use multiSelect to let the user choose which cleanup actions to execute:
- List each finding as an option
- Annotate severity and estimated impact (how many tokens / lines saved)
- Only act after the user confirms
Execute cleanup
Execute the items the user selected one by one (Edit / Write). Briefly report after each action is completed.
Review principles
- The less content loaded in each conversation, the better — CLAUDE.md and MEMORY.md are the most expensive because they are loaded every time
- Move low-frequency content to skills or memory — instructions that are not used every time should not occupy CLAUDE.md
- Boundaries between skills should be clear — overlapping skills waste tokens and also confuse Claude
- Delete outdated information — incorrect memory is more dangerous than no memory
Now Execute
The user's review request is shown below ARGUMENTS:. Start from Step 0.