Claude Code is currently the highest-performing AI coding agent available. It holds the number one position on SWE-bench Verified with a score of 80.8%, meaning it can autonomously resolve real-world GitHub issues more reliably than any other tool tested on that benchmark. Unlike GitHub Copilot or Cursor, Claude Code is a terminal-first agent built by Anthropic — it reads your codebase, edits files, runs commands, creates commits, and manages entire multi-file workflows from the command line. And with the native VS Code extension, the full power of that terminal agent now integrates directly into your editor.
I have been using Claude Code daily for several weeks across both personal projects and client work. This guide covers everything you need to set it up in VS Code, the workflows that deliver the most value, and an honest comparison with Copilot, Cursor, and Gemini CLI. If you also use Android Studio, I have written a separate guide on using Claude Code in Android Studio for Kotlin and Flutter projects.
Prerequisites
Before installing Claude Code, make sure the following are in place:
- A Claude subscription or API access. Claude Code requires either a Claude Max subscription ($100/month for the standard tier, $200/month for the higher usage tier) or direct Anthropic API access with billing configured. There is no free tier — this is the main barrier to entry and worth noting upfront.
- Node.js 18 or later. Claude Code is distributed as an npm package and requires a modern Node.js runtime. Run
node --versionin your terminal to check. If you need to install or update, download from nodejs.org or use a version manager like nvm. - VS Code installed and updated. Any recent stable version works. I recommend keeping it on the latest release for the best extension compatibility.
- A terminal you are comfortable with. Claude Code runs in the terminal. VS Code's integrated terminal works perfectly, but familiarity with basic command-line navigation will help you get the most from the tool.
Installing Claude Code
Installation is straightforward through npm. Open your terminal (either VS Code's integrated terminal or an external one) and run:
npm install -g @anthropic-ai/claude-code
This installs Claude Code globally so you can invoke it from any directory. Once installed, navigate to your project folder and run:
claude
The first time you launch it, Claude Code will prompt you to authenticate. If you are using a Claude Max subscription, it will open a browser window for you to sign in with your Anthropic account. If you are using API access, you can set your API key as an environment variable:
export ANTHROPIC_API_KEY=your-api-key-here
To verify the installation worked, run claude --version in your terminal. You should see the current version number. Then run claude inside any project directory — Claude Code will analyse the project structure, read key files, and present you with an interactive prompt where you can start giving it instructions.
If you encounter permission errors during the npm install, avoid using sudo. Instead, configure npm to use a directory you own by running npm config set prefix ~/.npm-global and adding ~/.npm-global/bin to your PATH.
The VS Code Extension
While Claude Code works perfectly from any terminal, the official VS Code extension adds meaningful IDE integration that makes the experience substantially better.
Installing the Extension
- Open VS Code and go to the Extensions panel (Ctrl+Shift+X).
- Search for "Claude Code" and install the official extension by Anthropic.
- After installation, you will see a Claude Code icon in the sidebar. Click it to open the agent panel.
- The extension uses your existing Claude Code CLI installation, so make sure the CLI is already installed and authenticated before using the extension.
What the Extension Adds
The extension provides three main enhancements over using Claude Code in a plain terminal:
- Sidebar panel. A dedicated chat-like interface where you can interact with Claude Code without switching to the terminal. You type instructions, Claude Code responds with explanations, code, and file edits — all rendered in a clean, readable format within VS Code.
- Inline diff view. When Claude Code proposes changes to files, the extension shows them as inline diffs directly in the editor. You can review each change, accept it, or reject it — similar to a code review workflow. This is far more convenient than reading file edit proposals in raw terminal output.
- Status bar integration. The status bar shows Claude Code's current state — whether it is thinking, reading files, writing code, or waiting for your input. This gives you visibility into what the agent is doing during longer operations like multi-file refactoring.
The extension does not replace the terminal experience — it wraps it. Under the hood, the same CLI agent is running. The extension simply provides a better visual interface for reviewing changes and tracking progress.
Terminal Workflows in VS Code
Even with the extension installed, the integrated terminal remains a powerful way to use Claude Code, particularly for developers who prefer keyboard-driven workflows.
Launching from the Integrated Terminal
Open VS Code's integrated terminal (Ctrl+`) and run claude. Claude Code will automatically detect that it is running inside a VS Code workspace and will use the current workspace root as its project context. It reads your file structure, identifies the language and framework, and is immediately ready to take instructions.
File References and Project Context
One of Claude Code's strongest features is its ability to understand your entire project. When you give it an instruction, it does not just look at the current file — it reads relevant files across the codebase to understand the full context. You can also explicitly reference files in your prompts:
claude "Refactor the authentication logic in src/auth/login.ts to use the new session manager from src/services/session.ts"
Claude Code will read both files (and any related imports) before making changes. This cross-file awareness is what separates it from simpler AI coding tools that only see the active file or a manually selected context.
One-Shot Commands
For quick tasks, you can pass instructions directly without entering the interactive session:
claude "Add proper error handling to all the API route handlers in src/routes/"
claude "Write a comprehensive README for this project"
claude "Find and fix the bug causing the test in tests/auth.test.ts to fail"
Each of these runs Claude Code, performs the task, and exits. This is particularly useful for scripting and automation — you can integrate Claude Code into pre-commit hooks, CI pipelines, or custom build scripts.
Practical Coding Workflows
Here are the workflows where Claude Code delivers the most value in day-to-day VS Code development. These are based on my actual usage, not theoretical examples.
Generating Code from Natural Language
Describe what you need and Claude Code writes it. The key difference from Copilot's inline suggestions is that Claude Code generates complete, working implementations — not one line at a time. For example:
claude "Create a REST API endpoint for user registration with email validation, password hashing using bcrypt, duplicate email checking, and proper error responses. Use Express and TypeScript."
Claude Code will create the route handler, add input validation, import the necessary dependencies, and even update your route index file to register the new endpoint. It understands project conventions — if your existing routes follow a certain pattern, the new code will match.
Multi-File Refactoring
This is where Claude Code genuinely excels and where it outperforms every other AI coding tool I have tested. You can say:
claude "Migrate all the class-based React components in src/components/ to functional components with hooks. Preserve all existing behaviour and props interfaces."
Claude Code will read every component, understand the state management and lifecycle methods, convert them to useState and useEffect hooks, update the imports, and preserve the TypeScript types. It processes files sequentially, showing you diffs for each one. A task that would take a developer hours is completed in minutes with high accuracy.
Writing Tests
Test generation is another strong use case:
claude "Write unit tests for the UserService class in src/services/user.service.ts. Use Jest with proper mocking of the database layer. Cover happy paths, error cases, and edge cases."
Claude Code reads the service file, understands its dependencies, creates a test file with properly mocked dependencies, and writes tests that cover the main execution paths. The test quality is notably good — it generates meaningful assertions rather than trivial ones, and it properly handles async operations. I do find that it occasionally misses some obscure edge cases, but the starting point it provides saves significant time.
Fixing Bugs
Paste an error message or describe the symptom, and Claude Code will investigate:
claude "The /api/users endpoint returns a 500 error when the email field contains a plus sign. Find the bug and fix it."
Claude Code reads the relevant route handler, traces the email validation logic, identifies the regex pattern that incorrectly rejects plus signs, and proposes a fix. For more complex bugs, it may read multiple files to trace the issue through several layers of the application.
Explaining Codebases
When joining a new project or working with unfamiliar code, Claude Code is invaluable:
claude "Explain the architecture of this project. What are the main modules, how do they interact, and what patterns are used?"
It reads the project structure, key configuration files, and representative source files, then produces a clear architectural overview. This is something no other AI coding tool does as well, because Claude Code reads significantly more of the codebase than tools that rely on small context windows.
Creating Pull Requests
Claude Code can handle the entire PR workflow:
claude "Create a PR for the changes on this branch. Write a clear description summarising what was changed and why."
It runs git commands to understand the diff, writes a descriptive PR title and body, and creates the pull request using the GitHub CLI. You can even ask it to create the branch, make the changes, commit them, and open the PR — all in one conversation.
Configuration
Claude Code's behaviour is highly configurable. The primary mechanism is the CLAUDE.md file.
CLAUDE.md Project Files
Create a CLAUDE.md file in your project root to give Claude Code persistent instructions about your project. This file is read automatically every time Claude Code starts in that directory. Example:
# Project Context
This is a Next.js 14 application using the App Router, TypeScript, and Prisma ORM.
# Coding Standards
- Use functional components with hooks exclusively
- All functions must have explicit TypeScript return types
- Use named exports, not default exports
- Error handling: use custom AppError class from src/lib/errors.ts
- Tests: Jest with React Testing Library, minimum 80% coverage
# Important Notes
- The database schema is in prisma/schema.prisma
- Environment variables are documented in .env.example
- Do not modify files in src/generated/ — these are auto-generated
Claude Code reads this file and follows these instructions in every interaction. You can also place CLAUDE.md files in subdirectories for context specific to those parts of the codebase.
Memory and Custom Instructions
Beyond project-level CLAUDE.md files, Claude Code supports user-level memory stored in ~/.claude/. This is where personal preferences persist across all projects — things like your preferred code style, commit message format, or testing framework. Claude Code automatically learns and stores these preferences as you work with it, and you can also edit the memory files directly.
Model Selection
Claude Code defaults to the most capable available model (currently Claude Sonnet 4 for most tasks, with Claude Opus 4 available for complex reasoning). You can specify the model explicitly:
claude --model claude-sonnet-4-20250514
For most coding tasks, the default model selection works well. Opus 4 is worth using for complex architectural decisions, large-scale refactoring, or debugging subtle issues where deeper reasoning matters.
Claude Code vs Copilot vs Cursor vs Gemini CLI
This is the comparison most developers are looking for. Here is an honest, side-by-side assessment based on extensive use of all four tools.
| Feature | Claude Code | GitHub Copilot | Cursor | Gemini CLI |
|---|---|---|---|---|
| Approach | Terminal agent + VS Code extension | IDE extension (inline + chat) | Custom IDE (VS Code fork) | Terminal agent |
| SWE-bench score | 80.8% (#1) | Not published | Not published | Not published |
| Inline autocomplete | No | Excellent | Excellent | No |
| Multi-file editing | Excellent — reads and edits across entire codebase | Limited — mostly single file | Good — Composer mode | Good — reads and edits files |
| Autonomy level | High — runs commands, creates PRs, manages git | Low — suggests code, you apply | Medium — edits files with approval | High — runs commands, edits files |
| Project context | Excellent — reads full codebase | Good — indexes workspace | Very good — codebase indexing | Good — reads project files |
| Code quality | Best in class for complex tasks | Very good for completions | Very good | Good |
| Price | $100-200/month (Max) or API usage | $19/month individual | $20/month (Pro) | Free (with Gemini API) |
| Best for | Complex tasks, refactoring, full-stack workflows | Fast inline completions, broad language support | All-in-one AI IDE experience | Budget-conscious terminal users |
The key insight is that these tools serve different workflows. Copilot excels at moment-to-moment inline completions — it makes you type faster. Claude Code excels at larger, more complex tasks — it performs the work of a junior developer on your behalf. Cursor tries to combine both into a single IDE experience. Gemini CLI offers a free terminal agent for developers who want autonomy without the subscription cost.
In practice, I use Claude Code and Copilot together. Copilot handles the inline suggestions as I type, and Claude Code handles the bigger tasks: multi-file refactoring, writing test suites, debugging complex issues, and creating PRs. They complement each other rather than compete.
Advanced Features
Claude Code has several advanced capabilities that become valuable once you are comfortable with the basics.
Hooks
Hooks let you run custom scripts before or after Claude Code performs certain actions. For example, you can configure a hook that runs your linter after every file edit, or one that runs your test suite after Claude Code finishes a refactoring task. Hooks are configured in your project settings and give you automated quality gates around Claude Code's output.
MCP Server Integration
Claude Code supports the Model Context Protocol (MCP), which allows it to connect to external tools and data sources. You can configure MCP servers that give Claude Code access to your database schemas, API documentation, design systems, or internal tools. This dramatically expands what the agent can do — for example, an MCP server for your database lets Claude Code write queries that are accurate to your actual schema rather than guessing based on code alone.
Sub-Agents
For complex tasks, Claude Code can spawn sub-agents — smaller, focused instances that handle specific parts of a larger task. When you ask Claude Code to refactor an entire module, it might create sub-agents to handle individual files in parallel, then coordinate the results. This happens automatically and you do not need to configure anything, but understanding the mechanism helps explain why complex tasks sometimes take longer but produce more thorough results.
Plan Mode
When you prefix a request with /plan, Claude Code enters planning mode. Instead of immediately making changes, it analyses the codebase and produces a detailed plan of what it intends to do — which files it will read, what changes it will make, and in what order. You can review the plan, provide feedback, and then approve execution. This is particularly valuable for high-stakes changes where you want to verify the approach before any files are modified.
Limitations and Honest Assessment
No tool is perfect, and Claude Code has meaningful limitations worth understanding before you commit to the subscription.
Cost
At $100-200 per month for Claude Max, Claude Code is the most expensive AI coding tool on this list. The API usage model can be cheaper for light use but unpredictable for heavy use. If you are a solo developer or student, this is a significant expense. Copilot at $19/month or Gemini CLI for free are more accessible options. Claude Code's pricing makes the most sense for professional developers or teams where the productivity gains justify the cost.
Terminal-Centric UX
Despite the VS Code extension, Claude Code is fundamentally a terminal tool. If you are not comfortable with command-line interfaces, the learning curve is steeper than Copilot or Cursor, which integrate more naturally into the visual IDE workflow. The extension helps, but the experience is still closer to "chatting with a command-line agent" than "AI suggestions appearing as you type."
No Inline Autocomplete
This is the most significant gap. Claude Code does not provide inline tab-completions as you type. It is not designed for that use case — it is designed for larger, instruction-driven tasks. If inline autocomplete is your primary need, you must pair Claude Code with Copilot or use Cursor instead. This is not a flaw in Claude Code's design; it is a deliberate architectural choice that prioritises deep analysis over real-time suggestions.
Token Usage and Session Length
Claude Code consumes tokens as it reads your codebase and generates responses. Large projects with many files can use tokens quickly, especially during initial codebase analysis. On the Max subscription, there are usage limits that reset periodically. On API billing, costs can accumulate during intensive sessions. Being mindful of token usage — giving clear, specific instructions rather than vague ones — helps manage this.
Frequently Asked Questions
Is Claude Code free to use in VS Code?
No. Claude Code requires either a Claude Max subscription ($100/month or $200/month depending on the tier) or Anthropic API access with billing configured. There is no free tier or trial specifically for Claude Code. However, new Anthropic accounts sometimes receive API credits that can be used with Claude Code. If cost is a concern, Gemini CLI offers a free terminal-based AI coding agent, and GitHub Copilot is available at $19/month with a free tier for students and open-source contributors.
Can I use Claude Code and GitHub Copilot together in VS Code?
Yes, and this is actually the setup I recommend for most developers. Copilot handles inline tab-completions — the moment-to-moment suggestions as you type — while Claude Code handles the larger tasks: multi-file refactoring, test generation, debugging complex issues, codebase explanation, and PR creation. They do not conflict with each other. Copilot runs as a standard VS Code extension providing inline suggestions, and Claude Code runs as a separate agent (via the extension sidebar or integrated terminal). The combination gives you both fast inline completions and a powerful autonomous coding agent.
How does Claude Code compare to Cursor for VS Code users?
The fundamental difference is that Cursor is a complete IDE (a fork of VS Code) while Claude Code is an agent that works inside your existing VS Code installation. Cursor provides a more integrated experience with inline completions, chat, and file editing all built into the editor. Claude Code provides deeper codebase analysis, higher autonomy (it can run commands and manage git), and the top SWE-bench score. If you want an all-in-one AI IDE and are willing to switch editors, Cursor is compelling. If you want to stay in VS Code and add the most powerful coding agent available, Claude Code is the better choice. Many developers, myself included, have settled on VS Code with both Copilot and Claude Code rather than switching to Cursor.
Sources and Further Reading
- Claude Code official documentation — Anthropic
- SWE-bench Verified leaderboard
- Claude Code VS Code extension — Visual Studio Marketplace
- Model Context Protocol (MCP) specification
- GitHub Copilot
- Cursor — the AI code editor
Related Posts
- How to Use Claude Code in Android Studio: AI-Powered Coding for Kotlin, Flutter, and Gradle Projects
- How to Use Gemma 4 in VS Code: Setup, Extensions, and Coding Workflows
- Gemma 4 vs ChatGPT vs Claude vs Copilot: Best AI Model Comparison in 2026
Want to use AI tools more effectively?
My courses cover practical AI workflows, from spreadsheet formulas to app development, with real projects and honest tool comparisons.
Browse all courses