AI for Coding

Claude Code — The Complete Guide

Claude Code is Anthropic's terminal-based coding agent. It lives in your command line, reads your entire codebase, and makes changes directly to your files — no IDE required, no copy-pasting from a chat window. As of April 2026 it is tied with the leading commercial coding agents on SWE-bench, works as a VS Code and Cursor extension, and is available to all Claude subscribers.

AI Coding Agent Requires Claude subscription Terminal · VS Code · Cursor macOS · Windows · Linux Last reviewed: April 2026

What is Claude Code?

Claude Code is a coding agent built by Anthropic — the company that makes Claude. Unlike Claude's regular chat interface where you describe a problem and read an answer, Claude Code operates directly inside your development environment. You run it from the terminal, give it a task, and it reads your files, makes changes, runs commands and produces working code — without you touching the keyboard again until it is done.

The simplest way to understand it: Claude Code is Claude with hands. It can see your codebase, open files, edit them, run tests, check the output and keep going until the task is complete. The chat version of Claude writes code you then have to copy somewhere. Claude Code writes code into your actual project.

It was built specifically for developers who want an AI that participates in real engineering work — not just answers questions about it.

What makes Claude Code different

Most AI coding tools are IDE plugins — they add AI features to an editor you already use. Claude Code takes a different approach. It is a terminal agent that works from the command line, which gives it some important properties:

It works in any project, any language, without configuration. Open a terminal in any project folder, run claude, describe what you want. There is no extension to install, no editor to configure, no project to set up. It reads the files that are there.

It can run commands. Claude Code is not limited to editing files. It can run your test suite, execute scripts, install packages, check build output, read error messages and try again. It is an agent with access to your terminal, not just a text editor.

It works while you are doing something else. Scheduled tasks and background agents let Claude Code run jobs on Anthropic's cloud infrastructure even when your computer is off — reviewing PRs overnight, running dependency audits weekly, fixing CI failures automatically.

It also works as a VS Code and Cursor extension. Despite being terminal-native, Claude Code has a full VS Code and Cursor extension that brings inline diffs, plan review and conversation history into the editor. You choose the interface that suits the task.

Who Claude Code is for

Developers who want the most capable coding agent available. On SWE-bench — the standard benchmark for AI coding agents that tests whether the AI can resolve real GitHub issues — Claude Code is at the top of the commercial tool rankings as of April 2026, per Anthropic's official documentation and independent assessments.

Developers who prefer the terminal. If you spend most of your day in the command line, Claude Code feels natural. It does not require you to adopt a new editor or change your workflow.

Developers who want to automate repetitive tasks. Scheduled tasks are Claude Code's most distinctive feature — the ability to set up recurring jobs that run automatically. No other coding tool offers this. Code review every morning, dependency audit every week, CI failure triage overnight.

Teams already using Claude. Claude Code is included with Claude Pro and Max subscriptions. If your team already pays for Claude, you can start using Claude Code today with no additional cost.

What Claude Code is not

Claude Code does not have Tab completion — the instant inline suggestions that appear as you type in Cursor or GitHub Copilot. It is an agent for tasks, not a completion engine for individual lines. If continuous autocomplete is important to your workflow, use Cursor or GitHub Copilot alongside Claude Code rather than instead of it.

Claude Code also requires more intentional use than drag-and-drop tools like Bolt.new or Replit Agent. You describe tasks in plain English but you are working in a real development environment, not a sandbox. Understanding what the agent is doing — reviewing the changes before accepting them — is more important here than in consumer-facing tools.

Why not just use Claude in the chat?

Claude in the browser is excellent for understanding code, planning architecture, reviewing a specific function or generating a standalone snippet. The limitation is context and integration.

When you paste code into the chat, you give Claude a fragment. Claude does not know what the rest of your project looks like. It cannot run your tests. It cannot see the error message your code produced. It cannot make the change and verify it worked. You do all of that manually.

