Analyze health of all CLAUDE.md files - root, module-level, and rules - detecting anti-patterns, staleness, and size issues
Analyzes CLAUDE.md file hierarchy for health issues including anti-patterns, staleness, duplication, and size budget violations.
npx claudepluginhub jugrajsingh/skillgardenThis skill is limited to using the following tools:
Analyze ALL context files in the project: root, module-level, and .claude/rules/. Report health issues with severity and actionable fixes.
Scan the full hierarchy Claude Code autoloads:
# All CLAUDE.md files (root + module-level)
find . -name 'CLAUDE.md' -not -path '*/node_modules/*' -not -path '*/venv/*' -not -path '*/target/*' -not -path '*/dist/*' 2>/dev/null
# Rules directory
find .claude/rules -name '*.md' -type f 2>/dev/null
# Local file
ls CLAUDE.local.md 2>/dev/null
# Parent directories (monorepo support)
CURRENT="$(pwd)"
while [ "$CURRENT" != "/" ] && [ "$CURRENT" != "$HOME" ]; do
CURRENT="$(dirname "$CURRENT")"
ls "$CURRENT/CLAUDE.md" 2>/dev/null
done
Classify each file:
| Level | Pattern |
|---|---|
| Root | ./CLAUDE.md or ./.claude/CLAUDE.md |
| Module | ./src/billing/CLAUDE.md (subdirectory) |
| Rule | ./.claude/rules/*.md |
| Local | ./CLAUDE.local.md |
## Files Discovered
Level Path Lines Modified
Root ./CLAUDE.md {N} {DATE}
Module src/billing/CLAUDE.md {N} {DATE}
Module src/auth/CLAUDE.md {N} {DATE}
Rule .claude/rules/testing.md {N} {DATE}
Local CLAUDE.local.md {N} {DATE}
If no files found, suggest running /claudemd:init.
Severity indicators:
| Severity | Symbol | Meaning |
|---|---|---|
| Error | ◆◆ | Must fix - actively hurts performance |
| Warning | ◆ | Should fix - wastes context or misleads |
| Info | ◇ | Consider fixing - minor improvement |
Budget = max loaded at once, not total across all files.
For each module CLAUDE.md, compute what loads when working there:
Working in src/billing/:
./CLAUDE.md 80 lines (always)
src/billing/CLAUDE.md 55 lines (module)
.claude/rules/testing.md 20 lines (if path matches)
= 155 lines loaded
| Metric | Target | Warning | Error |
|---|---|---|---|
| Root CLAUDE.md | 50-80 | >150 | >200 |
| Module CLAUDE.md | 30-50 | >80 | >120 |
| .claude/rules/ file | 15-30 | >50 | >80 |
| Max loaded at once | <150 | >200 | >250 |
Search ALL files (root + module + rules) for:
Code style rules (should use linters):
Vague instructions (not actionable):
Framework basics (Claude already knows):
Duplicated linter config:
Scan ALL files for:
sk-, pk_, AKIA, ghp_, xoxb-postgres://, mongodb://, redis://Bearer, token=For every @path/to/file reference in any context file:
Duplication between root and modules:
Orphaned module files:
Missing module files:
/claudemd:init Phase 2Complementarity violations:
Compare documented state against actual codebase for ALL files:
Root staleness:
Module staleness:
# Staleness signal: dependencies changed more recently than context files
git log --format=%ci -1 -- CLAUDE.md 2>/dev/null
find . -name 'CLAUDE.md' -not -path '*/node_modules/*' -exec sh -c 'echo "$(git log --format=%ci -1 -- "$1" 2>/dev/null) $1"' _ {} \;
git log --format=%ci -1 -- package.json pyproject.toml 2>/dev/null
For each .claude/rules/*.md:
paths: if path-specific## CLAUDE.md Audit Report
### Summary
Files scanned: {COUNT} ({ROOT} root, {MODULE} module, {RULE} rules)
Max loaded at once: {MAX}/250 (working in {WORST_PATH})
Health: {HEALTHY | NEEDS_ATTENTION | CRITICAL}
### Findings
◆◆ ERROR: src/billing/CLAUDE.md duplicates root Commands section
→ Remove lines 12-18, root commands already loaded
◆◆ ERROR: Max context load is {N} lines when working in src/billing/stripe/
→ Condense billing module or move content to stripe sub-module
◆ WARNING: Stale root - package.json has react 19, CLAUDE.md says 18
→ Run /claudemd:sync
◆ WARNING: src/legacy/CLAUDE.md - directory has 1 file remaining
→ Remove orphaned module file
◇ INFO: src/middleware/ qualifies as Technical Complexity, no CLAUDE.md
→ Run /claudemd:init src/middleware
### Per-File Metrics
Path Lines Issues Status
./CLAUDE.md {N} {N} ✓
src/billing/CLAUDE.md {N} {N} ◆
src/auth/CLAUDE.md {N} {N} ✓
.claude/rules/testing.md {N} {N} ✓
### Context Load Map
Working in... Files loaded Total
src/billing/ root + billing {N}/250
src/billing/stripe/ root + billing + stripe {N}/250
src/auth/ root + auth {N}/250
(anywhere else) root only {N}/250
### Recommended Actions
1. /claudemd:sync → Fix {N} stale references
2. /claudemd:optimize → Reduce src/billing/CLAUDE.md from {N} to ~50 lines
3. /claudemd:init src/middleware → Generate missing module file
Score = 100
- (errors * 15)
- (warnings * 5)
- (info * 1)
- max(0, (max_loaded - 250) / 5)
| Score | Health | Label |
|---|---|---|
| 80-100 | ▓▓▓▓▓ | HEALTHY |
| 50-79 | ▓▓▓░░ | NEEDS_ATTENTION |
| 0-49 | ▓░░░░ | CRITICAL |
This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.