claude-md-optimizer
Analyzes and optimizes CLAUDE.md files following Anthropic's official best practices. Use when reviewing existing CLAUDE.md for improvements, or when user mentions CLAUDE.md is too long or ineffective.
What this skill does
# Optimize CLAUDE.md Analyze, audit, and optimize CLAUDE.md files based on Anthropic's official best practices for effective Claude Code configuration. ## Degrees of Freedom This is a **medium-freedom** task. Follow the structured workflow but adapt recommendations based on the specific project's needs, tech stack, and team conventions. ## Workflow Copy this checklist and track your progress: ``` Optimization Progress: - [ ] Step 1: Analyze current CLAUDE.md state - [ ] Step 2: Audit against best practices checklist - [ ] Step 3: Identify and prioritize issues - [ ] Step 4: Generate recommendations - [ ] Step 5: Apply or present changes ``` ### 1. Analyze Current State Read the existing CLAUDE.md (if present) and assess: - Current structure and organization - Content categories present - Length and verbosity - Presence of anti-patterns ### 2. Audit Against Best Practices Compare against the checklist in [references/best-practices.md](references/best-practices.md). Score each category: - **Present & Good** - Follows best practices - **Present but Needs Work** - Exists but could be improved - **Missing** - Should be added - **Anti-pattern** - Should be removed/fixed ### 3. Generate Recommendations Prioritize changes by impact: **High Priority:** - Remove sensitive information (API keys, credentials) - Fix anti-patterns (generic advice, excessive length) - Add missing critical sections (project structure, commands) **Medium Priority:** - Improve organization and scannability - Add missing helpful sections - Condense verbose explanations **Low Priority:** - Formatting improvements - Minor restructuring - Optional enhancements ### 4. Apply Changes Either: - **Suggest mode**: Present recommendations for user approval - **Apply mode**: Directly edit CLAUDE.md with improvements ## Optimization Principles ### Keep It Concise CLAUDE.md is loaded into context every time. Total limit: **40k tokens** (CLAUDE.md + all @referenced files combined). ```markdown # BAD: Verbose explanation ## Testing Guidelines When running tests in this project, you should use the npm test command. This will execute all test files and provide output. Make sure tests pass. # GOOD: Concise and actionable ## Testing npm test # Run all tests npm run test:coverage # With coverage report ``` ### Be Specific, Not Generic Include YOUR project's actual patterns, not theoretical best practices. ```markdown # BAD: Generic advice Follow clean code principles and write maintainable code. # GOOD: Project-specific guidance Use `logger` from @/utils, never console.log (tree-shaken in production). Query keys must use queryKeys factory from @/lib/queryKeys. ``` ### Use Progressive Disclosure For large documentation, split into separate files and reference them: ```markdown # In CLAUDE.md See @.claude/rules/testing.md for testing standards. See @docs/ARCHITECTURE.md for system design. # NOT: 500 lines of testing docs inline ``` ### Include Actual Commands Show the commands your team uses: ```markdown ## Development npm run dev # Start dev server (localhost:3000) npm test # Run tests in watch mode npm run build # Production build ``` ### Use Emphasis for Critical Rules For must-follow instructions, use emphasis markers: ```markdown IMPORTANT: Never commit directly to main. YOU MUST run tests before pushing. ALWAYS use logger utility, never console.log. ``` ## Output Format When optimizing, provide: 1. **Summary** - Brief assessment (1-2 sentences) 2. **Score** - X/10 rating with breakdown 3. **Critical Issues** - Must-fix problems 4. **Recommendations** - Prioritized improvements 5. **Optimized CLAUDE.md** - The improved file (if applying changes) ## Example Assessment ``` ## CLAUDE.md Optimization Report **Summary:** Good foundation but overly verbose. Contains generic advice that adds token cost without value. **Score:** 6/10 - Structure: 8/10 (well-organized sections) - Conciseness: 4/10 (too verbose, 2000+ lines) - Specificity: 5/10 (mix of specific and generic) - Security: 9/10 (no sensitive data found) **Critical Issues:** 1. File exceeds 500 lines - should use modular rules files 2. Contains generic "best practices" not specific to project **Recommendations:** 1. [HIGH] Move detailed rules to .claude/rules/*.md files 2. [HIGH] Remove generic coding advice Claude already knows 3. [MED] Add missing quick-start commands section 4. [LOW] Consolidate duplicate information in docs/ ``` ## Resources ### references/ - [best-practices.md](references/best-practices.md) - Complete checklist for CLAUDE.md optimization
Related 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.