How to Use Claude Code in VS Code and Cursor

To use Claude Code in VS Code or Cursor, install the “Claude Code” extension from the Extensions view, then click the Spark icon in the top-right corner of the editor.

Sign in with your Claude account, and you can chat with Claude in a panel next to your code.

You can also run the claude command in the editor’s built-in terminal. Both options share the same conversation history.

This article shows how to set up each option, the shortcuts worth knowing, and how the extension and the terminal version differ.

What you need

  • VS Code 1.94.0 or later, or Cursor
  • A paid Claude plan (Pro, Max, Team, or Enterprise) or a Claude Console account

You don’t need an API key. You sign in with your Claude account the first time you open the extension.

Install the extension

In VS Code, press Cmd+Shift+X on Mac or Ctrl+Shift+X on Windows and Linux to open the Extensions view. Search for Claude Code and click Install.

The steps are the same in Cursor. The extension also installs in other VS Code-based editors like Kiro.

If the extension doesn’t appear after installing, restart the editor or run Developer: Reload Window from the Command Palette.

Open Claude Code

Claude Code is marked with a Spark icon. You can open it from:

  • The editor toolbar: the Spark icon in the top-right corner. It only shows when a file is open
  • The Activity Bar: the Spark icon in the left sidebar opens your list of sessions
  • The Status Bar: click ✻ Claude Code in the bottom-right corner
  • The Command Palette: press Cmd+Shift+P or Ctrl+Shift+P and type “Claude Code”

The first time you open it, click Sign in and finish signing in in your browser.

Ask about your code

Claude automatically sees the text you have selected in the editor. To add a reference to the current file and selection in your prompt, press:

  • Option+K on Mac
  • Alt+K on Windows and Linux

It inserts a reference like @file.ts#5-10, so you can ask about specific lines.

Review Claude’s changes

Check the permission mode at the bottom of the prompt box:

  • Manual mode: Claude shows a side-by-side diff of each change and asks before editing. You can accept, reject, or tell Claude what to do instead
  • Auto or Edit automatically mode: Claude edits most files without asking

In a diff, you can accept or reject each change one at a time.

Useful shortcuts

Shortcut (Mac / Windows and Linux)What it does
Cmd+Esc / Ctrl+EscSwitch focus between the editor and Claude
Cmd+Shift+Esc / Ctrl+Shift+EscOpen a new conversation in a tab
Option+K / Alt+KAdd a reference to the current file and selection
Cmd+Shift+T / Ctrl+Shift+TReopen the last closed Claude tab

Run the Claude Code CLI in VS Code

Some features only work in the terminal version, such as the ! shell shortcut and every slash command. To use it, open the editor’s terminal with Cmd+` or Ctrl+` and run:

claude

Installing the extension doesn’t add the claude command to your terminal. If you get command not found, install the CLI separately. See where Claude Code is installed for the install paths.

When the extension is also installed, the CLI connects to the editor automatically, so you get diff views and error sharing. From a terminal outside the editor, run /ide to connect.

Extension vs CLI

FeatureCLIExtension
Slash commands and skillsAllSome (type / to see them)
MCP serversYesYes
Checkpoints and rewindYesYes
! shell shortcutYesNo
Tab completionYesNo

Both share the same conversation history. To continue an extension conversation in the terminal, run claude --resume and pick it from the list.

Is Claude Code better than Cursor?

They’re different kinds of tools. Cursor is a code editor with built-in AI features, while Claude Code is an agent that runs in your terminal or inside an editor like Cursor. Since the extension installs in Cursor, you can use both together.

Conclusion

Install the Claude Code extension, click the Spark icon, and sign in. When you need a CLI-only feature, run claude in the editor’s terminal. The two share your conversations.