Skip to content
mentoor

Topic 5 of 5 · 4 min read

Learning a new framework or codebase

Goal: Use AI to map an unfamiliar codebase or framework and catch a claim that does not match the current docs or code.

Use AI to build a map of an unfamiliar framework or codebase, then check every version-specific claim against the current docs and the code itself.

Check yourself · 1 of 3

What is the best first request when you open an unfamiliar repository with an AI assistant?

Choose one answer

Why it matters

A new codebase has thousands of files and no obvious start. A new framework has its own words and conventions. AI is good at the first pass: summarising folders, tracing a request through the code and explaining a pattern you have not seen. It is also unreliable in exactly the places that matter. Models are trained on older material, so they mix up versions of a framework, describe functions that were renamed or removed, and sometimes invent a function that sounds right. They state all of this in the same confident tone.

How to do it

  1. Start with the shape. Ask for a map: the main folders, the entry point, where the data comes from. In a tool that can read your repository (Claude Code, Cursor, Copilot), point it at the repo. In plain chat, paste the file tree and the key files.
  2. Ask for a trace. "Follow one request from the route to the database. Name each file and function." Then open each named file yourself.
  3. Ask for citations from the code. "For each claim, give the file and line." A claim with no path is a guess.
  4. Check version claims against docs. State your version in the prompt ("Next.js 15", "Django 5.1"). When the AI names an API, search the official docs for that name and version.
  5. Run something small. Add a log, run a test or change a string and see where it shows up.
  6. Write your own map after you finish. A one-page note in your own words is the thing you keep.

Before and after

Before: Explain this project.

You get a generic description that fits a hundred projects.

After: This is a Django 5.1 project. List the apps, then trace what happens when a user posts to /orders/. Give file and function names, and mark anything you are unsure of.

For engineers, a claim to catch. The AI says:

# Claimed by the assistant
from django.utils.encoding import force_text

force_text was removed in Django 4.0 and replaced by force_str. A search of the release notes or a quick run of the import shows the error. The AI described a function from an older version.

What goes wrong

  • Version mixing. The answer is correct for last year's release and wrong for yours.
  • Invented names. The function reads plausibly and does not exist. A grep in the repo or a search in the docs settles it.
  • Trusting a summary of a file the AI never read. In plain chat, the model only knows what you pasted. Ask which files it actually saw.
  • Reading the map but never the code. A map tells you where to go. Understanding comes from reading the files yourself.

Examples

A map prompt that demands evidence

Prompt: I am new to this repo (Express 4, Node 22). Give me the folders, the entry file and how a GET /users request reaches the database. For each step name the file and function. Put a question mark next to anything you did not see in the files I pasted.

You can now open each file and check the chain.

Catching an invented API

The AI tells you to call router.addGuard() in your framework. Run a search for addGuard in the repo and in the docs. No match means the name was made up or belongs to another framework. Ask the AI where it found it.

Key points

  • AI is good for a first map of a codebase and unreliable on version-specific details.
  • Ask for a trace through real files and open each named file yourself.
  • Ask for file and line evidence, because a claim with no path is a guess.
  • State your framework version in the prompt and confirm every API name in the official docs.
  • End by writing your own one-page map in your own words.

Common mistakes

  • Not stating the framework version, so the answer comes from a different release.
  • Accepting an API name without searching the docs or the repo for it.
  • Assuming the AI read the whole repository when it only saw what you pasted.
  • Reading the AI's map but not opening the files it names.

Check yourself · 2 of 3

An AI names a function that you cannot find in your framework's docs. What do you do first?

Choose one answer

Check yourself · 3 of 3

Why should you state the framework version in a prompt such as "Django 5.1"?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic