Skip to content
Mastering Claude

Home / Everyday moves

Everyday moves10 minApplication

Getting to grips with, documenting and migrating a codebase

On an unfamiliar repository, asking for an overview before making any changes shapes the questions that follow, and the /init command actually reads the project's content to write a first CLAUDE.md rather than starting from a blank page.

On an unfamiliar repository, opening the first file that comes to hand teaches you almost nothing about how the pieces fit together. A broad question, along the lines of give me an overview of this repository, usefully shapes what follows: Claude Code identifies entry points, declared dependencies and folder organisation before going into the detail of one specific function.

Mapping the territory before touching the code

The answer to this first question serves as a map for choosing the next one. Asking straight away how an isolated module works, without going through this overview first, amounts to fixing a part without knowing what it does in the complete machine. On a large project, two or three successive questions, each narrower than the last, replace a file by file exploration that would take hours.

Writing a first memory file with /init

The /init command actually reads the repository's content to produce a first CLAUDE.md: detected build and test commands, conventions visible in the existing code, the structure of the main folders. If a CLAUDE.md already exists, /init does not overwrite it, it proposes improvements based on what is already written. The generated file remains a first draft: it gets reread and trimmed down to keep only what is short and verified, as detailed in CLAUDE.md, the project's memory.

mkdir -p demo-migration/src && cd demo-migration
git init -q
printf 'def total(a, b):\n    return a + b\n' > src/calcul.py
printf 'lodash==4.17.21\n' > requirements.txt
git add -A && git commit -q -m "première version"
claude
> give me an overview of this repository, then generate a CLAUDE.md with /init

Treating documentation as source code

Outdated documentation costs more than no documentation at all, because it misleads instead of simply saying nothing. Asking for it to be generated while specifying the expected style, JSDoc or docstrings depending on the project's language, avoids a format nobody on the team ends up using. The same principle applies to a dependency update: asking for the list of breaking changes before modifying the lock file gives a basis for a decision, even though no dedicated command produces this list automatically. It is a way of phrasing the request, not a separate tool.

The exercise always ends with a review of the final diff produced by the migration or by the documentation generation, never with trust placed solely in the success message shown at the end of the task.

Figure 1

From an overview to a documented repository

01
Overview
A broad question about the repository's structure, entry points and dependencies.
02
Targeted questions
Two or three narrower questions, chosen based on the previous answer.
03
First memory file
The /init command reads the repository's actual content and writes or completes a CLAUDE.md.
04
Targeted documentation
A specified output style, applied to the files that are actually undocumented.
05
Diff review
The final result gets reviewed before being accepted, never on the strength of the success message alone.
The sequence starts with a broad question about the repository's structure and ends with a review of the resulting diff, with the generation of a first project memory file in the middle of the journey.
Calibrate it yourself

A developer opens a repository she has just cloned onto her machine. She first asks for a general overview of the structure, then runs /init. Claude Code reads the project's files and writes a first CLAUDE.md that lists the detected build and test commands.

Write, in one sentence, what this situation establishes, and in one sentence what it does not establish.

What to remember
  • A first broad question about the repository's structure shapes the narrower questions that follow, better than starting directly with a single isolated file.
  • The /init command actually reads the repository's content to write a first CLAUDE.md, and if a CLAUDE.md already exists, it proposes improvements rather than overwriting it.
  • Specifying the expected documentation style, JSDoc or docstrings depending on the language, avoids generating a format nobody ends up using.
  • Listing breaking changes before a dependency update remains a way of phrasing the request, not a dedicated command of the product.
  • A final diff gets reviewed before trusting the success message shown at the end of a migration or a documentation generation.
Do this now

Create a demo repository on your machine, add a code file and a dependencies file to it, launch Claude Code inside it and run /init to see the CLAUDE.md it writes from the folder's actual content.

Check the source

Every datable claim in this lesson links here to the public text behind it. A source that does not open proves nothing.