CONCEPT VS Code & JetBrains put Claude Code inside the editor
Claude Code ships two first-party IDE integrations. Both give Claude editor-aware context and native diffs; they differ in how they're packaged.
| VS Code extension | JetBrains plugin | |
|---|---|---|
| Where | VS Code 1.98+, Cursor, and forks (via Open VSX). Extension id anthropic.claude-code | IntelliJ IDEA, PyCharm, WebStorm, PhpStorm, GoLand, Android Studio |
| CLI needed? | Bundles its own CLI for the panel; standalone install needed to run claude in the terminal | Runs claude in the integrated terminal — install the CLI separately |
| Quick launch | Spark icon / Command Palette; Cmd+Esc (Mac) / Ctrl+Esc toggles focus | Cmd+Esc / Ctrl+Esc |
| Insert @-mention | Option+K (Mac) / Alt+K → @file.ts#5-10 | Cmd+Option+K / Alt+Ctrl+K → @src/auth.ts#L1-99 |
Shared feature set that makes the IDE version more than a terminal:
- Diff viewing — edits show as a side-by-side diff in the IDE's native viewer; you accept, reject, or edit before applying;
- Selection context — your current selection / active file is shared automatically;
- Diagnostic sharing — lint and syntax errors from the IDE flow to Claude as you work.
Read deny rules: add a deny
rule for a sensitive path (e.g. .env) and neither its selected text nor the open-file notice reaches
Claude. From an external terminal, run /ide to connect Claude Code to the running IDE.CONCEPT The Agent SDK: Claude Code as a library
Beyond editors, you can build on top of Claude Code with the Claude Agent SDK (formerly the Claude Code SDK). It exposes the same tools, agent loop, and context management that power the CLI, programmable in two languages:
| Language | Package | Entry point |
|---|---|---|
| TypeScript | @anthropic-ai/claude-agent-sdk (npm) | query(...) |
| Python | claude-agent-sdk (pip, Python 3.10+) | query(...) |
The same claude -p headless mode (8.1) is the SDK via the CLI; the packages add
structured outputs, tool-approval callbacks, hooks, subagents, and native message objects for full programmatic
control. Reach for the SDK to build custom agents, CI/CD automation, and production apps; reach for the CLI for
interactive and one-off work.
DIAGRAM One engine, many surfaces
tools · agent loop · context mgmt"] --> CLI["Interactive CLI"] ENGINE --> HL["Headless: claude -p (8.1)"] ENGINE --> IDE["IDE extensions"] ENGINE --> SDK["Agent SDK (library)"] IDE --> VSC["🔵 VS Code / Cursor
anthropic.claude-code"] IDE --> JB["🟠 JetBrains
IntelliJ · PyCharm · GoLand…"] SDK --> TS["🟢 @anthropic-ai/claude-agent-sdk (TS)"] SDK --> PY["🟢 claude-agent-sdk (Python 3.10+)"] HL -.->|"same loop, exposed via CLI"| SDK classDef info fill:#cfe2ff,stroke:#0d6efd,color:#084298; classDef warn fill:#ffe8cc,stroke:#ff9f40,color:#9a4a0a; classDef ok fill:#d4edda,stroke:#28a745,color:#155724; class VSC info; class JB warn; class TS ok; class PY ok;
CODE Connecting an IDE, and a minimal SDK agent
Top: connect an external terminal session to the IDE and add an MCP server from within VS Code. Bottom: the
Agent SDK's query() in both languages.
# From an external terminal, connect Claude Code to your running IDE claude # then inside the session: /ide # Add an MCP server from VS Code's integrated terminal (managed later with /mcp) claude mcp add --transport http github https://api.githubcopilot.com/mcp/ \ --header "Authorization: Bearer YOUR_GITHUB_PAT"
# Python — claude-agent-sdk (pip install claude-agent-sdk) import asyncio from claude_agent_sdk import query, ClaudeAgentOptions async def main(): async for message in query( prompt="Find and fix the bug in auth.py", options=ClaudeAgentOptions(allowed_tools=["Read", "Edit", "Bash"]), ): print(message) asyncio.run(main())
// TypeScript — npm install @anthropic-ai/claude-agent-sdk import { query } from "@anthropic-ai/claude-agent-sdk"; for await (const message of query({ prompt: "Find and fix the bug in auth.ts", options: { allowedTools: ["Read", "Edit", "Bash"] } })) { console.log(message); }
TRADE-OFFS IDE extension vs. Agent SDK
✅ IDE extension
- Native diffs, selection & diagnostic context for free
- Human-in-the-loop: review edits before they apply
- Best for day-to-day interactive development
✅ Agent SDK
- Programmatic — build custom agents & automation
- Same engine, callable from TS or Python
- Best for CI/CD and production, not interactive coding
EXAM TRAPS
claude on your PATH." → It
bundles a private CLI copy for the panel only. To run claude in the terminal (for
claude mcp add, claude --resume, etc.) you still need the standalone CLI install.claude
command in the IDE's integrated terminal, so you must install the CLI too. VS Code bundles one; JetBrains does
not.@anthropic-ai/claude-agent-sdk (npm) and claude-agent-sdk (pip, Python 3.10+), both
entering through query().Read
deny rule for a path blocks both its selected text and the open-file notice from reaching Claude.PRACTICE
Q1 · You installed the VS Code extension but claude mcp add fails in the terminal. Why?
The extension bundles a private CLI for its chat panel but doesn't add claude to your
PATH. Install the standalone CLI, after which terminal commands like claude mcp add and
claude --resume work in any terminal.
Q2 · Name the Agent SDK packages and the function you call to run an agent.
TypeScript: @anthropic-ai/claude-agent-sdk (npm). Python:
claude-agent-sdk (pip, Python 3.10+). Both drive the agent with query(...), passing a
prompt and options (e.g. allowedTools). It was formerly the Claude Code SDK.
Q3 · You're in an external terminal, not the IDE's. How do you get diffs to show in the IDE?
Run /ide inside the Claude Code session to connect it to the running IDE; that
activates native diff viewing, selection context, and diagnostic sharing. (In JetBrains you can also set the diff
tool to auto via /config.)