Skip to Content

How Do You Use the /init Command in Claude Code to Generate a CLAUDE.md File?

What Is the First Command to Run When Starting Claude Code on a New Project?

Learn why running the /init command is the best first step when using Claude Code on a new project, as it automatically scans your codebase to generate a guiding CLAUDE.md file.

Question

You’re starting to use Claude Code on a new project. What should you run first to help Claude understand your codebase?

A. # to add notes
B. /init to scan the project
C. npm install to get dependencies
D. /clear to reset everything

Answer

B. /init to scan the project

Explanation

When launching Claude Code for the first time in a new project, running the /init command is the recommended best practice to help Claude understand your codebase. This command triggers a scan of your project directory and automatically generates a CLAUDE.md file, which serves as a centralized overview containing essential context, coding guidelines, standard commands (like build and test scripts), and high-level architectural details that future Claude instances will reference to operate productively in the repository.