Skip to content
Academy ofAI Learning

~/academy $ claude learn understanding-a-new-codebase

Understand a new codebase fast

Ask Claude Code to explain a repository, map its files, find where something happens and pull exact files into the conversation with @ mentions. 7 min

Step 1 of 6

$ Read

Start broad, then narrow

Open a terminal in the project's root folder and run claude. Begin with the big picture: "give me an overview of this codebase". Then dig into one area at a time.

Ask about the main architecture patterns, the key data models and how sign-in is handled. Ask for a glossary of the project's own terms, and for the conventions a new team member should follow.

You are only reading at this stage, so plan mode is a comfortable place to be: Claude explores freely and cannot change anything.

First question
give me an overview of this codebase
Then narrow
what are the key data models, and where are they defined?
Words
make a glossary of the terms this project uses

Lesson notes: Understand a new codebase fast

Everything in this lesson as text, for revision or to read without the interactive steps. By the end you will be able to: You can get your bearings in an unfamiliar repository in minutes and find the code behind any feature.

  1. Step 1 of 6 · Read

    Start broad, then narrow

    Open a terminal in the project's root folder and run claude. Begin with the big picture: "give me an overview of this codebase". Then dig into one area at a time.

    Ask about the main architecture patterns, the key data models and how sign-in is handled. Ask for a glossary of the project's own terms, and for the conventions a new team member should follow.

    You are only reading at this stage, so plan mode is a comfortable place to be: Claude explores freely and cannot change anything.

    First question
    give me an overview of this codebase
    Then narrow
    what are the key data models, and where are they defined?
    Words
    make a glossary of the terms this project uses
  2. Step 2 of 6 · Try it in the terminal

    Explore without risk

    You have just cloned a repository you know nothing about. Start Claude Code in plan mode from your shell, so it can read everything but change nothing.

    Hint: claude, then the flag that sets the permission mode, then plan.

    Show the command
    $ claude --permission-mode plan
    ⏸ plan mode on (shift+tab to cycle)
    > 
  3. Step 3 of 6 · Read

    Find where something happens

    To find a feature, describe it in the project's own language: "find the files that handle user authentication". Then ask how they fit together, and to trace the flow: "trace the login process from the front end to the database".

    For a big exploration, say "use a subagent to investigate how token refresh works". The helper reads files in its own space and reports back a summary, so your main conversation stays focused.

    If you work in a typed language, a code intelligence plugin gives Claude proper "go to definition" and "find references" navigation instead of searching text.

  4. Step 4 of 6 · Read

    Point at exact files with @

    Type @ and a path to put a file straight into your message: explain the logic in @src/utils/auth.js. Claude gets the contents without having to go and read it. Type @ on its own for a suggestion menu, and press Tab to accept a path.

    Mention a folder, such as @src/components, and you get its file listing, not every file's contents. You can mention several files in one message.

    A mention also pulls in any CLAUDE.md in that file's folder and the folders above it, so local instructions come along automatically.

  5. Step 5 of 6 · Quiz

    Check your understanding

    You type "what is the structure of @src/components?" What does Claude receive from the mention?

    • The full contents of every file in the folder.
    • Nothing until it decides to search.
    • A listing of the files in the folder, not their contents.
    Show the answer

    A listing of the files in the folder, not their contents. Right. Mention a specific file when you want its contents included.

  6. Step 6 of 6 · Sort

    Ask Claude, or ask a colleague?

    Some answers are in the code. Some only exist in people's heads. Sort each question.

    • Where is the payment webhook handled?
    • Why did the team choose this database three years ago?
    • What command runs the tests?
    • Which customers still rely on the old API?
    • How does an order get from the checkout page to the database?
    • How do deploys actually work here?
    Show the answers
    • Where is the payment webhook handled?: Ask Claude. It is in the code. Claude will find it faster than you.
    • Why did the team choose this database three years ago?: Ask a colleague. A decision made in a meeting is not in the repo, unless someone wrote it down.
    • What command runs the tests?: Ask Claude. Claude can find it in the package file or the README.
    • Which customers still rely on the old API?: Ask a colleague. Business knowledge. The code cannot tell you who calls it from outside.
    • How does an order get from the checkout page to the database?: Ask Claude. Tracing a flow through files is exactly what Claude is good at.
    • How do deploys actually work here?: Ask a colleague. Often a process in one person's head. Once you know, write it in CLAUDE.md so Claude knows too.