From kaizen
Maintenance skill for the Claude Code environment. Audits the full setup — skills, hooks, rules, memory, permissions, plugins, CLAUDE.md — scores it, and produces a prioritized list of concrete, ready-to-apply improvements.
How this skill is triggered — by the user, by Claude, or both
Slash command
/kaizen:coach [skills|hooks|rules|rules-audit|memory|permissions|plugins|health|init|optimize|discover|all]When to use
Use when the user asks to improve, audit, or maintain their Claude Code environment. English triggers: 'coach me', 'what am I missing', 'check my setup', 'optimize my CLAUDE.md', 'discover conventions', 'is my config good', 'health check', 'what could be better'. French triggers: 'audite mon setup', 'améliore ma config', 'que puis-je améliorer', 'check ma config', 'fais un check', 'optimise mon CLAUDE.md', 'c'est le bordel', 'ma config est-elle bonne'. Also use proactively when the user is struggling with repetitive instructions, missing automations, or an outdated config — even if they don't explicitly ask for a coach run.
[skills|hooks|rules|rules-audit|memory|permissions|plugins|health|init|optimize|discover|all]The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Be a transparent coach — explain *why* each suggestion helps and let the user decide.
references/checklists/claude-md.mdreferences/checklists/hooks.mdreferences/checklists/memory.mdreferences/checklists/permissions.mdreferences/checklists/plugins.mdreferences/checklists/rules.mdreferences/checklists/skills.mdreferences/checklists/usage-stale-friction.mdreferences/claude-md-optimize.mdreferences/discover.mdreferences/history-archive.mdreferences/history.mdreferences/rules-audit.mdscripts/track-usage.shBe a transparent coach — explain why each suggestion helps and let the user decide.
The routing rules below check $ARGUMENTS (set when the skill is called as /coach <mode>). When $ARGUMENTS is empty or doesn't match a pattern (e.g., user sends a free-form message like "mon CLAUDE.md est le bordel"), infer the intended mode from the user's actual message before falling back to Default.
Priority: check more specific patterns BEFORE shorter ones. For example, rules-audit must be checked before rules (otherwise /coach rules-audit wrongly matches the basic rules rule). The list below is already ordered correctly — respect the order.
$ARGUMENTS contains "rules-audit" → Deep audit of .claude/rules/ only: frontmatter coverage, cross-layer redundancy, pertinence scoring, ROI trimming. Read references/rules-audit.md. Does not touch CLAUDE.md.$ARGUMENTS contains "optimize" or "claude-md" → Deep CLAUDE.md + rules cleanup (self-update, bloat detection, rules audit, rewrite). Read references/claude-md-optimize.md section "Optimize Mode".$ARGUMENTS contains "discover" → Mine codebase + code reviews for conventions → generate .claude/rules/. Read references/discover.md.$ARGUMENTS contains "init" → Scaffold a minimal CLAUDE.md (fast, no deep analysis). Read references/claude-md-optimize.md section "Init Mode".$ARGUMENTS contains "health" → Read references/checklists/usage-stale-friction.md. Run stale config detection, cross-reference analysis, friction detection, and trend analysis.$ARGUMENTS contains "skills" → Read references/checklists/skills.md, audit skills only$ARGUMENTS contains "hooks" → Read references/checklists/hooks.md, audit hooks only$ARGUMENTS contains "rules" → Read references/checklists/rules.md, audit rules only$ARGUMENTS contains "memory" → Read references/checklists/memory.md, audit memory only$ARGUMENTS contains "permissions" → Read references/checklists/permissions.md, audit permissions only$ARGUMENTS contains "plugins" → Read references/checklists/plugins.md, audit plugins onlyreferences/checklists/. If deep CLAUDE.md optimization is overdue (see Phase 0), suggest running it.Check what changed since last coach run — this avoids re-suggesting things the user already addressed or declined.
Read .claude/coach-history.md in the project directory — extract:
.claude/coach-history.md doesn't exist, also check ${CLAUDE_SKILL_DIR}/references/history.md as legacy fallback — if found there, migrate it to .claude/coach-history.md and overwrite the old file with a stub: a single line Moved to .claude/coach-history.md so subsequent runs don't re-migrateIf a previous run exists, note days since last run
Check optimization staleness: if last deep CLAUDE.md optimization was >3 weeks ago (or never), flag it as a priority suggestion: "Your CLAUDE.md and rules haven't been deeply optimized in X days — want me to run an optimization now?"
Compare current state against last run's changes — focus on NEW gaps, not already-addressed items
If no history exists anywhere, treat as first run
Auto-detect the project type to adapt suggestions:
Check for:
├── VCS type → Detect .git/, .svn/, CVS/, .hg/ — adapt VCS-related suggestions to detected type
├── .claude/agents/ → Multi-agent project
├── .claude/rules/ → Rules-aware project (check scoping, duplication)
├── .claude/skills/ → Has project skills (check for user/project duplicates)
├── Build system → pom.xml, package.json, Cargo.toml, pyproject.toml, Makefile, etc.
└── CLAUDE.md → Has instructions (check conciseness, progressive disclosure)
Announce detected context briefly (the new score is computed later in Phase 4 — only show the previous score here):
Project: [type] | Last coach: [date, X days ago] | Last optimize: [date, X days ago] | Last score: [X/10]
Collect current state silently (no output yet):
~/.claude/settings.json and .claude/settings.json and .claude/settings.local.json~/.claude/settings.json.bak or .claude/settings.local.json.bak exists, compare with the corresponding current settings file to detect recent regressions (hooks removed, plugins disabled, permissions changed). This catches unintentional removals. (settings.json.bak is created automatically by Claude Code before writing to settings — it's a one-step rollback file.)~/.claude/skills/ (user) and .claude/skills/ (project)~/.claude/hooks/ and hook configs in all settings files. Cross-check: are there hook scripts on disk not wired in settings? Are there settings entries pointing to missing scripts?.claude/rules/ — check for paths: frontmatter~/.claude/CLAUDE.md (user global), root CLAUDE.md, CLAUDE.local.md, and .claude/CLAUDE.md — count lines for eachpermissions.allow in all settings filesenabledPlugins in settings. Note specifically whether any skill-creator plugin is enabled (regardless of marketplace) — this affects skill creation delegation in Phase 5.~/.claude/coach-usage-log.jsonl if it exists. Prefer Read tool over Bash for reading files — shell commands like tail/head/cat may be intercepted or filtered by hooks (e.g. token optimization hooks) and can silently truncate or fail. If the file is absent or empty, note it in the report and suggest wiring the PostToolUse tracking hook (see hooks checklist) — without it, usage-based suggestions are unavailable.~/.claude/ and flag large consumers (debug/, todos/, paste-cache/, session-env/) that can be cleaned upFor each area in scope, read the relevant checklist(s) from references/checklists/ and compare against current state. Identify:
For targeted modes (single area), read ONLY that area's checklist plus usage-stale-friction.md for cross-reference checks related to that area.
Compute the setup score deterministically from 10 binary criteria (each 0 or 1, sum = score out of 10). Determinism is the point — same state always yields the same score — so trends between runs are meaningful. If a criterion genuinely doesn't apply to this project (e.g., solo repo with no permissions needed), treat it as satisfied.
Stop event is wired in settingsPostToolUse hook writes to ~/.claude/coach-usage-log.jsonl (without it, usage-based suggestions are unavailable).claude/rules/ exists and contains ≥ 1 rule fileCLAUDE.md exists and is ≤ 150 lines (bloat threshold)MEMORY.md exists and has ≥ 3 indexed entriespermissions.allow is non-empty in at least one settings filesettings.json.bak (or no bak file = first run, pass)PreToolUse hook, OR user explicitly declined in coach-history.md/coach init or /coach optimize firstLog the current score in .claude/coach-history.md at each run. The ↑/↓/= arrow in Phase 4 compares current score to the last logged score.
Output format — group by priority:
## Coach Report
### Context
- **Project**: [detected type] | **Last coach**: [date] | **Last optimize**: [date] | **Delta**: [X days]
- **Skills**: X user + Y project | **Rules**: Z (W scoped) | **Hooks**: N
### Setup Score: X/10
Brief assessment + trend vs last run (↑/↓/=).
### Quick Wins (< 2 min each)
| # | Area | Suggestion | Why |
|---|------|-----------|-----|
| 1 | ... | ... | ... |
### Recommended Improvements
| # | Area | Suggestion | Why | Effort |
|---|------|-----------|-----|--------|
| 1 | ... | ... | ... | ~Xmin |
### Advanced (power user)
| # | Area | Suggestion | Why | Effort |
|---|------|-----------|-----|--------|
| 1 | ... | ... | ... | ~Xmin |
### Already Great
- [list what's well configured — positive reinforcement]
### Usage Insights
- Skill adoption: X% (Y/Z tool calls) [trend: ↑/↓/=]
- Top skills: [list from actual usage log]
- Friction detected: [patterns if any]
- Unused skills: [list] — consider archiving
### Config Health
- Stale items: [rules/memory/agents referencing things that no longer exist]
- Cross-reference issues: [inconsistencies between config areas]
- Config growth: [X rules, Y skills — trend vs last run]
- Regressions: [things removed since last settings backup]
Score >= 8/10 with few gaps: Keep the report short. Say something like "Your setup is solid" and only list the 2-3 minor points. Don't force Advanced suggestions just to fill the template.
Delta = 0 since last run: If nothing meaningful changed since last coach run, say "Nothing new since last check" with the date, and only flag new stale items or regressions.
After presenting the report:
references/checklists/hooks.md (section "Settings file hierarchy") — hooks coach creates on its own initiative go in .claude/settings.local.json; explicit user requests override and go wherever the user intends.skill-creator plugin is enabled (detected in Phase 2, any marketplace): hand off to /skill-creator with full context — skill name, objective, and the gap the coach identified. Say: "I'll delegate this to /skill-creator so it follows Anthropic's standards (evals, description optimization, iteration loop)."~/.claude/plugins/cache/*/skill-creator/): offer to install it first — "skill-creator is available but not installed. Want me to install it so this skill gets proper evals and description optimization?" If the user accepts, install it then hand off. If they decline, fall back to writing the skill directly..claude/coach-history.md in the project directory:
.claude/coach-history-archive.md/coach twice should not duplicate suggestions — always check .claude/coach-history.md first.claude/coach-history.md in the project directory. When it exceeds 40 entries, archive entries older than 30 days to .claude/coach-history-archive.mdChecklists are split by domain — read only what's needed for the current mode:
references/checklists/skills.md — Skills gap detectionreferences/checklists/hooks.md — Hook purpose coveragereferences/checklists/rules.md — Rule quality checksreferences/checklists/memory.md — Memory completeness + broken reference detectionreferences/checklists/permissions.md — Permission discovery from usagereferences/checklists/plugins.md — Plugin coveragereferences/checklists/claude-md.md — CLAUDE.md quality checksreferences/checklists/usage-stale-friction.md — Usage patterns, stale config, cross-reference, friction (always read for full audit and health mode)Deep-dive references (read only when the matching mode is triggered):
references/claude-md-optimize.md — Full CLAUDE.md optimization pipeline (self-update, bloat, scan, generate, report, guardrails)references/rules-audit.md — Rules audit process (frontmatter, redundancy, pertinence scoring, ROI trimming)references/discover.md — Convention discovery from codebase + code reviewsCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub imadattar/kaizen --plugin kaizen