claude-md
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".
What this skill does
# CLAUDE.md Skill
Create effective CLAUDE.md files that transform Claude Code from a general-purpose assistant into a specialized tool for specific codebases.
## Core Philosophy
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.md Hierarchy
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 |
## Creation Workflow
### 1. Analyze the Codebase
Before writing, understand what Claude will struggle with:
```bash
# 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
```
### 2. Structure Template
Use this proven structure (adapt sections as needed):
```markdown
# CLAUDE.md
[One-line project description]
## Quick Start
```bash
[Package manager] install
[Dev command]
[Test command]
```
## Architecture
[2-3 sentences on structure, key patterns, main technologies]
### Key Directories
- `src/` - [purpose]
- `tests/` - [purpose]
## Code Standards
- [Style rule with example if non-obvious]
- [Critical pattern to follow]
- [Common mistake to avoid → correct approach]
## Critical Rules
**MUST:**
- [Non-negotiable requirement]
**MUST NOT:**
- [Common mistake that breaks things]
## Common Commands
| 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):**
```markdown
- TypeScript strict mode - no `any` types
```
### Negative Rules Need Alternatives
**Bad:**
```markdown
- Never use npm
```
**Good:**
```markdown
- Use pnpm (not npm) - monorepo requires pnpm workspaces
```
### Reference External Docs (Don't Embed)
**Bad:**
```markdown
[500 lines of API documentation]
```
**Good:**
```markdown
For complex widget usage or FooBarError, see docs/widgets.md
```
### Emphasis for Critical Items
```markdown
**IMPORTANT:** RLS policies auto-filter by user_id - don't add redundant .eq('user_id', userId)
```
## Monorepo Strategy
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:
- Monorepo tooling (pnpm/nx/turborepo commands)
- Cross-package patterns
- CI/CD workflows
- Shared conventions
**Subdirectory CLAUDE.md** should contain:
- Package-specific commands
- Local testing patterns
- Package-specific gotchas
**Size targets:**
- Root: <500 lines, <10k words
- Subdirectories: <200 lines each
- Total loaded context: <15k tokens
## Quality Audit Checklist
Run this audit on existing CLAUDE.md files:
- [ ] **Actionable:** Every item helps Claude do something concrete
- [ ] **Non-obvious:** Excludes things Claude already knows
- [ ] **Current:** Reflects actual project state (not aspirational)
- [ ] **Tested:** Commands actually work when copied
- [ ] **Minimal:** Each line earns its token cost
- [ ] **Alternatives:** Every "don't" has a "do instead"
- [ ] **Scannable:** Uses tables/bullets, not paragraphs
- [ ] **Examples:** Critical patterns show code, not just describe
## Anti-Patterns to Fix
| 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 |
## Iteration Workflow
CLAUDE.md improves through use:
1. **During coding:** Press `#` in Claude Code to add memories
2. **After sessions:** Review what Claude struggled with
3. **Add sparingly:** Only document repeated friction points
4. **Prune regularly:** Remove outdated or unused content
## Post-Task Maintenance
**After completing significant tasks, update CLAUDE.md:**
### What to Add
| 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 |
### What to Update
- **New dependencies** - Add install commands
- **New scripts** - Document in commands table
- **Architecture changes** - Update directory descriptions
- **Deprecated patterns** - Remove or mark as legacy
### Maintenance Checklist
After each significant task:
- [ ] Did Claude struggle with anything? → Document it
- [ ] Did I discover a new pattern? → Add to Code Standards
- [ ] Did commands change? → Update Quick Start
- [ ] Is anything now outdated? → Remove it
### Learn from Mistakes
When Claude makes errors:
```markdown
## 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.
## Advanced Patterns
### Machine-Readable State
For complex projects, add parseable metadata:
```markdown
## Project State
<!-- machine-readable -->
Version: 1.2.0
Status: development
Last migration: 0016_search_analytics
```
### Conditional Workflows
```markdown
## 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
```
### Performance Targets
```markdown
## Metrics
| Metric | Target | Notes |
|--------|--------|-------|
| Cold start | <200ms | Measure with `time cmd` |
| API p95 | <500ms | Check after changes |
```
## Output Requirements
When creating CLAUDE.md:
1. Analyze codebase first (don't guess structure)
2. Keep total length under 500 lines
3. Test all commands before including
4. Use markdown tables for reference data
5. Save to `/mnt/user-data/outputs/CLAUDE.md`
When auditing CLAUDE.md:
1. Report issues with specific line references
2. Provide concrete fixes, not vaRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.