Claude Code in VS Code: Tasks, Terminals and Tracking

The Claude Code extension gives you a chat panel with diffs, @-mentions and checkpoints; the CLI in the integrated terminal gives you everything else. How to use both, how to turn repeat jobs into VS Code tasks, and how to keep track of work across sessions.

6 min read

There are two ways to run Claude Code in VS Code, and most people end up using both. The extension opens a graphical panel where you prompt, @-mention files, review proposed edits as diffs and rewind with checkpoints. The CLI runs in VS Code’s integrated terminal and has the full command set. They share conversation history, so you can move a session from one to the other. For jobs you repeat, a VS Code task in tasks.json runs Claude with the same prompt and the same permissions every time. And because session history lives on one machine, the record of what each session did belongs somewhere else: on the task it was for.

Install the extension and open the panel

Anthropic’s VS Code page (opens in a new tab) lists the requirements as VS Code 1.94 or later and a Claude account. Press Ctrl+Shift+X (Cmd+Shift+X on a Mac), search for “Claude Code” and install it. Open a file and click the Spark icon in the editor toolbar, top right; the first time, sign in through your browser.

The panel can sit in the secondary sidebar, the primary sidebar or as an editor tab; drag it where you want it. Ctrl+Esc (Cmd+Esc) moves focus between the editor and Claude’s prompt box, which is the shortcut you will use most.

Giving it context: selections and @-mentions

  • Claude sees the text you have selected, and which file is open, without being told. The footer of the prompt box shows how many lines are selected.
  • Alt+K (Option+K) inserts a reference to the current file and selection, such as @app.ts#5-10, so the question is pinned to exact lines.
  • Type @ and part of a name to mention a file or folder; matching is fuzzy, so @auth finds AuthService.ts. End a folder with a slash.
  • @terminal:name brings in the output of a terminal by its title, so Claude can read a failing build without you pasting it.

The extension also withholds some files: selected text from a file matching your files.exclude or search.exclude settings, or ignored by git, is not sent. That filter covers the chat panel only; the CLI in a terminal sends what you select.

Reviewing what it changes

What you see when Claude edits depends on the permission mode shown under the prompt box. In Manual mode, each edit opens as a side-by-side diff with a permission prompt: accept it, reject it, or tell Claude what to do instead. You can edit the proposed text in the diff before accepting, and Claude is told you changed it. Under each change are buttons to accept or reject that change alone. In Auto or Edit automatically mode, Claude edits most files without asking, so the review happens afterwards.

Plan mode is the other review point: Claude describes what it will do and waits, and VS Code opens the plan as a Markdown document you can comment on inline before any file changes. How plan mode works, and how to put an approved plan on cards, is in Claude Code plan mode.

Undoing it: checkpoints

The extension tracks Claude’s file edits as checkpoints (opens in a new tab). Hover over any message and the rewind button offers three choices: fork the conversation from there and keep the code, rewind the code to there and keep the conversation, or both. Checkpoints cover Claude’s own file edits, not everything; a file changed by a shell command is not restored. The limits, and when to stop rather than rewind, are in how to stop a Claude Code task.

The extension or the CLI in the terminal?

Use the panel for conversations about code you are looking at. Open the integrated terminal and run claude when you need what only the CLI has:

  • The full set of commands and skills. The panel offers a subset; type / to see which.
  • The ! shortcut for running a shell command yourself, and tab completion.
  • Flags: claude --worktree for a separate checkout, claude -p for a one-shot run, claude --resume to pick up any earlier conversation, including one started in the panel.

One snag catches people. Installing the extension does not put claude on your PATH; it bundles a private copy for the panel. To use the terminal, install the standalone CLI once. The CLI then connects to VS Code for diff viewing and diagnostics on its own; from a terminal outside VS Code, run /ide to connect it. If you prefer the terminal look everywhere, the Use Terminal setting makes the extension open in terminal mode instead of the panel.

Several conversations at once

