Steve Kinney

Interacting with Cursor's AI Features

Cursor AI is an AI-powered code editor built on the VS Code foundation, designed to act as an AI pair programmer by integrating directly into your coding environment and understanding your entire codebase contextually. It aims to make coding smarter, faster, and safer.

To effectively leverage Cursor, it’s essential to understand its core AI interaction modes: Tab completions, Inline Edit (Cmd/Ctrl+K), and AI Chat (Cmd/Ctrl+L), as well as the more advanced Agent mode (Cmd/Ctrl+I). Each is best suited for different use cases and types of interactions.

Here’s a guide to understanding and utilizing each:

Tab (Predictive Autocomplete and Smart Rewrites)

Cursor’s Tab feature is an advanced, predictive autocomplete system. It goes beyond single-word suggestions, offering multi-line edits and automatically correcting minor errors or typos (known as “smart rewrites”). This feature is powered by custom models that anticipate the developer’s intent based on recent changes and surrounding code context. Users often describe it as “magic” due to its uncanny ability to predict their next steps, significantly contributing to a “flow state” in coding.

How to Best Take Advantage

  • Accept Multi-line Suggestions: While typing, observe the grayed-out text suggestions. Hitting Tab will accept these multi-line proposals, allowing you to quickly complete functions, loops, or entire code blocks.
  • Trust Smart Rewrites: Allow Cursor to automatically correct typos and minor errors, enabling you to type more freely without sacrificing accuracy.

Best Use Cases

  • Boilerplate Code: Quickly generating standard project structures, configuration files, or common patterns.
  • Repetitive Tasks: Completing common coding patterns like React hooks, SQL queries, or test stubs.
  • Maintaining Flow: It’s ideal for day-to-day coding to accelerate typing and minimize interruptions, helping you code at the “speed of thought”.

Inline Edit (Cmd/Ctrl+K)

The Cmd/Ctrl+K shortcut is a primary tool for “surgical, in-place code modifications”. It offers two distinct functions depending on whether code is selected. The proposed changes are displayed as a clear, color-coded diff view (red for deletions, green for additions) before you accept them, giving you full control. It is generally faster for working with selected code compared to the Agent mode.

How to Best Take Advantage

  • Generate New Code (no selection): When no code is selected, pressing Cmd/Ctrl+K opens a prompt to generate entirely new code. Describe the desired function, class, or HTML structure in natural language. Provide boilerplate or constraints like naming conventions or return types in the prompt.
  • Edit/Refactor Existing Code (with selection): Select a specific block of code and press Cmd/Ctrl+K to issue instructions for editing or refactoring that snippet.
  • Review Diffs Carefully: Always review the diff preview before applying changes, as the AI might add or modify more than expected.
  • Iterative Refinement: If the initial output isn’t perfect, refine your prompt with more details or chain prompts (e.g., generate code, then ask to “rewrite this using concurrency primitives”).

Best Use Cases

  • Targeted Modifications: Converting a function to be asynchronous, adding error handling, or translating code to another language.
  • Refactoring Specific Snippets: Improving the structure or efficiency of a small code block.
  • Quick Code Generation: Creating new, self-contained code blocks or functions from a natural language description.

AI Chat (Cmd/Ctrl+L) and Agent Mode (Cmd/Ctrl+I)

The Cmd/Ctrl+L command opens the main AI chat panel, which functions as a “project-aware collaborator”. This interface can access the context of currently open files and be instructed to consider the entire codebase. As of late February 2025, Agent mode often becomes the default chat mode.

Agent Mode (Cmd/Ctrl+I) is designed for complex, multi-file tasks where you describe a high-level goal, and the AI plans and executes the necessary changes across the entire project. It allows for “agentic” or “autonomous” execution, where the AI can create/modify files, run terminal commands, and perform semantic code searches. By default, the agent will ask for user approval before executing commands, keeping you in control.

