A productive debugging session using Cursor Chat: you'll diagnose a real bug, understand an unfamiliar function, and get a refactoring suggestion — all through chat without leaving the editor.
How Cursor Chat Works
Open Chat with Cmd+L (Ctrl+L on Windows). A panel opens on the right. The difference from talking to ChatGPT in a browser: Cursor automatically includes context from your open files, selected code, and your project structure.
You can control what context is included using @mentions:
@filename.py → includes a specific file in context
@Folders → includes an entire folder
@Codebase → searches across your whole project
@Docs → include a library's documentation
@Web → search the web and include results
@git → include recent git changesThe @Codebase mention is particularly powerful — Cursor does a semantic search across your project to find relevant code, then includes it in the context window before answering your question.
Effective Questions for Code Understanding
Cursor Chat is most valuable for understanding code you didn't write — inherited codebases, open source libraries you're integrating, or your own code from 6 months ago.
High-value question patterns:
# Understanding
"Explain what this function does and why it was written this way"
"What are all the places where user_id is used?"
"Walk me through what happens when a user logs in"
# Debugging
"I'm getting this error: [paste error]. What's wrong?"
"Why would this return None sometimes?"
"What edge cases am I not handling?"
# Planning
"I want to add rate limiting to the API. Where should I add it?"
"What would break if I changed this function signature?"Debug a Real Bug with Chat
The best way to learn Cursor Chat is with a real debugging session. Find a bug in something you're working on, or create one intentionally for practice.
Debugging workflow with Cursor Chat:
Select the code that's misbehaving. Right-click → "Add to Chat" or press Cmd+L with selection active. This adds the code directly into the chat context.
Paste the error message if there is one: "I'm getting this error when calling this function: [error]. What's wrong?"
If Chat suggests a fix, it'll often include a code block you can apply directly using the Apply button — no copy-paste needed.
Use @git to debug recent regressions. If something broke after a recent commit: "@git What changed recently? Could any of those changes cause [problem]?" Cursor reads your recent diffs and reasons about them.
What You Learned Today
- How Cursor Chat differs from browser-based AI: automatic file context and @mentions
- The @mention system: specific files, whole codebase, docs, web, git history
- High-value question patterns for code understanding, debugging, and planning
- The debugging workflow: add code to chat → paste error → apply fix directly
Go Further on Your Own
- Open an unfamiliar codebase (or an old project you haven't touched in a while). Use @Codebase to ask 5 questions to understand how it works — without reading the code directly first
- Pick a function with a subtle bug or edge case. Walk through it with Chat: what does it do, what could go wrong, fix it.
- Ask Chat to review a recent function you wrote for: security issues, performance problems, and edge cases. What does it find?
Nice work. Keep going.
Day 3 is ready when you are.
Continue to Day 3Want live instruction and hands-on projects? Join the AI bootcamp — 3 days, 5 cities.