Ctrl+Shift+Esc (Cmd+Shift+Esc) opens a new conversation as an editor tab, each with its own history and context. A dot on a tab’s Spark icon tells you which needs you: blue for a pending permission request, orange for one that finished while hidden. The sessions list in the Activity Bar lets you rename sessions and collect them into groups. Two conversations in one checkout still edit the same files, though; for real parallel work, give each its own worktree, as described in running Claude Code tasks in parallel.

Repeatable runs with tasks.json

Some prompts you run every day: review my diff before I commit, explain the last test failure. A VS Code task (opens in a new tab) turns one into a menu item with a fixed prompt and a fixed tool list, so the run does the same thing whoever starts it. Tasks live in .vscode/tasks.json and run from the Command Palette with Tasks: Run Task. They call the CLI, so they need the standalone install.

.vscode/tasks.json
{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Claude: review my diff",
      "type": "shell",
      "command": "git diff | claude -p 'Review this diff. List likely bugs as file:line and one sentence each. Change nothing.'",
      "presentation": { "reveal": "always", "panel": "dedicated" },
      "problemMatcher": []
    },
    {
      "label": "Claude: record work on a card",
      "type": "shell",
      "command": "claude -p 'Comment on ${input:ref} what changed in the last commit and how it was tested. Start with \"vscode:\".' --allowedTools 'Bash(git log *),Bash(git show *),mcp__fenbs__fenbs_get_item,mcp__fenbs__fenbs_comment'",
      "problemMatcher": []
    }
  ],
  "inputs": [
    { "id": "ref", "type": "promptString", "description": "Card ref, e.g. BUG-042" }
  ]
}

The first task pipes the diff in, so Claude needs no tools to read it. The second asks for a card ref through an input variable (opens in a new tab), ${input:ref}, and allows exactly the git reads and board calls the job needs; nothing else runs, because a -p run has nobody to approve a prompt. Commit the file and everyone who opens the repository gets the same two entries. The permissions side of unattended runs is covered in how to automate Claude Code tasks.

Keeping track of work across sessions

Session history in the panel is searchable, and sessions left alone for 14 days are archived automatically. It is still a list of conversations on one machine, titled by their first message. It will not tell a colleague, or you next week, which piece of work a session was for, whether it finished, or what was tested.

That record belongs on the task. Connect a fenbs board once, with /mcp in the panel or claude mcp add in the terminal; both save to the same configuration. Then:

  1. Start each conversation from a card: “Work on BUG-042 from the board.” Rename the session tab to the ref, so the sessions list and the board carry the same label.
  2. Have Claude comment on the card when it starts, and again when it finishes or stops: what changed, the commit, and how it was checked.
  3. Move the card to Completed yourself, or let Claude do it only when its checks pass. The board’s History then shows each change as Claude acting for you.

Put those lines in CLAUDE.md, which the panel and the CLI both read, and the rhythm holds in either; a task-tracking workflow for Claude Code has the exact wording. If you also use Copilot in the same editor, its servers are configured separately, in .vscode/mcp.json; see connecting GitHub Copilot.

Related

Connect the board: Claude Code integration and the MCP docs. A board laid out for a day of assistant work: the AI assistant work log template. How the two assistants compare: Claude Code vs GitHub Copilot.

Questions people ask.

How do I install Claude Code in VS Code?

Open the Extensions view with Ctrl+Shift+X (Cmd+Shift+X on a Mac), search for Claude Code and install it. It needs VS Code 1.94 or later. Open a file, click the Spark icon at the top right of the editor, and sign in through your browser.

Why does the claude command not work in the VS Code terminal?

The extension bundles its own private copy of Claude Code for the panel and does not add claude to your PATH. Install the standalone CLI once, then claude works in the integrated terminal and any other.

Can I move a conversation between the extension and the terminal?

Yes. They share conversation history. Run claude --resume in the terminal and pick the conversation you started in the panel, or open it from Session history in the panel.

Can I run Claude Code as a VS Code task?

Yes. Add a shell task to .vscode/tasks.json whose command is a claude -p run with a fixed prompt and an --allowedTools list, then run it with Tasks: Run Task. Use an input variable to ask for a card ref or a file name each time.

Start with one thing.

There is nothing to set up first. Write one line and you’ve started.