Reupload
All AI ToolsLocal AI?
← Back home

Skill · Anthropic Official Documentation - Using CLAUDE.md files

Keep Claude Focused: The CLAUDE.md Trick

Keep Claude Focused: The CLAUDE.md Trick

Photo: Mohammad Rahmani on Unsplash

Save hours of repetitive explanations by creating a CLAUDE.md file in your project root. Claude Code automatically loads this persistent configuration at every session, remembering your tech stack, coding standards, and workflow rules without you repeating yourself.

When you switch between Claude Code sessions, you typically need to re-explain your project structure, coding conventions, and architectural decisions from scratch. This wastes time and leads to inconsistent outputs. The CLAUDE.md file solves this by acting as Claude's persistent memory.

CLAUDE.md is a markdown file you place at your project root (./CLAUDE.md). Claude Code automatically reads it at the start of every session and integrates it into its context window as standing instructions. You can include your tech stack, naming conventions, testing requirements, security policies, and any architectural rules your team follows.

To get started, create a CLAUDE.md file with core information: your project name, tech stack (React 18, Node.js, PostgreSQL), key directories, and any non-negotiable conventions ("Always use TypeScript strict mode", "Write tests before code"). Keep it between 300-800 words. For larger teams, create project-specific rules in .claude/rules/ subdirectories and maintain a smaller root file. Claude also loads a global ~/.claude/CLAUDE.md for personal preferences across all projects.

Example workflow: A payment processing team adds to their CLAUDE.md: "Backend: Node.js + Express. Database: PostgreSQL with row-level security. Security: All amount fields must be integers (cents, not decimals). All APIs require authentication tokens." Now every session with Claude Code knows these constraints automatically. When you ask Claude to write a new endpoint, it generates code that respects these rules without you mentioning them each time.