ClaudeMod
Back to browse
Configs

CLAUDE.md Templates

Ready-to-use CLAUDE.md templates for popular stacks: Next.js, Django, Rails, FastAPI, Spring Boot, and more — with tech-specific rules and conventions.

Abhishek Ray125 starsAdded 1 months ago

The CLAUDE.md Starter Kit

Get better output from Claude Code in 5 minutes. No plugins, no MCP servers, no configuration — just markdown files in the right places.


The 3-Level Hierarchy

Claude Code reads instructions from three locations. Each has a different scope:

~/.claude/CLAUDE.md          -> Global: your personal preferences (every project)
.claude/CLAUDE.md            -> Project: shared with your team (committed to git)
.claude/local.md             -> Local: your personal overrides (gitignored)

Global = rules you'd repeat across every project ("always run tests," "prefer simple code"). Project = context your whole team benefits from (stack, structure, commands, conventions). Local = stuff only you need (your terminal, your MCP servers, your editor quirks).

Quick Start

1. Create your global file (~2 min)

mkdir -p ~/.claude
cp global/CLAUDE.md ~/.claude/CLAUDE.md

Edit it with your personal preferences. Keep it under 15 lines.

2. Create your project file (~3 min)

mkdir -p .claude
# Pick the template closest to your stack:
cp project/nextjs-typescript.md .claude/CLAUDE.md   # Next.js / React / TypeScript
cp project/python-fastapi.md .claude/CLAUDE.md      # Python / FastAPI
cp project/generic.md .claude/CLAUDE.md              # Anything else

Fill in the blanks. Commit it to git so your team gets the same behavior.

3. Create your local overrides (~1 min)

cp local/local.md .claude/local.md
echo ".claude/local.md" >> .gitignore

Add your personal setup. This file is never shared.

How It Works

Claude Code automatically reads these files at the start of every session. The more specific file wins — project rules override global rules, local rules override project rules.

Important: Claude Code's system prompt already contains ~50 instructions. That's a third of the ~150-200 instruction limit frontier models can reliably follow. Your CLAUDE.md must be lean. Every line competes for attention.

The Self-Improvement Loop

This is the single most impactful habit you can build:

After every correction you give Claude, end with:

"Update CLAUDE.md so you don't make that mistake again."

Claude is good at writing rules for itself. Over time, your CLAUDE.md becomes a living document that gets smarter with every session.

What Goes Where (Decision Guide)

RuleWhere it goesWhy
"Run tests after changes"GlobalYou want this everywhere
"Use shadcn/ui components"ProjectTeam convention
"I use Ghostty terminal"LocalOnly you need this
"Never use any in TypeScript"ProjectTeam standard
"Ask before committing"GlobalPersonal preference
"I have Context7 MCP configured"LocalYour setup, not theirs
"Prices are in src/lib/config"ProjectDomain knowledge
"Keep code simple"GlobalUniversal preference

Common Mistakes

Too long. If your project CLAUDE.md is over 80 lines, Claude starts ignoring parts of it. HumanLayer keeps theirs under 60 lines. That's a good benchmark.

Personality instructions. "Be a senior engineer" or "Think step by step" wastes tokens. Claude Code already has strong system-level instructions.

@-mentioning docs. Writing @docs/api-guide.md embeds the entire file into context every single session. Instead, pitch Claude on when to read it: "For Stripe integration issues, see docs/stripe-guide.md."

Formatting rules. "Use 2-space indentation" or "always add trailing commas" — use a linter/formatter for this. Never send an LLM to do a linter's job.

Duplicate rules. If your global file says "run tests" and your project file also says "run tests," you've wasted tokens saying the same thing twice.

Scaling Up: Module-Specific Files

For larger codebases, you can place CLAUDE.md files in subdirectories:

.claude/CLAUDE.md              -> Project root (always loaded)
src/auth/CLAUDE.md             -> Auth module (loaded when working in src/auth/)
src/api/CLAUDE.md              -> API module (loaded when working in src/api/)

Claude Code loads these on demand — only when working in that directory. This keeps your root file lean while giving Claude deep context where it matters.

Use this when your root CLAUDE.md pushes past 80 lines, or when different parts of the codebase have different conventions.

Included Files

FileWhat it isWhen to use it
global/CLAUDE.mdPersonal preferences templateCopy to ~/.claude/CLAUDE.md
project/nextjs-typescript.mdNext.js/React/TS project templateCopy to .claude/CLAUDE.md
project/python-fastapi.mdPython/FastAPI project templateCopy to .claude/CLAUDE.md
project/generic.mdFill-in-the-blank for any stackCopy to .claude/CLAUDE.md
local/local.mdPersonal overrides templateCopy to .claude/local.md
workflows/self-improvement-rules.mdStructured rules for planning, verification, self-correctionPaste sections into your CLAUDE.md
workflows/prompting-patterns.md11 copy-paste prompts from the Claude Code teamUse directly in your sessions
cheatsheet.mdOne-page reference cardBookmark or print
principles.mdThe full research — why these patterns workRead when you want to go deeper

The Principles (Go Deeper)

principles.md contains everything we know about writing effective CLAUDE.md files:

  • The attention budget (why less is more)
  • Anthropic's official include/exclude table
  • Emphasis keywords that actually work (IMPORTANT, YOU MUST)
  • Module-specific CLAUDE.md files for scaling
  • Progressive disclosure patterns
  • Architecture diagrams (HumanLayer's pattern)
  • The "Don't X, Do Y" rule
  • Matt Pocock's plan loop
  • Real-world benchmarks from HumanLayer, Boris Cherny, Cloudflare, ChrisWiles
  • Skill activation mapping
  • TODO priority systems
  • Every anti-pattern and what to do instead

If you only read one file in this kit besides the templates, read that one.

Sources

This starter kit is based on:


Built by Claude Code Camp — a weekly newsletter teaching developers how to get 10x more from Claude Code.

More Configs

Configs

Claude Code System Prompts

Curated CLAUDE.md system prompt variations for different coding styles and strictness levels — conservative, balanced, and aggressive modes with detailed trade-off notes.

system-promptsclaude-mdstrictness+2
by Piebald AI
GitHub
Configs

Awesome CLAUDE.md

A curated collection of CLAUDE.md configuration files from real projects — monorepos, SaaS apps, open-source libraries, and enterprise codebases.

awesome-listclaude-mdexamples+2
by Josix
GitHub
Configs

Claude Codex Settings

Sensible default Claude Code configuration focused on Python and ML projects — includes rules for type hints, docstrings, pytest patterns, and data science conventions.

pythonmldata-science+3
by fcakyon
GitHub

Command Palette

Search for a command to run...