How to Use GitHub Copilot Chat to Understand an Unfamiliar Codebase
Joining a new project or inheriting old code? Here's a practical, question-by-question routine for using Copilot Chat to get oriented fast without trusting it blindly.
Opening a codebase you have never seen before can feel like walking into someone else's kitchen and being asked to cook dinner. Everything is somewhere, but you have no idea where.
GitHub Copilot Chat, available inside editors like VS Code and on GitHub itself, can act as a patient guide while you find your feet. Used well, it shortens the "what even is this?" phase from days to hours. Used carelessly, it can give you a confident tour of a building that doesn't quite match the floor plan.
Here is a routine that keeps you on the right side of that line.
Before you start: give it the right view
Copilot Chat answers questions using context from your editor, such as open files, your current selection and, depending on your setup, a wider index of the workspace. The exact features and commands vary by editor and version, so check the current GitHub Copilot docs for what yours supports.
The practical rule is simple: the more relevant code it can see, the better its answers. Open the repository as a whole folder, not just a single file, and open the files you are asking about.
Round 1: The big picture
Start broad. You want a mental map before you zoom in.
Questions to ask:
- "Give me a high-level overview of this project. What does it do and what are the main parts?"
- "What languages, frameworks and major libraries does this repository use?"
- "Where is the entry point of the application?"
- "How is the folder structure organised, and what lives in each top-level folder?"
Then verify. Open the README, the package or dependency file, and the entry point it named. If those agree with the overview, great. If they don't, trust the files.
Round 2: Follow one real path
Overviews are useful but abstract. The fastest way to understand a system is to trace one real thing through it from start to finish.
Pick something concrete, like "a user logs in" or "an order is created". Then ask:
- "Walk me through what happens in the code when a user submits the login form, file by file."
- "Which function handles this API route, and what does it call next?"
- "Where is the data for this saved, and in what format?"
Open each file it mentions as you go. Set breakpoints or add a temporary log line if you can run the project. Seeing the path execute is worth more than any explanation.
Treat Copilot's answers like directions from a helpful local: usually right, occasionally a street off, and always worth checking against the map.
Round 3: Zoom in on confusing code
Every codebase has a few files that make you squint. Highlight the confusing block and ask:
- "Explain what this function does, step by step, in plain English."
- "Why might this have been written this way instead of the obvious approach?"
- "What are the inputs, outputs and side effects of this code?"
- "What could go wrong here, and are there edge cases it doesn't handle?"
That second question is especially helpful with older code. Copilot can't know the original author's reasons, but it can suggest plausible ones, such as performance workarounds or compatibility with an older library, which gives you something to look into.
Round 4: Learn the house rules
Every team has conventions that aren't written down anywhere obvious. Ask:
- "How are errors handled in this project? Show me a typical example."
- "How are tests organised, and how do I run them?"
- "What naming patterns does this codebase use for files, functions and components?"
- "Is there a pattern for how new API endpoints are added?"
Knowing these before you write your first change saves you from a pile of review comments.
Round 5: Make a tiny first change
Understanding sticks when you change something. Pick a small, safe task, like fixing a typo in a message, adding a log line or writing one missing test, and ask Copilot to help plan it:
- "I want to add a field to this form. Which files would I need to change?"
Compare its list with what you find yourself. Make the change, run the tests and see what breaks. This is where your mental model gets corrected fastest.
Keep notes as you go
Create a scratch file called something like ONBOARDING_NOTES.md and jot down what you learn: key files, the main request flow, surprising decisions, commands that work. At the end of the day, you can even ask Copilot to tidy your notes into a cleaner document.
If your team agrees, that tidied version can become onboarding notes for the next new person.
Watch-outs
- It can describe code that isn't there. If it names a function or file you can't find, search for it. If it doesn't exist, ignore that part.
- It may miss configuration. Behaviour often depends on environment variables, feature flags or config files that aren't obvious from code alone.
- It doesn't know your team's history. Ask a human about why things are the way they are, especially before "cleaning up" something odd.
- Mind what you share. Follow your organisation's rules on which repositories can be used with AI tools.
The takeaway
Copilot Chat is a great guide for a new codebase when you use it in rounds: big picture, one real path, confusing spots, house rules, then a small change. Keep the editor open beside the chat, verify every file it mentions, and write down what you learn. You will be making useful contributions sooner, with a map you actually trust.
Enjoyed this piece?
Get the next one in your inbox, every other Friday.