Create and maintain CLAUDE.md files for Claude Code projects. Use when users want to create a new CLAUDE.md, improve an existing one, audit CLAUDE.md quality, set up Claude Code configuration for a repository, or optimize agent context for monorepos. Triggers on requests like "create CLAUDE.md", "improve my CLAUDE.md", "set up Claude Code", "optimize agent context", or "audit my project documentation for Claude".
Creates and maintains CLAUDE.md files that optimize Claude Code for specific codebases. Triggers on requests like "create CLAUDE.md", "improve my CLAUDE.md", "set up Claude Code", or "audit my project documentation".
/plugin marketplace add bandofai/puerto/plugin install claude-md@puertoThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Create effective CLAUDE.md files that transform Claude Code from a general-purpose assistant into a specialized tool for specific codebases.
CLAUDE.md is Claude Code's "constitution" - it provides persistent context automatically loaded at conversation start. Every token counts because CLAUDE.md competes for context window space with conversation history, file contents, and tool results.
Golden Rule: Document what Claude gets wrong, not everything Claude might need. Start small, expand based on friction.
Claude Code loads CLAUDE.md files from multiple locations (all are merged):
| Location | Purpose | Git Status |
|---|---|---|
~/.claude/CLAUDE.md | Personal preferences across all projects | N/A |
repo/CLAUDE.md | Team-shared project context | Commit |
repo/CLAUDE.local.md | Personal project overrides | .gitignore |
repo/subdir/CLAUDE.md | Subdirectory-specific context (monorepos) | Commit |
Before writing, understand what Claude will struggle with:
# Identify key files and structure
find . -maxdepth 3 -type f -name "*.md" | head -20
ls -la package.json pyproject.toml Makefile 2>/dev/null
# Check for existing documentation
cat README.md 2>/dev/null | head -50
# Identify build/test commands
grep -E "scripts|test|build|dev" package.json 2>/dev/null
Use this proven structure (adapt sections as needed):
# CLAUDE.md
[One-line project description]
## Quick Start
```bash
[Package manager] install
[Dev command]
[Test command]
[2-3 sentences on structure, key patterns, main technologies]
src/ - [purpose]tests/ - [purpose]MUST:
MUST NOT:
| Command | Purpose |
|---|---|
cmd | Description |
### 3. Content Priorities
Include (in order of importance):
1. **Build/test/lint commands** - What Claude types most often
2. **Critical gotchas** - Things that break silently or waste time
3. **Architecture overview** - How components connect
4. **Code patterns** - Non-obvious conventions
5. **Workflow rules** - Branch naming, commit format, PR process
Exclude:
- Information Claude already knows (language syntax, common libraries)
- Verbose explanations (prefer examples)
- Comprehensive API docs (link to them instead)
- Anything unchanged from project defaults
## Writing Guidelines
### Conciseness Patterns
**Bad (verbose):**
```markdown
When you are writing TypeScript code in this project, you should always
make sure to use strict mode and avoid using the 'any' type because it
defeats the purpose of TypeScript's type system.
Good (concise):
- TypeScript strict mode - no `any` types
Bad:
- Never use npm
Good:
- Use pnpm (not npm) - monorepo requires pnpm workspaces
Bad:
[500 lines of API documentation]
Good:
For complex widget usage or FooBarError, see docs/widgets.md
**IMPORTANT:** RLS policies auto-filter by user_id - don't add redundant .eq('user_id', userId)
For large codebases, use hierarchical CLAUDE.md files:
monorepo/
├── CLAUDE.md # Shared: package manager, CI, overall arch
├── apps/
│ ├── web/CLAUDE.md # Frontend-specific context
│ └── api/CLAUDE.md # Backend-specific context
├── packages/
│ └── shared/CLAUDE.md # Shared library context
Root CLAUDE.md should contain:
Subdirectory CLAUDE.md should contain:
Size targets:
Run this audit on existing CLAUDE.md files:
| Anti-Pattern | Problem | Fix |
|---|---|---|
| Comprehensive manual | Context bloat | Keep <500 lines, link to docs |
@-file references | Loads entire file at startup | Use path + "see X for Y" |
| Only negatives | Claude gets stuck | Add alternatives |
| Stale commands | Broken workflows | Test all commands |
| Obvious info | Wastes tokens | Remove if Claude knows it |
| No structure | Hard to scan | Use headers, tables, bullets |
CLAUDE.md improves through use:
# in Claude Code to add memoriesAfter completing significant tasks, update CLAUDE.md:
| Trigger | Add to CLAUDE.md |
|---|---|
| Claude used wrong command | Correct command in Quick Start |
| Claude broke a pattern | Pattern in Code Standards |
| Claude missed a gotcha | Gotcha in Critical Rules |
| New workflow established | Steps in Common Commands |
| Documentation outdated | Updated paths/commands |
After each significant task:
When Claude makes errors:
## Critical Rules
**MUST NOT:**
- Use `npm install` (breaks pnpm lockfile) ← Added after Claude broke deps
- Import from `@/old-path` (migrated to `@/new-path`) ← Added after refactor
Golden Rule: If you corrected Claude, future Claude should know too.
For complex projects, add parseable metadata:
## Project State
<!-- machine-readable -->
Version: 1.2.0
Status: development
Last migration: 0016_search_analytics
## Workflow
**Creating new feature?**
1. Create branch from main
2. Implement with tests
3. Run full suite before PR
**Fixing bug?**
1. Write failing test first
2. Implement fix
3. Verify only that test changes
## Metrics
| Metric | Target | Notes |
|--------|--------|-------|
| Cold start | <200ms | Measure with `time cmd` |
| API p95 | <500ms | Check after changes |
When creating CLAUDE.md:
/mnt/user-data/outputs/CLAUDE.mdWhen auditing CLAUDE.md: