2Getting hands on

Adding context

5 min read934 words

You just cloned a codebase you have never seen before. The folder structure is unfamiliar, half the filenames are abbreviations, and you have a task to land by the end of the day. Claude Code can help, but only if you give it enough of the right context — and not so much that it drowns in irrelevant detail. Context management is the single biggest lever you have on how useful Claude Code feels day to day.

Context is just the set of files and instructions Claude has loaded when you send a request. The right context turns vague guesses into precise edits. This lesson walks through the core techniques: /init, the three-level CLAUDE.md system, memory mode, and @ mentions.

Step 1 — Run /init to generate a project-level CLAUDE.md

From inside the project directory, open Claude Code and run:

/init

Claude Code will analyse the entire codebase and generate a CLAUDE.md file at the project root. This file is a summary Claude writes for itself: project purpose, architecture, key files, how to run things, which conventions to follow. Every future request you make in this project automatically includes its contents — so whatever you put in CLAUDE.md becomes standing context.

On a well-structured project /init produces a usable first draft in seconds. Treat it as a starting point, not a finished artifact.

Step 2 — Learn the three-level CLAUDE.md system

Not every instruction belongs in a file that the whole team sees. Claude Code supports the three-level CLAUDE.md system, and each level has a specific purpose.

Project-level — CLAUDE.md: lives at the project root, committed to source control, shared with the team. This is where you put conventions everyone needs to follow — coding style, testing commands, architectural rules.

Local-level — CLAUDE.local.md: lives in the same directory but is gitignored. This is for your personal instructions in this project — "always run tests after editing auth code," "remind me to update the changelog" — that your teammates do not need or want.

Machine-level — ~/.claude/CLAUDE.md: global instructions that apply to every project on your machine. Use this for preferences that travel with you, like "prefer functional patterns" or "never use var."

All three levels are automatically loaded when you start Claude Code in a project. They compose — machine + project + local — so you can layer personal rules on top of team rules without editing anything anyone else touches.

Step 3 — Use memory mode to edit CLAUDE.md files in natural language

Editing these files by hand gets old. Memory mode is faster.

Start any message with # and Claude Code treats it as a memory instruction. For example:

# Always run `npm run lint` before committing in this project.

Claude will ask which CLAUDE.md file to write it to (project, local, or machine) and append the rule. You get a persistent instruction without leaving the terminal or opening a file.

Step 4 — Use @ mentions to pull specific files into a single request

Sometimes you do not want a rule baked into CLAUDE.md — you just want Claude to look at a specific file for this request. That is what @ mentions are for.

Please add a new column to the users table. @prisma/schema.prisma

Claude Code loads the contents of prisma/schema.prisma into the request. It now knows the exact current schema and can write a migration that actually fits, instead of guessing.

@ mentions work with any file in the project, and you can reference as many as you need.

Step 5 — Pin files to every request via CLAUDE.md

If a file is so central that you want Claude to see it on every request, reference it with @ syntax inside CLAUDE.md itself:

# Project notes

The database schema is defined in @prisma/schema.prisma. Always consult it
before writing database code.

Now every request in this project automatically includes the schema. This is the right move for small, always-relevant files — schemas, type definitions, API contracts. Do not do it for large files you only need occasionally.

Step 6 — Permission shortcut: Shift+Tab

Claude Code asks for permission the first time it wants to write each file. If you trust it to work freely in a sandbox or scratch project, press Shift+Tab to enter a mode where it can write files without asking. Toggle it off the same way. Use this intentionally — it is a sharp tool.

The principle underneath all of this

Give Claude just enough relevant context. Not everything, not nothing. Irrelevant files dilute attention and waste tokens. Missing files force Claude to guess. The techniques above are all variations on the same theme: load what matters, skip what does not, and make the high-value stuff automatic via CLAUDE.md.

Key Takeaways

  • 1Run `/init` to generate a project-level CLAUDE.md that summarises your codebase and ships context with every request.
  • 2The three-level CLAUDE.md system separates team conventions (project), personal rules (local), and cross-project preferences (machine).
  • 3Memory mode — starting a message with `#` — is the fastest way to append new instructions to any CLAUDE.md file without leaving the terminal.
  • 4`@` mentions pull specific files into a single request; using `@` inside CLAUDE.md pins files to every request automatically.
  • 5Context management is a balancing act: load what is relevant, skip what is not, and let CLAUDE.md handle the files you always need.