Agent skill
claude-md-author
This skill should be used when the user asks to "create a CLAUDE.md", "write a CLAUDE.md", "set up CLAUDE.md", "configure Claude for this project", "add project instructions for Claude", "initialize Claude context", or mentions needing project-specific Claude instructions.
Install this agent skill to your Project
npx add-skill https://github.com/petekp/claude-code-setup/tree/main/skills/claude-md-author
SKILL.md
CLAUDE.md Authoring Guide
This skill guides the creation of effective CLAUDE.md files that provide Claude with essential project context.
Core Principle
LLMs are stateless—they have no memory between sessions. The only thing Claude knows about a codebase is the tokens provided to it. CLAUDE.md enters every conversation, making it the primary tool for context management.
The WHAT-WHY-HOW Framework
Structure CLAUDE.md content around three categories:
| Category | Purpose | Examples |
|---|---|---|
| WHAT | Technology stack, project structure, codebase organization | "This is a Next.js app using TypeScript and Prisma" |
| WHY | Project purpose, component functions | "The auth module handles OAuth2 flow for enterprise SSO" |
| HOW | Commands, testing procedures, verification methods | "Run npm test before commits; lint with npm run lint" |
Critical Constraints
Instruction Budget
Frontier LLMs reliably follow approximately 150-200 instructions. Claude Code's system prompt already contains ~50 instructions, leaving limited budget for CLAUDE.md. Smaller models degrade exponentially as instructions increase.
Size Guidelines
- Target under 300 lines
- Aim for under 60 lines if possible (HumanLayer's CLAUDE.md achieves this)
- Every line should provide universal value across all sessions
What to Include
Essential elements:
- Build and test commands (the HOW)
- Project structure overview (the WHAT)
- Key architectural decisions (the WHY)
- Patterns and conventions specific to this codebase
- File references using
file:lineformat (not code snippets)
Example build/test section:
## Commands
- Build: `npm run build`
- Test: `npm test`
- Lint: `npm run lint`
- Type check: `npx tsc --noEmit`
What to Avoid
Never Use as a Linter
"Never send an LLM to do a linter's job." Code style guidelines waste tokens and degrade performance. Use deterministic tools (ESLint, Prettier, Biome) instead. Configure hooks to run formatters automatically.
Avoid Auto-Generation
CLAUDE.md is one of the highest leverage points for Claude's effectiveness. Manually craft it rather than using /init commands. Auto-generated content tends to be verbose and generic.
Skip Universally Irrelevant Content
Claude may ignore CLAUDE.md entirely if content seems task-irrelevant. The system explicitly reminds Claude that "this context may or may not be relevant to your tasks."
No Duplicate Information
Avoid copying code snippets—they become outdated quickly. Use file:line pointers instead.
Progressive Disclosure Strategy
Store task-specific guidance in separate files rather than bloating CLAUDE.md:
.claude/
├── CLAUDE.md # Core context (universal)
├── docs/
│ ├── testing.md # Testing procedures
│ ├── deployment.md # Deployment guide
│ └── architecture.md # Architecture decisions
└── plans/ # Implementation plans
Reference these in CLAUDE.md:
## Documentation
- Testing procedures: `.claude/docs/testing.md`
- Deployment guide: `.claude/docs/deployment.md`
Alternative Mechanisms
Consider using Claude Code's other features instead of cramming everything into CLAUDE.md:
| Need | Better Approach |
|---|---|
| Code formatting | Hooks that run formatters |
| Task-specific instructions | Slash commands linking to guides |
| Recent changes context | Commands referencing version control |
| One-time procedures | Separate markdown files |
Creation Workflow
To create an effective CLAUDE.md:
- Audit the codebase: Identify build commands, test procedures, key patterns
- Draft minimal content: Start with WHAT-WHY-HOW essentials only
- Remove task-specific content: Move specialized instructions to
.claude/docs/ - Use pointers: Replace code snippets with
file:linereferences - Test for universality: Ask "Will this help in every Claude session?"
Template
# Project Name
Brief one-line description of what this project does.
## Stack
- [Primary language/framework]
- [Database/storage]
- [Key dependencies]
## Commands
- Build: `command`
- Test: `command`
- Lint: `command`
## Structure
- `src/` - Application code
- `tests/` - Test files
- [Other key directories]
## Key Patterns
- [Pattern 1 with file:line reference]
- [Pattern 2 with file:line reference]
## Notes
- [Important architectural decision]
- [Gotcha or non-obvious behavior]
Additional Resources
For detailed examples and anti-patterns, consult:
references/examples.md- Real CLAUDE.md examplesreferences/anti-patterns.md- Common mistakes to avoid
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
ubiquitous-language
Extract a DDD-style ubiquitous language glossary from the current conversation, flagging ambiguities and proposing canonical terms. Saves to UBIQUITOUS_LANGUAGE.md. Use when user wants to define domain terms, build a glossary, harden terminology, create a ubiquitous language, or mentions "domain model" or "DDD".
every-style-editor
This skill should be used when reviewing or editing copy to ensure adherence to Every's style guide. It provides a systematic line-by-line review process for grammar, punctuation, mechanics, and style guide compliance.
manage-codex
Autonomous Codex batch orchestrator. Use for "/manage-codex", "manage codex", "use codex", "dispatch to codex", or long-running Codex work.
seo-audit
When the user wants to audit, review, or diagnose SEO issues on their site. Also use when the user mentions "SEO audit," "technical SEO," "why am I not ranking," "SEO issues," "on-page SEO," "meta tags review," "SEO health check," "my traffic dropped," "lost rankings," "not showing up in Google," "site isn't ranking," "Google update hit me," "page speed," "core web vitals," "crawl errors," or "indexing issues." Use this even if the user just says something vague like "my SEO is bad" or "help with SEO" — start with an audit. For building pages at scale to target keywords, see programmatic-seo. For adding structured data, see schema-markup. For AI search optimization, see ai-seo.
capture-learning
Analyze recent conversation context and capture learnings to project knowledge files (for project-specific insights) or skills/commands/subagents (for cross-project patterns). Use when the user asks to "capture this learning", "update the docs with this", "remember this for next time", "document this issue", "add this to CLAUDE.md", "save this knowledge", or "update project knowledge". Also triggers after resolving build/setup issues, discovering non-obvious patterns, or completing debugging sessions with valuable insights.
agent-changelog
Compile an agent-optimized changelog by cross-referencing git history with plans and documentation. Use when asked to "update changelog", "compile history", "document project evolution", or proactively after major milestones, architectural changes, or when stale/deprecated information is detected that could confuse coding agents.
Didn't find tool you were looking for?