Lesson 5 / 12Module 2. Working with Cursor
Academy/Vibe Coding/Lesson 5. Cursor Chat — writing code in dialogue with AI
Beginner15 minutes

Lesson 5. Cursor Chat — writing code in dialogue with AI

Cursor Chat is a full-fledged dialogue with AI about your project. While Tab and Inline Edit are for quick changes, Chat is for complex questions, creating new features, and understanding errors. In this lesson, you will learn how to work with Chat professionally.

Topic breakdown

The Cursor Chat panel is opened via Cmd+L (Mac) or Ctrl+L (Windows). Here, you can have a free-form dialogue with the AI — ask questions, request code, or inquire about errors. The AI sees your project's context and gives relevant answers.

The power of Chat lies in its context. Using the @ symbol, you can add files (@filename), functions (@functionName), and even entire folders (@folder) to the context. The AI reads these files and considers them when answering.

In Chat mode, the AI doesn't just generate code; it also explains it. You can ask: 'What does this code do?', 'What caused this error?' or 'How can I improve this?'. Communicating effectively with the AI is a key vibe coding skill.

To apply the generated code to your project, click the 'Apply' button — Cursor automatically inserts the code into the correct file and location. Or use 'Apply All' to apply all proposed changes at once.

What you'll learn

  • Opening and navigating the Chat panel (Cmd+L, new chat, history)
  • Adding context via @ mentions (@file, @folder, @web)
  • Writing effective prompts to generate new code
  • Requesting explanations for existing code
  • Identifying and fixing errors with AI
  • Applying code to the project using Apply and Apply All

Deep dive

The @ mentions system in Chat is highly powerful. @file adds one file to context. @folder adds a whole folder. @web searches the internet. @codebase includes the whole project. @git fetches git history. @terminal reads terminal output. Using mentions properly boosts AI answer quality by 2-3 times.

Multi-turn conversation in Chat is critical. In the first message, you describe the overall goal, and the AI answers. Then you continue: 'now add X', 'change Y'. The AI remembers the context of previous messages. This iterative approach is the foundation of vibe coding: take one step, see the result, take the next step.

Chat vs Agent mode difference: Chat gives suggestions and you click Apply. Agent opens files, makes changes, and runs terminal commands autonomously. Chat is controlled, Agent is autonomous. For beginners, Chat is safer because you verify every step.

Fixing errors (debugging) is one of Chat's strongest points. Copy an error message from the terminal and send it to Chat — the AI will: 1) explain the error cause, 2) show the solution path, 3) provide ready code. This is 10 times faster than searching on StackOverflow.

Ready prompt template

Copy and adapt
@app.tsx @styles.css I want to change the button style in this component. Currently, the button is plain blue. Make it have a gradient background, add a hover effect, and make it larger on mobile devices. Match the existing design system.

Why it works

Context: '@app.tsx @styles.css' — AI knows exactly which files to read

Current state: 'currently plain blue' — AI understands what to change

New requirements: 'gradient, hover effect, larger on mobile' — 3 specific changes

Compatibility: 'match existing design system' — AI maintains project style

Practice

  • Open your project or a new folder in Cursor
  • Press Cmd+L to open the Chat panel
  • Ask: 'What files are in this project and what do they do?'
  • To create a new file, type: 'Create a navbar.tsx component — logo on the left, menu in the center, button on the right'
  • Click 'Apply' on the AI's response to add the code to the file
  • If an error occurs — copy it from the terminal to the Chat: 'What caused this error and how do I fix it?'

Common mistakes

  • Failing to add context — without @ mentions, the AI doesn't know your project
  • Letting the dialogue get too long — after 10+ messages, it's better to start a new chat (Cmd+N)
  • Clicking Apply blindly — always review the diff (changes)
  • Asking for too much in one message — each message should have one clear goal

Lesson FAQ

Can I save chat history?

Yes, Cursor saves all chat sessions. In the left panel, you can browse history and return to previous dialogues.

Can I send images to Chat?

Yes, you can drag and drop a screenshot or design mockup into Cursor Chat. The AI will analyze the image and generate the corresponding code — for example, a component based on a Figma mockup.

How many tokens does Chat use?

Each message uses 500-5000 tokens depending on the model and context size. On the free plan, 50 premium requests equal about 50 detailed Q&As. This is plenty for standard tasks.

Next step

Cursor Chat Mode: Creating Code in Dialogue with AI | Prompter