How Do You Ask Questions So Cursor Finds the Right Code?
Match the question to what you know. If you have a name, use it, and Agent will grep for it. If you don't, describe the behavior from start to end, and it will search more broadly. Use Ask mode to explore with no risk of edits, and ask for a subagent when the search will be large.
How does [feature] work? Walk me through the flow from [starting point, such as the checkout form] to [end point, such as the error message the user sees]. Cite the file and line for each step. Tell me which parts you read directly and which you're inferring. If this needs a wide search, use a subagent and return only the findings. Then create a Mermaid diagram of the data flow, including [the services involved].
- Exact symbol, for grep
- One flow, start to end
- Large search, in a subagent
Try it now
- 1Open Agent with Cmd+I (Ctrl+I), and press Shift+Tab until the mode shows Ask, so nothing can be edited.
- 2Send the prompt above for a feature you know well, so you can judge the answer.
- 3Open two of the cited lines yourself. It worked if they say what the explanation claims.
Use it when
Starting in an unfamiliar repo, tracing a bug through layers, preparing for a change, or reviewing code you didn't write. It's also useful for onboarding, where a generated diagram gives a new teammate a map.
Why it works
Cursor's course describes a range from specific to broad. The wording affects which search tool Agent picks first, and how good the results are. An exact symbol gives it a precise grep. A question that walks through a flow, such as from the form to the error message, tells it what to trace. Explore keeps long searches from filling your main chat, since it runs in its own context with a faster model and returns only findings.
Example
Cursor's course uses a payment system. For a targeted search, you might ask it to find everything that imports PaymentService. For a broad one, ask how the app deals with a failed payment, following the error from the checkout form to what the user sees. Then ask for a Mermaid diagram covering the form, the API routes, the payment service and Stripe.
Going further
Diagrams can show problems as well as structure. Cursor's course says they can reveal a service that depends on too many others, or a data flow taking an unexpected path, so read the picture critically. To reuse what you learned, reference the old conversation with @Chats in your next task, or save a good answer as project notes. Agent can also search past conversations on its own when it needs earlier context. To find one yourself in the Agents Window, press Cmd+K and search.
Common mistakes
- Asking in Agent mode and having an exploratory question turn into an edit.
- Asking "how does this work?" without saying what "this" is or where it starts.
- Not asking for citations, so you can't tell reading from guessing.
- Running a huge search in the main thread and filling the context before the real work begins.
Sources
- Understanding your codebase, Cursor Learn
- Ask mode, Cursor Help
- Search, Cursor Docs
- Subagents, Cursor Docs
- Agent mode, Cursor Help
- Finding and fixing bugs, Cursor Learn
- Cursor Agent, Cursor Docs
Checked 6 November 2026. Products change often, so confirm details with the vendor.