- Add new 00-claude-code-setting skill for token usage optimization - Includes audit scripts for MCP servers, CLAUDE.md, and extensions - Auto-fix capability with backup for serverInstructions and frontmatter - Add YAML frontmatter to 17 command files - Target: keep baseline under 30% of 200K context limit Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2.0 KiB
2.0 KiB
Claude Code Settings Optimizer
Self-audit and optimize Claude Code configuration for maximum token efficiency.
Purpose
- Analyze token usage across MCP servers, CLAUDE.md, and extensions
- Identify optimization opportunities
- Auto-fix common issues with backup safety
- Keep working context at 70%+ of 200K limit
Quick Start
# Install
cd custom-skills/00-claude-code-setting/code
chmod +x install.sh
./install.sh
# Run audit
python3 scripts/run_audit.py
# Apply fixes
python3 scripts/auto_fix.py --apply
What Gets Analyzed
| Component | Checks |
|---|---|
| MCP Servers | serverInstructions presence, token estimates, load strategy |
| CLAUDE.md | Line count, token estimate, structure quality |
| Commands | Frontmatter, description, size limits |
| Skills | SKILL.md presence, size limits |
| Agents | Tool restrictions |
Target Metrics
| Metric | Target | Max |
|---|---|---|
| CLAUDE.md tokens | 2,000 | 3,000 |
| MCP tokens (with Tool Search) | 5,000 | 10,000 |
| Baseline total | <30% | <40% |
| Available for work | >70% | — |
Files
00-claude-code-setting/
├── README.md
└── code/
├── CLAUDE.md # Skill directive
├── install.sh # Installation script
├── commands/
│ └── settings-audit.md # /settings-audit command
├── scripts/
│ ├── run_audit.py # Main orchestrator
│ ├── analyze_tokens.py # Token analysis
│ ├── analyze_extensions.py
│ └── auto_fix.py # Auto-fix with backup
└── references/
└── token-optimization.md
Auto-Fix Capabilities
Safe (automatic with backup):
- Add serverInstructions to MCP servers
- Add frontmatter to commands
Manual review required:
- Disabling MCP servers
- Restructuring CLAUDE.md
- Removing extensions
Requirements
- Python 3.8+
- PyYAML (optional, for better frontmatter parsing)