Claude Code
authorKRIATIZ
02 · Steering the agent / lesson 1 of 3

CLAUDE.md: project memory

20 minBeginner5 steps

The agent reads CLAUDE.md at the start of every session. It is the simplest way to explain your project once instead of repeating it in every request.

data and requestsproblem
Lesson stepsstep 1 of 5
  1. No memory
  2. Project
  3. Personal
  4. Module
  5. Result
step 1 / 5problem

Explaining again every time

Without CLAUDE.md every session starts from zero: the agent looks for test commands and guesses your style.

Key point

CLAUDE.md explains the project once.

← → steps · space pause · R restart · ⌘K search
You will learn 5
Lesson notes

Where CLAUDE.md lives

FilePurpose
./CLAUDE.md at the repo rootproject rules shared by the team, committed to git
CLAUDE.md in a subfolderrules for a specific module, picked up when the agent works there
~/.claude/CLAUDE.mdyour personal rules for every project

The /memory command opens memory files for editing.

What to write

  • Commands: how to install dependencies, run tests, the linter, the build.
  • Structure: where the backend, frontend, migrations and tests are.
  • Style: rules your linter doesn’t enforce: naming, error handling, testing approach.
  • Don’ts: don’t touch generated files, don’t change the public API unless asked.
  • Process: branch and commit naming, what to check before finishing a task.

Example

# Project: online shop on Laravel + Vue

## Commands
- Tests: php artisan test
- Frontend: npm run dev, build npm run build
- Linter: ./vendor/bin/pint

## Structure
- app/Services — business logic, thin controllers
- resources/js — Vue components

## Rules
- Store money in cents (int), never float
- New endpoints only with a Feature test
- Don't edit files in database/migrations, create new migrations

## Before finishing a task
- Run tests and pint, fix errors

Common mistakes

  • Too long. CLAUDE.md takes context space in every session. Keep it short and specific.
  • Generic phrases. "Write clean code" changes nothing. "Functions under 40 lines, early return" does.
  • Stale commands. If the test command changed but CLAUDE.md didn’t, the agent wastes steps on errors.
  • Secrets in the file. CLAUDE.md is committed to git. No passwords or keys.
When the agent makes the same mistake twice, add one sentence to CLAUDE.md. That way the file grows from real problems.

CLAUDE.md and skills

CLAUDE.md is always loaded. Instructions for rare tasks (release, database migration, report) are better as a skill that loads only when needed. More in lesson 7 and in the article "CLAUDE.md in Claude Code".

Today's task

Open the CLAUDE.md that /init created. Add test commands, three style rules, two don’ts and a checklist for finishing a task.

Need a CLAUDE.md for your project?

I will analyse your repository and write CLAUDE.md, permissions and skills for your stack and process.

Let’s talk
Vladyslav Koshelyev
Vladyslav Koshelyev

Developer at KRIATIZ. I build chatbots, websites and automation for businesses. Author of the course.

About the author · Telegram