Claude Code Optimizer
Audit and optimize Claude Code installations. Requires Claude Code 2.1.3 or later.
Quick Start
Run the appropriate audit based on user request:
- Full audit: Invoke
audit-orchestrator agent for comprehensive review
- Specific audit: Invoke specialized agent directly (see Agents below)
- Quick check: Run inline checks from Audit Checklist
Agents
Invoke via Task tool with appropriate subagent_type:
| Agent |
Purpose |
audit-orchestrator |
Coordinates full audit across all areas |
config-auditor |
Audits settings.json and CLAUDE.md files |
hooks-auditor |
Audits hook configurations |
permissions-auditor |
Audits permission patterns |
workflow-auditor |
Audits commands, agents, and skills |
mcp-auditor |
Audits MCP server configurations |
Agent definitions are in agents/ directory. Install to ~/.claude/agents/ or .claude/agents/.
Audit Checklist
Configuration Files
Check these locations exist and are properly configured:
~/.claude/settings.json # User settings
.claude/settings.json # Project settings
CLAUDE.md # Project memory (root)
.claude/CLAUDE.md # Alternative location
CLAUDE.local.md # Local overrides (gitignored)
~/.claude/CLAUDE.md # User-level memory
Settings.json Structure
Valid top-level keys (2.1.3+):
hooks - Event handlers
permissions - Tool permissions (allow/deny arrays)
env - Environment variables
mcpServers - MCP server configurations
model - Default model
theme - UI theme
respectGitignore - File picker behavior
language - Response language
fileSuggestion - Custom @ file search command
releaseChannel - stable or latest channel toggle
Hook Events (2.1.0+)
Valid event names:
PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest
Notification, UserPromptSubmit
SessionStart, SessionEnd
Stop, SubagentStart, SubagentStop, PreCompact
Tool Names for Matchers
Bash, Read, Write, Edit
Grep, Glob, Task, TaskOutput
WebFetch, WebSearch
NotebookEdit, TodoWrite, KillShell
LSP (Language Server Protocol, 2.0.74+)
mcp__* for MCP tools (wildcard: mcp__server__*)
Permission Patterns
{
"permissions": {
"allow": ["Read", "Grep", "Glob"],
"deny": ["Bash(rm -rf:*)"]
}
}
Wildcard syntax: Bash(git *:*) allows all git commands.
Common Issues
| Issue |
Fix |
| Hooks not firing |
Check event name spelling (case-sensitive) |
| Skills not loading |
Verify ~/.claude/skills/ or .claude/skills/ path |
| Permissions ignored |
Check allow/deny order; deny takes precedence |
| CLAUDE.md not read |
Must be in project root or .claude/ |
References
For detailed audit procedures, see:
references/config-guide.md - Configuration deep-dive
references/hooks-guide.md - Hook patterns and examples
references/permissions-guide.md - Permission strategies
references/security-guide.md - Security audit procedures
references/troubleshooting.md - Common problems and solutions
Version Compatibility
This skill targets Claude Code 2.1.3+ features:
- Skill hot-reload
- Forked sub-agent context (
context: fork)
- Hook frontmatter in skills/agents with
once: true option
- YAML-style allowed-tools
- Unreachable permission rule detection
- MCP wildcard permissions (
mcp__server__*)
- Named sessions (
/rename, /resume <name>)
- Release channel configuration
Check version: claude --version
Update: claude update
1---2name: claude-code-optimizer3description: Audit and optimize Claude Code installations to current best practices. Use when users ask to check, audit, optimize, or improve their Claude Code setup, configuration, hooks, permissions, or workflow. Triggers on requests mentioning Claude Code settings, CLAUDE.md files, hooks configuration, permissions setup, or performance optimization.4---56# Claude Code Optimizer78Audit and optimize Claude Code installations. Requires Claude Code 2.1.3 or later.910## Quick Start1112Run the appropriate audit based on user request:13141. **Full audit**: Invoke `audit-orchestrator` agent for comprehensive review152. **Specific audit**: Invoke specialized agent directly (see Agents below)163. **Quick check**: Run inline checks from Audit Checklist1718## Agents1920Invoke via Task tool with appropriate `subagent_type`:2122| Agent | Purpose |23|-------|---------|24| `audit-orchestrator` | Coordinates full audit across all areas |25| `config-auditor` | Audits settings.json and CLAUDE.md files |26| `hooks-auditor` | Audits hook configurations |27| `permissions-auditor` | Audits permission patterns |28| `workflow-auditor` | Audits commands, agents, and skills |29| `mcp-auditor` | Audits MCP server configurations |3031Agent definitions are in `agents/` directory. Install to `~/.claude/agents/` or `.claude/agents/`.3233## Audit Checklist3435### Configuration Files36Check these locations exist and are properly configured:3738```39~/.claude/settings.json # User settings40.claude/settings.json # Project settings41CLAUDE.md # Project memory (root)42.claude/CLAUDE.md # Alternative location43CLAUDE.local.md # Local overrides (gitignored)44~/.claude/CLAUDE.md # User-level memory45```4647### Settings.json Structure48Valid top-level keys (2.1.3+):49- `hooks` - Event handlers50- `permissions` - Tool permissions (allow/deny arrays)51- `env` - Environment variables52- `mcpServers` - MCP server configurations53- `model` - Default model54- `theme` - UI theme55- `respectGitignore` - File picker behavior56- `language` - Response language57- `fileSuggestion` - Custom `@` file search command58- `releaseChannel` - `stable` or `latest` channel toggle5960### Hook Events (2.1.0+)61Valid event names:62- `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `PermissionRequest`63- `Notification`, `UserPromptSubmit`64- `SessionStart`, `SessionEnd`65- `Stop`, `SubagentStart`, `SubagentStop`, `PreCompact`6667### Tool Names for Matchers68- `Bash`, `Read`, `Write`, `Edit`69- `Grep`, `Glob`, `Task`, `TaskOutput`70- `WebFetch`, `WebSearch`71- `NotebookEdit`, `TodoWrite`, `KillShell`72- `LSP` (Language Server Protocol, 2.0.74+)73- `mcp__*` for MCP tools (wildcard: `mcp__server__*`)7475### Permission Patterns76```json77{78 "permissions": {79 "allow": ["Read", "Grep", "Glob"],80 "deny": ["Bash(rm -rf:*)"]81 }82}83```8485Wildcard syntax: `Bash(git *:*)` allows all git commands.8687## Common Issues8889| Issue | Fix |90|-------|-----|91| Hooks not firing | Check event name spelling (case-sensitive) |92| Skills not loading | Verify `~/.claude/skills/` or `.claude/skills/` path |93| Permissions ignored | Check allow/deny order; deny takes precedence |94| CLAUDE.md not read | Must be in project root or `.claude/` |9596## References9798For detailed audit procedures, see:99- `references/config-guide.md` - Configuration deep-dive100- `references/hooks-guide.md` - Hook patterns and examples101- `references/permissions-guide.md` - Permission strategies102- `references/security-guide.md` - Security audit procedures103- `references/troubleshooting.md` - Common problems and solutions104105## Version Compatibility106107This skill targets Claude Code 2.1.3+ features:108- Skill hot-reload109- Forked sub-agent context (`context: fork`)110- Hook frontmatter in skills/agents with `once: true` option111- YAML-style allowed-tools112- Unreachable permission rule detection113- MCP wildcard permissions (`mcp__server__*`)114- Named sessions (`/rename`, `/resume <name>`)115- Release channel configuration116117Check version: `claude --version`118Update: `claude update`