How to Best Take Advantage

  • Leverage Codebase Context: By default, the chat is aware of the current file. For broader questions, use the “Codebase” button or type @codebase to include the entire repository’s semantic index in the context. This dramatically improves accuracy for architecture-level questions.
  • Surgical Context Provisioning: Use the @ symbol to precisely provide context:
    • @Files and @Folders: Reference specific files (e.g., @src/components/Button.tsx) or entire directories (e.g., @src/api/v1).
    • @Code and @Symbols: Focus on specific functions, classes, or variables (e.g., @useUserData hook).
    • @Docs and @Web: Extend the AI’s knowledge beyond local code by referencing external documentation or performing live web searches. You can even add your own documentation by URL for Cursor to index.
    • @Git, @Linter Errors, @Past Chats: Provide specific context like commit history, diffs, linter errors, or previous conversations.
  • Define Project-Wide Rules with .cursor/rules: Create a .cursor/rules.mdc file at your project’s root to define consistent code style, language preferences, and quality guidelines that Cursor will always follow. Global rules can also be set in Cursor settings.
  • Utilize Notepads: Create “supercharged sticky notes” to store frequently used prompts, file references, and explanations. These can be referenced using @MyNotepad to include their content, streamlining repetitive workflows.
  • Break Down Problems (Plan-and-Act): For complex tasks, ask the AI to first provide a step-by-step plan and reasoning, then instruct it to execute the plan after your review. This helps avoid flawed strategies.
  • Iterative Refinement: Treat interactions as a dialogue. Start broad, then refine prompts based on the AI’s output, providing specific feedback.

Best Use Cases

  • Brainstorming and High-Level Questions: Discussing architecture, understanding complex codebases, or exploring solutions.
  • Larger Code Generation: Generating more complex code segments that can then be applied directly to the editor.
  • Multi-File Refactoring: Tasks like renaming variables across the entire project, moving logic, or performing semantic search-and-edit operations.
  • Feature Implementation: Delegating tasks like building a new user registration page or adding an API endpoint, where the agent needs to create and modify multiple files.
  • Debugging: Analyzing error messages, stack traces, suggesting fixes, and even instrumenting code with logs.
  • Test-Driven Development (TDD): Instructing the AI to write tests first, then the code, and iteratively fix until tests pass.
  • Automated Linting Fixes: With “Iterate on Lints” enabled, the agent can automatically run linters and attempt to fix violations.
  • Git Integration: Generating descriptive Git commit messages based on staged changes, or assisting with code reviews by reviewing pending changes.

Comparison and Best Practices

Cursor’s AI features are designed to allow you to shift from typing every line of code to directing the AI, much like a project manager directs a team.

  • Tab (Autocomplete) is your fast, always-on assistant for micro-level completion and error correction, speeding up your typing without explicit prompting.
  • Inline Edit (Cmd/Ctrl+K) is your precision tool for targeted code generation, modification, or refactoring within a selected area or current file. It’s direct and provides immediate visual feedback.
  • AI Chat (Cmd/Ctrl+L) and Agent Mode (Cmd/Ctrl+I) serve as your collaborative partner and project orchestrator. They are for broader conversations, understanding complex codebases, and delegating multi-step, multi-file tasks across the entire project. While Cmd+L opens the conversational interface, Cmd+I is explicitly for initiating agentic tasks where the AI can plan and execute.

General Best Practices across All Modes

  • Review All AI-Generated Code: Never blindly trust AI. Always review the diffs before committing changes.
  • Use Version Control: Experiment in branches and commit early and often. Cursor’s tight Git integration can even generate commit messages for you.
  • Prompt in Small Chunks: Avoid overwhelming the AI with vague or massive prompts. Break down large requests into smaller, verifiable steps.
  • Manage Context: Keep conversation history short and focused, restarting if the AI gets stuck in a loop. Leverage @ symbols and .cursor/rules to provide the most precise context.

Last modified on .