Saltar al contenido

Lección 6 · Chat and Codebase Context

Ask Mode and Codebase Questions

Use Cursor Ask mode to explore an unfamiliar codebase without edits, ask questions that demand evidence, and check the answers against the real files.

Joining a project means reading a lot of code you did not write. A chat that can search the codebase shortens that work, as long as you treat its answers as leads to check and not as facts.

Ask mode is built for this. The documentation describes it as read-only: the agent answers questions and explores code without editing it.

Switch to Ask mode

Open the agent panel with Ctrl+I (Cmd+I on a Mac). Press Shift+Tab to rotate through the modes, or use the mode picker. Type your question and press Enter. When your questions turn into changes, switch back to Agent mode.

The modes at a glance

Pick a mode

Ask Read and explain
Plan Design before building
Agent Edit and run
Debug Find root causes

Custom modes come from skills

1 / 2

Questions that work

Broad questions tend to give broad, shallow answers. Better questions name a behavior and ask for evidence.

Goal Question to try
Get oriented "List the main entry points and the five files I should read first."
Follow a flow "Trace what happens from the login form to the database. Name each file and function in order."
Find a rule "Where is the discount limit enforced? Quote the lines."
Assess a change "What would break if I renamed the field user_id? List every place that uses it."
Find gaps "Which behaviors in the checkout module have no test?"

Two sentences make answers much easier to check:

TEXT
For every claim, name the file and function.
If you are not sure, say so instead of guessing.

They do not make the answer correct. They make errors easier to find.

Check the answer

An AI can misread code, miss a second place that does the same job, or describe what a function should do based on its name. Verify with ordinary tools:

  • Open the named file and read the function.
  • Use "go to definition" and "find all references".
  • Search the text with your editor or grep.
  • Run a test or a small experiment.

The stand-in below shows how a quick script can check a claim such as "only one place calls send_email". It scans source text held in a dictionary, so it runs without a real project.

Python Stand-in: verify a claim by searching the code

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The search finds two callers, so the claim is false. A text search has limits too: it misses calls made through another name. Use more than one kind of evidence when the answer matters.

Learn from the code, not just the answer

For code you will maintain, ask for a reading order, then read it yourself. Try explaining a function in your own words:

TEXT
Here is how I understand apply_discount(): it takes the cart,
applies at most one coupon, and never goes below zero.
What did I get wrong? Point to the lines.

This turns the chat into a tutor that reacts to your understanding.

Check a map of the code

You can ask for a diagram of how modules depend on each other. Treat it like any other claim. One way to check Python imports is to read them from the syntax tree with the standard ast module.

Python Find real imports with the ast module

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Compare this with any diagram you are given. A missing or extra arrow is worth investigating. The script does not see dynamic or relative imports in every form.

The documentation also describes side chats, opened with /side or /btw, so you can ask a quick question without cluttering the main conversation. A side chat uses the main thread as reference. You can also search past conversations, which helps when you remember asking something last week.

A routine for a new codebase

When you open an unfamiliar project, work from the outside in:

  1. Purpose and shape. Ask what the project does and which folders matter. Compare the answer with the README.
  2. How to run it. Ask for the build, run and test commands, and which file each one comes from. Check them in the project's configuration before you run them, especially install scripts.
  3. One real path. Choose one user action, such as "create an order", and trace it through the code.
  4. Rules and risks. Ask where input is validated, where permissions are checked and where money or personal data is handled.
  5. Your notes. Write a half-page summary in your own words, listing what you verified and what you have not.

The fifth step matters most. A summary that you did not check yourself can spread mistakes to your whole team, particularly if you paste it into a rule file where the agent will read it as fact.

When an answer surprises you, ask for the opposite evidence: "What in the code would show that this explanation is wrong?" Then go and look for it.

Common mistakes

  • Asking "explain the whole project" once and believing the summary. Drill into the parts you will change.
  • Treating a confident tone as proof.
  • Forgetting that a read-only answer still sends code context to a model. Check your privacy settings.

Check your understanding

Quick check · 3 questions

of 3 answered You scored / 3 · perfect!

  1. 1. What does Ask mode not do?

    Ask mode is documented as read-only.
  2. 2. Which question is easiest to verify?

    It asks for a specific location you can open and read.
  3. 3. How should you treat a confident answer about your code?

    Models can be wrong while sounding sure, so confirm what matters.

Summary

  • Ask mode explores and explains without editing.
  • Ask for files and functions as evidence, and invite "I am not sure".
  • Verify claims with references, search, tests or small scripts.
  • Use side chats for quick detours.

Next: Adding Context with @ Mentions

Tu progreso se guarda en este navegador. No necesitas una cuenta.