From dev-plugin
Intelligently manages CLAUDE.md - creates if missing, validates on start, updates with learnings on stop. Context-aware and follows official Anthropic guidelines.
How this skill is triggered — by the user, by Claude, or both
Slash command
/dev-plugin:claude-md-managerThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Intelligent, context-aware CLAUDE.md management using Claude's AI.
Intelligent, context-aware CLAUDE.md management using Claude's AI.
This skill handles all CLAUDE.md operations:
Key Principle: Use Claude's intelligence, not templates.
Determine current situation and required action:
# Check if CLAUDE.md exists
if [ -f CLAUDE.md ]; then
echo "Status: CLAUDE.md exists"
else
echo "Status: CLAUDE.md missing"
fi
Decision Matrix:
| File Status | Hook Context | Action |
|---|---|---|
| Missing | SessionStart | Create from scratch |
| Missing | Stop | Create (mandatory) + Update (if learnings exist) |
| Exists | SessionStart | Validate (quick check) |
| Exists | Stop | Update (only if learnings exist) |
Important Notes:
Based on Phase 1 decision, execute appropriate workflow.
CRITICAL RULE: If CLAUDE.md is missing, you MUST create it - even if the session is empty. The CREATE action is mandatory when the file doesn't exist. Only the UPDATE portion is conditional on having learnings.
MANDATORY: This action is REQUIRED whenever CLAUDE.md does not exist, regardless of session content.
Analyze project structure to understand type:
# Find project indicators
ls -la | grep -E "(package.json|Cargo.toml|go.mod|pyproject.toml|pom.xml|Gemfile|composer.json)"
# Scan directory structure
find . -maxdepth 2 -type d | head -20
# Look for README
find . -maxdepth 2 -name "README*" | head -5
Identify:
Read key files to understand the project:
Priority files (if they exist):
README.md - High-level overviewpackage.json / Cargo.toml / pyproject.toml / go.mod - MetadataExtract:
Create CLAUDE.md using your understanding - NOT templates!
Essential sections (only if relevant):
## Commands
| Command | Description |
|---------|-------------|
| `npm run dev` | Start development server on port 3000 |
| `npm test` | Run test suite with coverage |
## Architecture
\```
my-app/
src/ # Application source code
components/ # React components
api/ # API endpoints
\```
## Key Files
- `src/index.ts` - Application entry point
- `src/config.ts` - Configuration loader
## Gotchas
- Tests require Docker to be running
- Must run `npm run codegen` before tests
Before writing, verify:
Write CLAUDE.md using Write tool.
Add footer:
---
*Last updated: [current date]*
*Managed by claude-md-manager skill. Quality target: 80+/100*
Output:
✨ Created CLAUDE.md for {project-name}
Documented:
- {n} commands
- {n} key directories
- {n} important files
Quality score: {self-assessed}/100
Quick quality check of existing CLAUDE.md.
cat CLAUDE.md
Check against quality criteria:
| Criterion | Quick Check |
|---|---|
| Commands present | Are build/test/deploy commands there? |
| Architecture | Is structure documented? |
| Actionability | Can commands be copy-pasted? |
| Currency | Do referenced files exist? |
| Size | Is it under 10KB? |
If score > 70: Skip silently (file is good)
If score < 70: Suggest improvements:
💡 CLAUDE.md quality: {score}/100
Consider adding:
- [Missing commands]
- [Architecture gaps]
Don't auto-fix during SessionStart - just report. User can manually improve or it will update during work.
CONDITIONAL: Update CLAUDE.md with session learnings ONLY if valuable learnings exist.
If the session was empty (no tool calls, no transcript), skip the update gracefully. The file should remain as-is.
Review what happened during session:
Analyze:
Read current CLAUDE.md:
cat CLAUDE.md
Extract ONLY valuable learnings - NOT everything!
1. Commands/Workflows Discovered
Example: Discovered `npm run codegen && npm test` workflow
2. Gotchas and Non-Obvious Patterns
Example: "Tests fail if database migrations aren't run first"
3. Package Relationships
Example: "auth package must be imported before database package"
4. Testing Approaches That Worked
Example: "Use `--coverage` flag to generate reports in coverage/"
5. Configuration Quirks
Example: "PORT defaults to 3000 but Docker uses 8080"
1. Obvious Code Info
❌ "The User class has a name property"
2. Generic Best Practices
❌ "Write tests for your code"
3. One-Off Fixes
❌ "Fixed typo in line 42"
4. Verbose Explanations
❌ "The application architecture follows a three-tier pattern..."
✅ "Three-tier: UI → API → Database"
Before adding:
Skip update if:
If valuable learnings exist, update using Edit tool.
Section routing:
## Commands## Gotchas## Architecture## Testing## EnvironmentUpdate timestamp:
*Last updated: [current date]*
After updating:
Output:
If updated:
📝 Updated CLAUDE.md
Added:
- [Brief description of additions]
If skipped:
✓ No significant learnings to document this session
Commands/Workflows (20 pts)
Architecture Clarity (20 pts)
Non-Obvious Patterns (15 pts)
Conciseness (15 pts)
Currency (15 pts)
Actionability (15 pts)
Target: 80+/100 (B grade or better)
Honor settings from .claude/dev-plugin.local.md:
claude_md_management:
auto_init: true # Create if missing
auto_update: true # Update with learnings
update_threshold: 3 # Min tool calls before update
max_file_size: 10240 # Size limit (bytes)
backup_before_update: true
Respect thresholds:
auto_init: false → Skip creationauto_update: false → Skip updatesAnalysis finds:
package.json with scriptstsconfig.json configurationsrc/ directory structureGenerated CLAUDE.md:
# my-typescript-app
TypeScript web application
## Commands
| Command | Description |
|---------|-------------|
| `npm run dev` | Start dev server on :3000 |
| `npm run build` | Production build |
| `npm test` | Run vitest suite |
## Architecture
\```
my-app/
src/
components/ # React components
hooks/ # Custom hooks
utils/ # Utilities
\```
## Gotchas
- Dev server requires `VITE_API_URL` environment variable
Session activity:
Update:
## Gotchas
- Tests require Docker running (`docker ps` must work)
- Run `npm run db:migrate` before first test
- Default port 3000 conflicts - set PORT=3001 if needed
Existing CLAUDE.md scores 85/100
Output:
✓ CLAUDE.md quality: 85/100 (Good)
Silent - no action needed
Existing CLAUDE.md scores 45/100
Output:
💡 CLAUDE.md quality: 45/100 (Needs improvement)
Missing:
- Build/test commands
- Architecture description
- Gotchas/patterns
Tip: Work on the project and this will auto-update at session end.
✅ CLAUDE.md exists and well-structured ✅ All commands work ✅ Architecture matches directories ✅ No template boilerplate ✅ Score: 80+/100
✅ Only valuable info added ✅ Concise and actionable ✅ No duplicates ✅ Human-readable ✅ Future sessions benefit
✅ Accurate assessment ✅ Helpful suggestions ✅ Non-intrusive
Never do:
Always do:
See references/ directory:
quality-criteria.md - Detailed scoring rubrictemplates.md - Inspiration (not copy-paste)update-guidelines.md - What to add vs skipBased on official Anthropic claude-md-management plugin.
"Use Claude's intelligence to create living project documentation that genuinely helps future sessions."
npx claudepluginhub rsolipuram/claude-code-plugins --plugin dev-pluginAudits and improves CLAUDE.md files in repositories by scanning for them, evaluating quality against criteria, generating reports, and applying targeted updates after approval.
Audits and improves CLAUDE.md files in repositories by discovering files via glob/bash, scoring quality against checklists, generating reports, and applying targeted updates after approval. Use for CLAUDE.md audits, fixes, maintenance, or project memory optimization.
Audits and improves CLAUDE.md files in a repository. Scans for all CLAUDE.md files, evaluates quality against criteria, outputs a quality report, then makes targeted updates with user approval.