General
How to Read an Unfamiliar Codebase Without Faking It
Table of contents
Read the data flow, not the filesAsk for the shape before the detailThe three questions that make an explanation usefulWhere explanation beats documentationKeep secrets out of the pasteA first-week reading order that worksFrequently Asked QuestionsThe first week on an unfamiliar codebase has a predictable shape. You open the repository, see a directory tree with forty folders, click into one at random, and read a file that turns out to be irrelevant. Two hours later you know less than when you started, and standup is in thirty minutes.
The problem is not the size of the code. It is the reading order.
Files are an organizational accident. The data flow is the actual architecture. Before reading any implementation, answer three questions:
What comes in? Find the entry points — HTTP handlers, queue consumers, CLI commands, cron jobs.
What happens to it? Follow one request from entry point to database and back, reading only the functions it touches.
What comes out? Find where output is written: responses, events, files, external API calls.
One traced request teaches more than a week of random file reading, because it gives you the skeleton that every other file attaches to.
When you do open a file, read only its shape first: imports, top-level definitions, exported names, class signatures. Skip every function body on the first pass.
You are building a map, and a map with function bodies in it is not a map. Once you know that
Generic "explain this code" output is usually a restatement of the syntax, which you can already read. What you actually need is narrower:
What is this responsible for, in one sentence, in domain terms rather than code terms?
What would break if this were deleted — who calls it, and what do they assume?
What is surprising here — the workaround, the retry, the comment that says "do not change this"?
The third question is the one that saves you. Every mature codebase has three or four places where the code lies about its intent, and those places are where new engineers break production.
Documentation describes what someone intended. Explanation describes what the code does now. In a codebase more than a year old, those have diverged, and the gap is exactly where you will spend your first month.
Use explanation for the parts with no docs or stale docs: the legacy sync job, the payment retry logic, the module with one author who left. Use documentation for the parts that were written recently enough to be accurate.
The code explainer takes a pasted snippet or function and returns plain-language responsibility, callers, and edge cases — useful when you need the shape of a function in ten seconds rather than twenty minutes.
The obvious hazard of pasting code into any tool is that production code contains credentials. Connection strings with passwords, API keys in config blocks, customer identifiers in fixtures, internal hostnames and tokens in test data.
Before pasting anything, scan it. The security scan checks a snippet for the common credential and injection patterns (CWE-categorized, with severity) so you find the leaked key before it leaves your machine. Then paste only the function you need, with names and values replaced.
Day one: trace one request end to end. Write down every file it touched.
Day two: read the data models. Tables and schemas are the most stable part of any system.
Day three: read the tests. They document intent better than comments, and they tell you what the team was afraid of breaking.
Day four: read the deploy and config files. Most "it works locally" mysteries live here.
Day five: pick one small bug and fix it end to end, including the PR description.
By Friday you will know more about the system than a month of reading would have given you.
It depends on the tool's retention policy, and you should check it rather than assume. The safe pattern is to paste the smallest snippet that answers your question, with identifiers and credentials removed.
Then the code is the spec, and you need to be more careful. Trace the data flow twice — once for the happy path, once for an error — and write down what you observe. That document becomes the missing test suite's outline.
Ask for the map, not the answer. "Which three files would you read first to understand billing?" gets you oriented in one minute. "How does billing work?" gets you a twenty-minute answer you will not retain.
Understanding one subsystem well takes about two weeks. Feeling productive across the whole codebase takes two to three months, and anyone claiming otherwise is describing a smaller system than yours.
The problem is not the size of the code. It is the reading order.
Read the data flow, not the files
Files are an organizational accident. The data flow is the actual architecture. Before reading any implementation, answer three questions:
One traced request teaches more than a week of random file reading, because it gives you the skeleton that every other file attaches to.
Ask for the shape before the detail
When you do open a file, read only its shape first: imports, top-level definitions, exported names, class signatures. Skip every function body on the first pass.
You are building a map, and a map with function bodies in it is not a map. Once you know that
billing/ exports three things and that invoice.py is 900 lines with two public functions, you know where to spend the next hour.The three questions that make an explanation useful
Generic "explain this code" output is usually a restatement of the syntax, which you can already read. What you actually need is narrower:
The third question is the one that saves you. Every mature codebase has three or four places where the code lies about its intent, and those places are where new engineers break production.
Where explanation beats documentation
Documentation describes what someone intended. Explanation describes what the code does now. In a codebase more than a year old, those have diverged, and the gap is exactly where you will spend your first month.
Use explanation for the parts with no docs or stale docs: the legacy sync job, the payment retry logic, the module with one author who left. Use documentation for the parts that were written recently enough to be accurate.
The code explainer takes a pasted snippet or function and returns plain-language responsibility, callers, and edge cases — useful when you need the shape of a function in ten seconds rather than twenty minutes.
Keep secrets out of the paste
The obvious hazard of pasting code into any tool is that production code contains credentials. Connection strings with passwords, API keys in config blocks, customer identifiers in fixtures, internal hostnames and tokens in test data.
Before pasting anything, scan it. The security scan checks a snippet for the common credential and injection patterns (CWE-categorized, with severity) so you find the leaked key before it leaves your machine. Then paste only the function you need, with names and values replaced.
A first-week reading order that works
By Friday you will know more about the system than a month of reading would have given you.
Frequently Asked Questions
Is it safe to paste proprietary code into an AI tool?
It depends on the tool's retention policy, and you should check it rather than assume. The safe pattern is to paste the smallest snippet that answers your question, with identifiers and credentials removed.
What if the codebase has no tests?
Then the code is the spec, and you need to be more careful. Trace the data flow twice — once for the happy path, once for an error — and write down what you observe. That document becomes the missing test suite's outline.
Should I ask a teammate instead of reading?
Ask for the map, not the answer. "Which three files would you read first to understand billing?" gets you oriented in one minute. "How does billing work?" gets you a twenty-minute answer you will not retain.
How long should onboarding take?
Understanding one subsystem well takes about two weeks. Feeling productive across the whole codebase takes two to three months, and anyone claiming otherwise is describing a smaller system than yours.
📌 Prices and tool count in this article may be outdated. Lint now ships 16 tools with Pro at $12/mo, or $60/year. See the current pricing page.
Stop letting Grammarly break your code
17 AI tools built for developers. Code-aware parsing.
Or upgrade to Pro for 500 checks a day · All tools · No ads