SKILL.md--- name: claude-md description: Create or update CLAUDE.md files following best practices for optimal AI agent onboarding --- ## User Input ```text $ARGUMENTS ``` You **MUST** consider the user input before proceeding (if not empty). User may specify: - `create` - Create new CLAUDE.md from scratch - `update` - Improve existing CLAUDE.md - `audit` - Analyze and report on current CLAUDE.md quality - A specific path to create/update (e.g., `src/api/CLAUDE.md` for directory-specific instructions) ## Core Principles **LLMs are stateless**: CLAUDE.md is the main project file loaded into every conversation (alongside auto memory and unscoped rules). It serves as the primary onboarding document for AI agents into your codebase. ### The Golden Rules 1. **Less is More**: Frontier LLMs can follow ~150-200 instructions. Claude Code's system prompt already uses ~50. Keep your CLAUDE.md focused and concise. 2. **Universal Applicability**: Only include information relevant to EVERY session. Task-specific instructions belong in separate files. 3. **Don't Use Claude as a Linter**: Style guidelines bloat context and degrade instruction-following. Use deterministic tools (prettier, eslint, etc.) instead. 4. **Never Auto-Generate**: CLAUDE.md is the highest leverage point of the AI harness. Craft it manually with careful consideration. ## Execution Flow ### 1. Project Analysis First, analyze the current project state: 1. Check for existing CLAUDE.md files: - Root level: `./CLAUDE.md` or `.claude/CLAUDE.md` - Directory-specific: `**/CLAUDE.md` - Global user config: `~/.claude/CLAUDE.md` 2. Identify the project structure: - Technology stack (languages, frameworks) - Project type (monorepo, single app, library) - Development tools (package manager, build system, test runner) 3. Review existing documentation: - README.md - CONTRIBUTING.md - package.json, pyproject.toml, Cargo.toml, etc. ### 2. Content Strategy (WHAT, WHY, HOW) Structure CLAUDE.md around three dimensions: #### WHAT - Technology & Structure - Technology stack overview - Project organization (especially important for monorepos) - Key directories and their purposes #### WHY - Purpose & Context - What the project does - Why certain architectural decisions were made - What each major component is responsible for #### HOW - Workflow & Conventions - Development workflow (bun vs node, pip vs uv, etc.) - Testing procedures and commands - Verification and build methods - Critical "gotchas" or non-obvious requirements ### 3. Progressive Disclosure Strategy For larger projects, recommend creating an `agent_docs/` folder: ``` agent_docs/ |- building_the_project.md |- running_tests.md |- code_conventions.md |- architecture_decisions.md ``` In CLAUDE.md, reference these files with instructions like: ```markdown For detailed build instructions, refer to `agent_docs/building_the_project.md` ``` **Important**: Use `file:li