Claude Code reads your entire project. It can run npm test and read what failed. It can make a change, run the tests again, see that something else broke, trace why, and fix that too — without you intervening at each step. The gap between Claude in the chat and Claude Code is the gap between advice and action.

Is Claude Code free?

Claude Code requires a Claude subscription (Pro at $20/month or Max) or an Anthropic Console account with API credits. There is no separate standalone free tier. If you have a Claude Pro subscription, Claude Code is included — install it and start using it immediately.

Students and researchers may be eligible for Anthropic usage grants. The Claude Code documentation at code.claude.com describes available access options.

Getting started in 10 minutes

Step 1 — Install Claude Code

Claude Code requires Node.js. Open your terminal and run:

Install command (npm)
npm install -g @anthropic-ai/claude-code

On macOS you can also use Homebrew: brew install claude-code. On Windows, use the WinGet command: winget install Anthropic.ClaudeCode. Windows also requires Git for Windows to be installed first.

Step 2 — Log in

Navigate to any project folder and run claude. On first use you will be prompted to log in to your Anthropic account. This links Claude Code to your Claude subscription or Console account. After logging in once, you stay authenticated.

Step 3 — Give Claude Code a task

With Claude Code running, describe what you want in plain English. Start with something small and self-contained:

First task — explain the codebase
Explore this codebase and give me a clear overview of how it is structured. What are the main modules? How do they connect? What does the entry point do? Keep it practical — I want to understand the architecture before making changes.

Step 4 — The CLAUDE.md file — do this first

Create a file called CLAUDE.md in the root of your project. This is Claude Code's equivalent of a .cursorrules file — persistent instructions that Claude reads automatically for every session in this project. Even five lines makes a significant difference to output quality.

Starter CLAUDE.md template
# Project context [One paragraph describing what this project is and what it does] # Tech stack Language: [e.g. TypeScript, Python 3.11] Framework: [e.g. Next.js 14, FastAPI] Testing: [e.g. Jest, pytest] Package manager: [e.g. npm, pnpm, poetry] # Conventions - [Naming convention, e.g. camelCase for variables, PascalCase for classes] - [Error handling pattern your codebase uses] - [Any imports or patterns to always use or avoid] # Running the project - Start dev server: [command] - Run tests: [command] - Build: [command]

Step 5 — Try an agent task

Give Claude Code a complete task — something that involves reading multiple files, making changes and verifying the result. This is where its real value shows.

19 prompts for Claude Code

Understanding your codebase

Map the architecture
Read the codebase and create a clear map of the architecture. List the main modules and what each one is responsible for. Show me how data flows between them. Identify any parts that look like they need attention — technical debt, missing error handling, or unclear boundaries between modules.
Find all TODOs and unfinished work
Search the codebase for all TODO comments, FIXME markers, and any functions that throw NotImplementedError or similar. List them all with file and line number. Group them by category: bugs to fix, features to complete, and technical debt to address. Sort by priority based on how critical each area looks.
Understand a specific module
Read all the files in the [module/directory name] module. Explain what it does, how it is designed, and what its interface looks like to the rest of the application. Note anything that looks unusual or that I should be aware of before making changes here.

Building features

Implement a feature from scratch
Implement [feature description]. Before writing code, read the existing codebase to understand the patterns used — how routing works, how the data layer is structured, how errors are handled. Then implement the feature following those same patterns. Write tests alongside the implementation. Run the test suite when done and fix any failures.
Add an API endpoint
Add a [METHOD] endpoint at [/path] that [describe what it should do]. It should: accept [describe input], validate inputs and return clear error messages for invalid data, return [describe output format], handle errors gracefully. Follow the patterns used by the existing endpoints in this API. Add tests for the happy path and the main error cases.
Build a complete component
Build a [component name] component that [describe functionality]. Requirements: [list 4-6 specific requirements]. Look at the existing components in this project to understand the conventions — how props are typed, how state is managed, how styles are applied — and follow the same patterns. Include a basic test that verifies the main functionality.

