Every time you start a new Claude Code session in a project, you waste precious tokens and mental energy re-explaining the stack, coding standards, and project goals. The solution is already built in: CLAUDE.md files and the /init command. This tutorial reveals how to use them effectively.
The Technique: Project-Specific Memory
CLAUDE.md is a plain text markdown file you place in your project's root directory. It's not a config file for the CLI tool itself; it's a persistent prompt for the Claude AI agent. When you run claude code in a directory containing a CLAUDE.md file, Claude reads it first, before you even type your first instruction.
The /init command is the trigger. When you type /init in a Claude Code session, it forces Claude to re-read the CLAUDE.md file and re-initialize its understanding of the project context. This is crucial after long sessions where context may have drifted.
Why It Works: Context Window Economics
Claude Code operates within a finite context window. Every token you spend re-explaining your project's tech stack ("We're using Next.js 15 with App Router, Tailwind CSS, and a PostgreSQL backend...") is a token not spent on solving the actual problem. CLAUDE.md moves this static, foundational context out of your conversational flow and into a persistent, always-available source.
This aligns with a key trend in agentic development: reducing prompt overhead. As noted in our recent coverage of tools like Loop CLI and Arxitect, the ecosystem is moving towards declarative, file-based configurations that make AI agents more predictable and efficient.
How To Apply It: Your CLAUDE.md Template
Your CLAUDE.md should be concise, structured, and actionable. Here’s a template you can adapt:
# Project: [Your Project Name]
## Tech Stack & Dependencies
- **Framework:** Next.js 15 (App Router)
- **Styling:** Tailwind CSS v4
- **Database:** PostgreSQL (via Prisma ORM)
- **Auth:** NextAuth.js v5
- **Deployment:** Vercel
- **Package Manager:** pnpm
## Code Style & Conventions
- Use TypeScript strictly. No `any` types.
- Component files: `PascalCase.tsx`
- Utility files: `camelCase.ts`
- Follow ESLint config in `.eslintrc.json`
- Write JSDoc comments for all exported functions.
## Project Goals & Current Focus
- Primary Goal: Build a dashboard for user analytics.
- Current Sprint: Implementing the `/dashboard/engagement` page.
- Avoid: Making changes to the legacy billing module.
## Common Commands
- `pnpm dev` - Start dev server
- `pnpm db:push` - Push Prisma schema to DB
- `pnpm lint:fix` - Run linter
Place this in your project root. Now, when you start Claude Code, your first prompt can be direct:
$ claude code
> Add a bar chart to the engagement page showing weekly active users.
Claude already knows the stack, the file structure conventions, and the current sprint goal.
When To Use /init
Use the /init command in three scenarios:
- After a long, multi-step session where Claude's focus may have shifted away from the core project context.
- When you switch tasks within the same project (e.g., from frontend work to debugging an API route).
- If Claude seems confused about basic project facts, indicating it may have lost the
CLAUDE.mdcontext.
Simply type /init and send. Claude will acknowledge it has re-read the file and is ready to proceed with the full context restored.
Pro Tip: Layer Your Context
For large monorepos, consider a layered approach:
- A root
CLAUDE.mdwith global standards (linting, PR guidelines, overall architecture). - Subdirectory-specific
CLAUDE.mdfiles for individual apps or packages (e.g.,/apps/web/CLAUDE.mdfor frontend-specific instructions).
Claude Code will read theCLAUDE.mdin the current working directory, allowing for granular control.
Stop starting from scratch. Treat CLAUDE.md as the first file you create in any new project. It turns Claude Code from a general-purpose coding assistant into a dedicated team member who already knows the playbook.





