

Use Claude Code to Understand an Unfamiliar Codebase in 20 Minutes
Use Claude Code to Understand an Unfamiliar Codebase in 20 Minutes
You just got handed a project you did not write. Maybe it is a new job, a codebase a former coworker left behind, or an open source repo you downloaded to learn from. Dozens or hundreds of files, and nobody is there to explain how it works. This guide shows you how to use Claude Code to get an architecture map, find where a feature lives, and understand confusing code in about 20 minutes instead of spending a whole day digging through files on your own. You need a computer with Node.js installed, the project (already cloned or downloaded), and a Claude account.
What you need
Claude Code is Anthropic's command line tool that lets an AI read directly inside your project folder on your machine. It finds the relevant files itself, reads the code that matters, and answers with the exact file path and line numbers. Unlike pasting snippets into a chat window, Claude Code goes looking for context on its own, so it rarely misses something relevant.
- Install: run
npm install -g @anthropic-ai/claude-codein a terminal (needs Node.js 18 or newer). For the full setup and login flow, see What is Claude Code. - Account: works with a Claude Pro or Max plan (log in with your Claude.ai account, no separate API key needed), or pay per use with an API key if you do not have a plan yet.
- Project: already downloaded as a folder you can open in a terminal. It does not need to run successfully, it just needs to have code in it.
Step by step
Step 1: Open the project in Claude Code
Open a terminal, go into the project's root folder, then type:
cd [path to the project folder]
claude
Claude Code starts right there in that folder. It has not read every file yet, it only reads what you ask about, so this step is nearly instant.
Step 2: Ask for the big picture before any detail
Do not jump straight into details. Your first prompt should ask for an overview:
Read the README and folder structure of this project, then summarize:
what this project does, what languages/technologies it uses, and what
each main folder is responsible for (for example, where the UI lives,
where data processing lives, where config lives). Keep it short and
easy to follow for someone seeing this project for the first time.
Step 3: Trace one specific feature, not a vague question
Instead of asking "explain this code," pick one real feature and ask Claude Code to trace it:
When a user clicks [a specific button or action, e.g. "Sign in"],
which files does the flow pass through, in what order? For each file,
say in one sentence what it does and cite the function name or
relevant line numbers.
Asking about a concrete action means the AI only reads what is actually relevant, and answers with evidence instead of guessing.
Step 4: Ask for a plain-language explanation of confusing code
When you hit a messy function or file, paste its path or the snippet, with a clear ask:
Explain the code in [file path] in plain language, as if you were
talking to someone new to programming. Say clearly: what the input is,
how many steps it processes through, and what the output is. If any
part handles a tricky edge case, explain why it is needed.
Step 5: Ask for a text-based data flow diagram
Draw the data flow for the [feature name] feature as a numbered list
of steps (A calls B, B calls C...), no image needed, just the steps
in the exact order they execute.
Step 6: Save the summary so you do not start from zero next time
Summarize everything explained so far into a short notes file, save it
as [project-name]-notes.md in the project folder, organized into:
overview, main folders, the [feature name] flow, and things to watch
out for when editing code here.
Next time you open the project, read this notes file first, so you never have to ask the same questions again.
Sample result
For a small e-commerce site, after these steps you typically get a summary like this:
This is a web store built with Next.js and a Postgres database. The
app/folder holds the UI pages,lib/holds business logic (pricing, stock checks), andapi/holds the endpoints the browser calls. When a customer clicks "Place order": the browser callsapi/orders/route.ts, which callscreateOrder()inlib/orders.tsto check stock and decrement it, then callslib/payment.tsto create a payment request. Watch out:createOrder()does not automatically restore stock if payment fails, that has to be handled manually around line 42.
A few well-aimed questions get you what would normally take reading dozens of files to piece together.
Tips for better results
- Asking about a specific action (a button, a command, a page) always gives sharper answers than asking it to "explain the whole project."
- Tell Claude Code what you already know: "I already read the README, now I want to understand the payment part" keeps it from repeating what you have already covered.
- If the project has a
CLAUDE.mdfile at its root (or you create one yourself), write the project's own conventions there, naming patterns, file layout rules, coding style. Claude Code reads this file automatically every time it opens, so the longer you use it, the better it matches how your team actually works. - For very large projects, scope your questions to one folder at a time instead of asking about the entire repo at once.
Limits to know
AI can read code, but it does not know the business reasons behind a special rule that lives outside the code. For anything important, payments, security, customer data, always double-check by running the code or asking whoever built it before, never trust a summary completely just because it sounds reasonable. If the project belongs to a company and contains confidential information or real customer data, check your company's policy before feeding any code to an AI tool, even one running locally on your own machine.
FAQ
Does Claude Code need the project to actually run? No. Claude Code only needs to be able to read the files, it does not need the project to run successfully. You can still ask about structure and logic even if you have not finished setting up the runtime environment.
Does using Claude Code cost extra on top of a Pro/Max plan? No, if you already have a Claude Pro or Max plan, using Claude Code counts toward that same usage. If you use it through an API key instead, it is billed by the amount of text (tokens) read and generated, so larger projects cost more per question.
Does company code get sent somewhere? What you ask about gets sent to Anthropic's servers for processing, the same way any AI chatbot works. Always check your company's data policy before using it on a real project, especially one with customer data or unreleased information.
How is this different from just pasting code into ChatGPT? Pasting code into a chat window only shows the AI the snippet you pasted. Claude Code opens the project folder itself and finds other related files you might not even know exist, so it answers more completely when a question touches multiple files.
What about a project written in a less common language? Claude Code can still read and explain it, as long as that language has enough public data for the model to have learned from. For very rare languages or heavily custom in-house code, accuracy can drop, so always double-check the important parts.
Understanding an unfamiliar codebase used to eat a whole day. Now it is just a handful of well-aimed questions. If you are new to programming, also read Using AI to read and fix code as a beginner programmer to learn how to ask AI to find and fix bugs once you understand the project. To understand how working with AI differs when you do not know how to code, read more about what vibe coding is and what an AI agent is.
More articles

Why Japan Is Building Its Own AI Instead of Just Using ChatGPT or Gemini

Use AI to Write Trending Captions Without Losing Your Brand Voice

Use Claude to Write a Freelancer Job Post on Upwork and Fiverr in 15 Minutes

AI Builds Software From a Raw Idea: Inside Cole Medin's "AI Software Factory"

What Is PII Redaction in AI? How Chatbots Mask Your Personal Data

Use Claude to Check and Fix Citations in Your Essay or Report in 15 Minutes