Fixing bugs

Fix a specific bug
Fix this bug: [describe the bug — what happens, what should happen instead, and how to reproduce it]. Before making any changes, find the root cause by reading the relevant code. Explain what you found. Then fix the root cause rather than the symptom. Add a test that would catch this bug if it regressed. Run the full test suite after fixing to make sure nothing else broke.
Debug a failing test
This test is failing: [paste test name or file]. Run it and read the full error output. Find the root cause — is it a bug in the implementation, an incorrect assumption in the test, or a missing dependency? Fix whichever is wrong. Then run the full test suite to confirm everything passes.
Fix all TypeScript errors
Run the TypeScript compiler and get the full list of type errors. Fix all of them systematically. Start with the errors that are blocking other things. Do not use 'any' as a fix unless there is truly no better option — infer the correct types from how the values are actually used.

Testing

Write tests for a module
Write comprehensive tests for the [module name] module. Run the existing tests first to understand the testing patterns and framework used. Write tests that cover: every public function's happy path, null and undefined inputs, boundary values, and error states. Each test should have a clear name that describes exactly what it verifies. Run the tests when done and fix any failures.
Improve test coverage
Run the test coverage report and find the areas with the lowest coverage. Identify which uncovered paths are the riskiest — places where a bug would be hard to catch without a test. Write tests for the top five riskiest uncovered areas. Focus on tests that would actually catch real bugs, not just lines that touch the code without testing logic.

Refactoring and maintenance

Refactor a module
Refactor the [module name] to [describe the goal — reduce duplication, separate concerns, improve readability, etc.]. Do not change any observable behaviour — all existing tests must still pass after the refactor. Run the tests before you start so you have a baseline. Make changes incrementally and run tests after each meaningful change to catch regressions early.
Update all dependencies
Check for outdated dependencies using the appropriate package manager command. List what is outdated and note which ones have major version bumps that may include breaking changes. Update patch and minor versions first and run the test suite. Then tackle each major version update individually — read the relevant changelog, make the necessary code changes, and verify tests pass before moving to the next one.
Security audit
Perform a security audit of this codebase. Check for: hardcoded secrets or API keys, SQL injection risks in any database queries, missing input validation on user-supplied data, insecure direct object references, missing authentication or authorisation checks on sensitive routes, and any dependencies with known vulnerabilities. Report each finding with severity (Critical / High / Medium / Low), the affected file and line, and the recommended fix.

Scheduled tasks (set up in the CLI with /schedule)

Daily PR review
Every morning at 9am, review all open pull requests in this repository. For each PR: summarise what it changes, check for obvious bugs or missing tests, flag anything that needs attention before merging, and post a comment on the PR with your findings. Keep comments constructive and specific.
Weekly dependency check
Every Monday morning, run a dependency audit on this project. Check for packages with known security vulnerabilities using the appropriate audit command. If any critical or high severity vulnerabilities are found, create a GitHub issue with the details and the recommended fix. Post a summary to [Slack channel / email].

Tips that make a significant difference

CLAUDE.md is the most important file. Claude Code reads it at the start of every session. Five lines of context — language, framework, test command, naming convention — transforms generic output into code that fits your project. Create it before your first real task.

Use --continue to pick up where you left off. Run claude --continue to resume a previous session with full context. This avoids re-reading the codebase and is much faster for multi-session work on the same project.

Use /plan before large tasks. For any task that will touch multiple files, type /plan in the Claude Code session before proceeding. Claude will describe exactly what it intends to do before doing it. Review the plan. If anything looks wrong, correct it before a single file is changed.

Commit before each task. Before giving Claude Code a task that modifies files, commit your current state with git. If the output is not what you wanted, you can reset cleanly. This is the single most important safety habit when using any coding agent.

Use .claudeignore to reduce noise. Create a .claudeignore file in your project root listing directories Claude Code should not read — node_modules, dist, build, .git. Excluding these reduces the tokens Claude uses per session, which reduces cost and improves response speed. A typical .claudeignore reduces session token usage by 50–70%.

