Overview
Claude Code memory files transform Claude from a generic coding assistant into a project-aware development partner. These special files automatically load context when Claude starts, containing project-specific information like commands, code styles, and workflows that Claude remembers across sessions.
Memory Types
There are three types of memory files you can use:
-
Project Memory (
./CLAUDE.md
): Share project conventions with your team by committing this to your repo -
User Memory (
~/.claude/CLAUDE.md
): Set personal coding preferences that apply across all projects -
Local Project (
./CLAUDE.local.md
): No longer recommended - use imports instead
Claude automatically finds these files by searching up from your current directory and down into subdirectories when you work with files there.
Setting Up Memory Files
Bootstrap with /init
The fastest way to create a CLAUDE.md file:
> /init
This generates a basic structure for documenting your project’s essentials.
What Goes In Your Memory Files
Focus on documenting what’s unique about your project:
# Development Commands
- npm run dev: Starts dev server on port 3000
- npm run build: Creates production build
- npm test: Runs Jest test suite
# Coding Standards
- Always use ES6 imports, never require()
- Destructure imports: import { useState } from 'react'
- 2 spaces for indentation, semicolons required
# Folder Structure
- src/components: Shared React components
- src/utils: Helper functions and utilities
- src/api: Backend route handlers
# Team Workflow
- Branch names: feature/JIRA-123-description
- Always run tests before pushing
Where to Put Memory Files
Choose the right location for your needs:
- Project root (most common) - commit this so your whole team benefits
- Parent folders - great for monorepos where you need different rules per package
- Home directory (
~/.claude/CLAUDE.md
) - your personal preferences for every project
Managing Memories
Quick Memory Addition
Use the #
prefix to instantly add memories during sessions:
# Always use descriptive variable names
Claude will prompt you to select which memory file to store this in.
Direct Editing
Use the /memory
command to open memory files in your system editor for more extensive changes.
Organizing with Imports
Keep your memory files clean by importing other documentation:
# Project Overview
@README.md
@docs/getting-started.md
# My Personal Settings
@~/.claude/my-coding-style.md
How imports work:
- Can chain up to 5 files deep
- Use relative or absolute file paths
- Code blocks won’t trigger imports
- Imported files can import other files too
Best Practices
Get specific - Write “Use 2-space indentation” instead of vague “Format code nicely”
Stay organized - Group related tips under clear headings using bullet points
Keep it fresh - Review and update your memory files as your project changes
What to Include
Document what makes your project special:
✅ Custom commands and scripts your team uses
✅ Style choices that differ from standard practices
✅ Testing approaches and framework preferences
✅ Git workflow like branch naming and PR rules
✅ Setup quirks and environment requirements
✅ Project gotchas that aren’t obvious from code
❌ Basic programming concepts Claude already understands
❌ Language fundamentals covered in official docs
❌ Changing details like current sprint tasks
❌ Secret information like API keys or passwords
Sources
These recommendations are based on:
Conclusion
Memory files are the key to transforming Claude Code from a tool into a teammate. By documenting your project’s unique patterns, commands, and conventions, you create an AI assistant that understands your codebase context without repeated explanations.
Start with /init
, add project-specific information using #
during sessions, and periodically review with /memory
to keep your knowledge base current and effective.