A curated collection of CLAUDE.md examples, templates, and best practices for Claude Code.
CLAUDE.md is your secret weapon for customizing Claude Code's behavior. This repo helps you get the most out of it.
- What is CLAUDE.md?
- Quick Start
- Templates
- Best Practices
- Advanced Techniques
- Examples
- Tips & Tricks
- Contributing
CLAUDE.md is a special markdown file that Claude Code reads to understand your preferences, project context, and working style. It acts like a persistent system prompt that shapes how Claude assists you.
| Location | Scope | Use Case |
|---|---|---|
~/.claude/CLAUDE.md |
Global | Personal preferences across all projects |
./CLAUDE.md |
Project | Project-specific instructions |
~/.claude/knowledge-base/CLAUDE.md |
Knowledge base | Domain-specific context |
Project-level files override global settings when both exist.
Create a minimal CLAUDE.md in your project:
# Project: My App
## Tech Stack
- TypeScript, React, Node.js
- PostgreSQL, Prisma ORM
- Jest for testing
## Code Style
- Use functional components with hooks
- Prefer named exports
- Write tests for all new features
## Commands
- `npm run dev` - Start dev server
- `npm test` - Run testsThat's it! Claude Code will now understand your project context.
Personal assistant configuration with task management, calendar integration, and communication preferences.
π» Software Developer
Development-focused setup with coding standards, git workflow, and review guidelines.
π¬ Researcher
Academic/research configuration with paper management, citation preferences, and experiment tracking.
π Startup / Small Team
Fast-paced environment setup with rapid prototyping preferences and deployment workflows.
Writing-focused setup with style guides, tone preferences, and content workflows.
π Multi-Persona
Switch between different AI personalities based on context (tmux session, git branch, etc.)
β Bad:
Write good code.β Good:
## Code Style
- Max line length: 100 characters
- Use early returns to reduce nesting
- Prefer composition over inheritance
- Always handle errors explicitlyTell Claude what NOT to do:
## Don't
- Don't create new files unless explicitly asked
- Don't refactor unrelated code
- Don't add dependencies without asking
- Don't use emojis in code comments## Communication
- Be concise - bullet points over paragraphs
- Skip the preamble - get to the point
- Don't ask for confirmation on routine tasks
- Challenge my assumptions when I'm wrongβ Micromanaging:
When I ask you to write a function, first think about the inputs,
then think about the outputs, then write the code...β Context-setting:
## Philosophy
We value readability over cleverness. Code is read 10x more than written.Organize with clear headers:
## Project Overview
## Tech Stack
## Code Style
## Git Workflow
## Testing Requirements
## Deployment
## Don'tSwitch Claude's personality based on your tmux session:
## Persona Detection
Check tmux session name at conversation start:
- `secretary` β Professional assistant (formal)
- `dev` β Coding buddy (casual, technical)
- `research` β Academic assistant (precise, citation-focused)See full persona template for implementation.
## When working on /api/*
- Always validate input with Zod
- Return consistent error shapes
- Log all database queries in dev
## When working on /components/*
- Use CSS modules, not inline styles
- Every component needs a Storybook story
- Props must have TypeScript interfaces## MCP Servers
- filesystem: For file operations
- github: For PR and issue management
- slack: For notifications
## Slash Commands
- /deploy - Deploy to staging
- /test - Run test suite
- /review - Start code review## Memory
Store learned preferences in `CLAUDE-memory.md`:
- Communication preferences
- Past decisions and their rationale
- Project-specific terminology
Don't modify CLAUDE.md directly - use the memory file.Real-world CLAUDE.md files:
- Minimal Starter - Just the essentials
- Full-Featured - Comprehensive setup
- Monorepo - Multi-package repository
- Open Source Maintainer - OSS project management
Don't write a 500-line CLAUDE.md on day one. Start with basics, add as you discover needs.
Your CLAUDE.md should evolve. Review monthly and remove what's not working.
Tables are scannable and prevent ambiguity:
| Priority | Response Time |
|----------|---------------|
| π΄ High | Immediately |
| π‘ Medium | Within the day |
| π’ Low | When convenient |Don't give contradictory instructions:
# Conflicting (bad)
- Always write comprehensive tests
- Move fast, tests can come laterAfter major changes, try common tasks and see if Claude behaves as expected.
Instead of abstract rules, show examples:
## Commit Messages
Good:
- `fix(auth): handle expired token refresh`
- `feat(api): add pagination to /users endpoint`
Bad:
- `fixed stuff`
- `WIP`Contributions welcome! Please read the contribution guidelines first.
- π Found an issue? Open an issue
- π‘ Have a template to share? Submit a PR
- β Like this repo? Give it a star!
MIT - feel free to use these templates in your projects.
Like this repo? Follow me for more Claude Code tips!