Auto mode for routine approvals. By Anthropic's own data, users approve 93% of Claude Code's permission prompts. Auto mode handles safe actions automatically and blocks genuinely risky ones. Enable it for routine work to remove the constant interruptions.

Architecture and technical background

Claude Code is built by Anthropic and uses Anthropic's Claude models. As of April 2026, it runs on Claude Sonnet 4.6 by default with access to Claude Opus 4.6 for tasks requiring the highest reasoning quality. Both models support a one million token context window at standard pricing, documented in Anthropic's official release notes from March 2026.

Claude Code is distributed as an npm package (@anthropic-ai/claude-code) and can also be installed via Homebrew on macOS or WinGet on Windows, per the official documentation at code.claude.com.

How the agent works

Claude Code operates as a loop: receive a task, read relevant files, plan the approach, make changes, run verification commands (tests, builds, linters), read the output, and iterate until the task is complete or it needs input. The loop is driven by Claude's tool use capability — the model calls tools (read file, write file, run command, search codebase) rather than generating passive text.

According to Anthropic's official release notes, Claude Code uses an input-layer prompt injection probe and an output-layer transcript classifier in Auto mode to distinguish safe actions (which run automatically) from risky ones (which are blocked and replaced with safer alternatives).

CLAUDE.md and memory

Claude Code reads CLAUDE.md files hierarchically — a root CLAUDE.md applies to the whole project, and subdirectory CLAUDE.md files provide additional context for specific modules. According to Anthropic's official scientific computing guide, a recommended pattern for multi-day sessions includes a root CLAUDE.md, a CHANGELOG.md as working memory, and test oracles to guide agent verification.

As of March 2026, Claude Code Memory allows Claude to remember project context, debugging patterns and preferred approaches across sessions automatically, per Anthropic's official release notes.

Scheduled tasks

Scheduled tasks, introduced in early 2026, run on Anthropic-managed cloud infrastructure. Each scheduled run starts from a fresh clone of the repository, creates its own session, and produces output you can review and turn into a pull request. Tasks can be created from the Claude web interface, the desktop app or the /schedule command in the CLI. Per the builder.io analysis of March 2026 Claude Code updates, scheduled tasks support recurring jobs including nightly CI triage, weekly dependency audits and daily PR review.

MCP support

Claude Code supports the Model Context Protocol (MCP), allowing it to connect to external tools, databases and APIs. MCP servers can be configured in the project settings and give Claude Code access to resources beyond the local filesystem — Slack, GitHub, databases, internal APIs. Per Anthropic's official Claude platform documentation, MCP Apps support structured content for richer tool outputs.

Computer use (Pro and Max)

As of March 23 2026, Claude Code supports computer use on Pro and Max plans, per Anthropic's official release notes. This gives Claude Code the ability to open files in GUI applications, run visual dev tools, point, click and navigate UI elements — not just operate in the terminal. This is particularly useful for workflows where a process leaves the terminal and enters a browser or desktop application.

VS Code and Cursor extension

The Claude Code VS Code extension, documented at code.claude.com, provides inline diffs, @-mentions, plan review and conversation history inside the editor. It installs in VS Code or Cursor via the Extensions marketplace. The extension brings the same Claude Code agent to an IDE context, allowing developers who prefer a visual interface to use Claude Code without leaving their editor.

SWE-bench performance

SWE-bench is the standard benchmark for AI coding agents, testing whether an agent can resolve real GitHub issues from popular open source repositories. Claude Code's performance on SWE-bench places it among the top commercial coding agents available as of April 2026, per Anthropic's official product claims and independent third-party assessments. The JetBrains January 2026 developer survey found Claude Code tied with Cursor for second place in professional developer adoption at 18% usage at work, behind GitHub Copilot at 29%.

Official sources

Primary sources cited in this guide