How to Use Claude Code: A Step-by-Step Beginner’s Guide (2026)

Young woman at a laptop with a friendly robot assistant pointing at a floating code panel

To use Claude Code, install it with one command, open a terminal in your project folder, type claude and sign in with a paid Claude plan (Pro, Max, Team or Enterprise) or a Claude Console account. Then describe what you want in plain English: Claude reads your files, makes or proposes the changes and runs commands, while you review, steer or rewind as it works.

This guide takes you through it in order: which plan you need, the install command for your system, your first session, the CLAUDE.md file that gives Claude a memory, the permission modes that decide what Claude can do without asking, plan mode, the commands worth learning first, safety, cost control and fixes for the most common problems. Every command and setting below was checked against Anthropic’s own Claude Code documentation.

Claude Code at a glance

What it isAnthropic’s agentic coding tool: it reads your codebase, edits files, runs commands and works with git
Where it runsTerminal (CLI), VS Code and Cursor, JetBrains IDEs, the Claude desktop app (Code tab), the web at claude.ai/code and the Claude mobile app
Plans that include itPro, Max, Team and Enterprise. The Free plan does not include it
Pay-as-you-go optionA Claude Console account with prepaid API credits, billed at API rates
Install on macOS, Linux, WSLcurl -fsSL https://claude.ai/install.sh | bash
Install on Windows (PowerShell)irm https://claude.ai/install.ps1 | iex
Start a sessionOpen a terminal in your project folder and run claude
Starting permission modeAuto mode for terminal and VS Code sessions on v2.1.283 or later. Press Shift+Tab to switch
Project memoryA CLAUDE.md file in your project. Run /init to create one
UndoPress Esc twice or run /rewind to restore code and conversation to an earlier point

Checked against Anthropic’s Claude Code documentation, the claude.com pricing page and the Claude Help Center on October 8, 2026.

What is Claude Code?

Claude Code is Anthropic’s agentic coding tool. Unlike a chat window where you paste code back and forth, it works directly in your project: it reads the files it needs, edits them, runs commands such as your tests or git, and checks the results. Instead of writing the code and asking for a review, you describe the outcome and Claude explores, plans and implements it.

It runs in several places. They all use the same engine, so your CLAUDE.md files, settings and MCP servers carry over between them:

  • Terminal (CLI): the full-featured version. Everything in this guide works here.
  • VS Code and Cursor: an extension with inline diffs, @-mentions and plan review. It needs VS Code 1.94.0 or later.
  • JetBrains IDEs: a plugin for IntelliJ IDEA, PyCharm, WebStorm and others. It needs the CLI installed separately.
  • Desktop app: the Code tab in the Claude app for macOS and Windows, with Linux in beta. It includes Claude Code, so there is no terminal or separate install.
  • Web and mobile: cloud sessions at claude.ai/code or in the Claude app for iOS and Android. Claude clones a GitHub repository into an Anthropic-managed virtual machine, does the work and pushes a branch for you to review.

Never used a terminal? Anthropic’s terminal guide shows how to open one and paste a command, and the desktop app skips the terminal entirely. Still choosing a tool? See ChatGPT vs Claude vs Gemini or which AI tool you should use. For the non-coding side of Claude, see the parts of Claude most people never find.

Which Claude plans include Claude Code?

Claude Code is included in every paid Claude plan, from Pro up. The Free plan does not include it. You can also skip the subscription and pay per use through a Claude Console account.

PlanPrice (USD, before tax)Claude Code
Free$0Not included
Pro$20 a month, or $17 a month billed annually ($200 a year)Included
MaxFrom $100 a month, for 5x or 20x the usage of ProIncluded
TeamStandard seat $25 a month ($20 billed annually); premium seat $125 ($100 billed annually) with 5x the usage of a standard seatIncluded with every seat
Enterprise$20 per seat a month billed annually, plus usage at API ratesIncluded with the Enterprise seat on new and self-serve plans
Claude Console (API)Prepaid API credits, billed at standard API ratesPay as you go

Prices from claude.com/pricing on October 8, 2026. On older Enterprise plans, Claude Code comes only with Chat + Claude Code or Premium seats.

Your limits are shared. On Pro and Max, Claude and Claude Code draw on the same usage limits: a five-hour session limit and a weekly limit. Chatting in the Claude app and coding in the terminal count against the same pool, and Claude Code warns you as you get close. At the limit you can wait for the reset, upgrade, turn on usage credits or switch to Console API credits.

Watch for a stray API key. If an ANTHROPIC_API_KEY environment variable is set and you approve it when Claude Code asks, the session bills that key at API rates instead of using your subscription. Run /status in a session to see which account it is using.

Can you use Claude Code for free?

Not on the Free plan. The cheapest ways in are Pro at $20 a month, or a Console account where you pay only for the tokens you use. What is free: Anthropic’s self-paced courses on Claude Academy, including Claude Code 101 and Claude Code in Action. More on what is worth paying for in do you need to pay for AI?

How to install Claude Code

Check the basics first. Claude Code runs on macOS 13.0 or later, Windows 10 1809 or later (or Windows Server 2019 and later), Ubuntu 20.04+, Debian 10+ and Alpine Linux 3.19+. You need at least 4 GB of RAM, an x64 or ARM64 processor, an internet connection, and to be in one of Anthropic’s supported countries.

macOS, Linux or WSL

Open a terminal and run Anthropic’s native installer. It is the recommended method, and it keeps itself updated in the background.

curl -fsSL https://claude.ai/install.sh | bash

Windows

Use the command for the shell you are in. Your prompt shows PS C:\ in PowerShell and a plain C:\ in Command Prompt (CMD). In PowerShell:

irm https://claude.ai/install.ps1 | iex

In CMD:

curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

On native Windows, Anthropic recommends installing Git for Windows so Claude Code can use its Bash tool. Without it, Claude Code uses PowerShell instead. WSL setups don’t need it.

Homebrew, WinGet or npm

Prefer a package manager? Pick one of these:

# Homebrew
brew install --cask claude-code

# WinGet (Windows)
winget install Anthropic.ClaudeCode

# npm (needs Node.js 22 or later)
npm install -g @anthropic-ai/claude-code

Homebrew and WinGet installs don’t update themselves, so run brew upgrade claude-code or winget upgrade Anthropic.ClaudeCode now and then. The npm package needs Node.js 22 or later, and Anthropic warns never to use sudo npm install -g, which causes permission and security problems.

Check that it worked

Open a new terminal window and run:

claude --version

You should see a version number followed by “(Claude Code)”. If your shell says claude isn’t found, the fix is in the troubleshooting section below.

Your first Claude Code session, step by step

Step 1: Start Claude Code in your project folder. Replace the path with your own project:

cd /path/to/your/project
claude

Step 2: Sign in. On first run, Claude Code asks you to log in and opens your browser. Choose your Claude subscription (or your Console account) and approve. The login is saved, so you only do this once. If the browser doesn’t open, press c to copy the login link and paste it into a browser yourself.

Step 3: Trust the folder. The first time you open a folder, Claude Code asks whether you trust it. Approve it for your own projects, and take more care with code you just downloaded, because project files can carry their own instructions, settings and MCP servers. Start from a project folder rather than your home directory.

Step 4: Ask about the code before you change it. Try prompts like these:

what does this project do?
where is the main entry point?
explain the folder structure

Claude reads the files it needs on its own, so you don’t have to paste code in. To point at a specific file, type @ and start typing its path.

Step 5: Make a small change. Pick something you can check:

add input validation to the signup form, then run the tests

Depending on your permission mode, Claude either asks before each edit and command or works through them and shows you the changes as it goes. Press Esc at any point to stop it and redirect. It keeps the work done so far.

Step 6: Commit with git. Claude Code handles git conversationally:

what files have I changed?
commit my changes with a descriptive message

To leave, type /exit or press Ctrl+D twice. Next time, claude -c continues your most recent conversation in that folder, and claude -r lets you pick an older one.

Give Claude Code a memory with CLAUDE.md

Every session starts with a fresh context window. CLAUDE.md is how you carry knowledge from one session to the next: a plain Markdown file of instructions that Claude reads at the start of every session. Put your build and test commands, coding conventions, project layout and “always do X” rules in it.

The fastest way to start is to run this inside a session:

/init

Claude analyzes your codebase and writes a starting CLAUDE.md with the build commands, test instructions and conventions it finds. If the file already exists, /init suggests improvements instead of overwriting it. Open and edit your memory files any time with /memory.

Where the file livesWho it applies to
~/.claude/CLAUDE.mdYou, in every project on this computer
./CLAUDE.md or ./.claude/CLAUDE.mdEveryone on the project. Commit it to git so your team shares it
./CLAUDE.local.mdYou, in this project only. Add it to .gitignore

Here is a short example of a project CLAUDE.md:

# Project notes
- Run tests with: npm test
- Run the linter before every commit: npm run lint
- API handlers live in src/api/handlers/
- Use 2-space indentation
- Never edit files in /generated (they are rebuilt on every build)

Three habits from Anthropic’s docs make it work better:

  • Keep it short. Aim for under 200 lines per file. Longer files use more context, and Claude follows them less reliably.
  • Be concrete. “Run npm test before committing” works better than “test your changes”.
  • Add to it when Claude repeats a mistake, or when you find yourself typing the same correction you typed last session.

CLAUDE.md is guidance, not a lock: Claude treats it as context. To actually block an action, use permission rules (covered below). If your repository already has an AGENTS.md file for other coding agents, Claude Code can read it, and it also keeps its own auto memory of your corrections and preferences.

Permission modes: how much Claude can do without asking

A permission mode decides which actions Claude can take without stopping to ask you. Press Shift+Tab to cycle through them during a session. The current mode shows in the status bar under the prompt.

ModeWhat runs without askingBest for
Manual (default)Reading files only. Claude asks before edits and most commandsLearning the tool, sensitive or unfamiliar code
Accept edits (acceptEdits)File edits, plus common file commands such as mkdir, mv and cp, inside your project folderIterating on code you will review with git diff
Plan (plan)Reading and exploring. No edits until you approve a planBig or unclear changes
Auto (auto)Everything, with a separate classifier model reviewing actions in the backgroundLong tasks where you trust the direction
Don’t ask (dontAsk)Only tools you pre-approved. Anything else is deniedLocked-down scripts and CI
Bypass permissions (bypassPermissions)EverythingIsolated containers and VMs only

Know your starting mode. On current versions (v2.1.283 or later), new terminal and VS Code sessions start in auto mode. Anthropic is clear that auto mode reduces permission prompts but does not guarantee safety. If you would rather approve each action while you learn, start in Manual mode, whose setting name is default:

claude --permission-mode default

To make Manual your default for every session on your computer, add this to ~/.claude/settings.json:

{
  "permissions": {
    "defaultMode": "default"
  }
}

Bypass permissions skips the prompts entirely. Anthropic says to use it only in isolated environments such as containers or virtual machines, where Claude Code can’t cause damage. Don’t switch it on for your everyday computer.

Use plan mode before big changes

Plan mode makes Claude research and propose before it touches anything. It reads files, runs commands to explore and writes a plan, but it can’t edit your source until you approve. Anthropic’s recommended workflow for anything non-trivial has four steps:

  1. Explore. Press Shift+Tab until the status bar shows plan mode, or start with claude --permission-mode plan. Ask Claude to read the relevant code.
  2. Plan. Ask which files need to change and how. Press Ctrl+G to open the plan in your text editor and edit it yourself.
  3. Implement. Approve the plan, choosing auto mode or approving each edit yourself, and Claude starts coding. Ask it to write and run tests as it goes.
  4. Commit. Ask Claude to commit with a descriptive message and open a pull request.

You can also jump straight into plan mode with a task:

/plan add a "forgot password" flow. Which files need to change?

Skip the plan for small, obvious edits like fixing a typo or renaming a variable. Anthropic’s rule of thumb: if you could describe the change in one sentence, just ask for it.

Claude Code commands to learn first

Type / in a session to see every command and skill available to you. These 18 are the ones beginners use most:

CommandWhat it does
/helpShows the available commands
/initCreates a starting CLAUDE.md for the project
/memoryEdits your CLAUDE.md files and auto memory settings
/planEnters plan mode, optionally with a task
/clearStarts a fresh conversation with empty context
/compactSummarizes the conversation so far to free up context
/contextShows what is filling the context window
/usageShows session cost, plan usage limits and activity (/cost does the same)
/modelSwitches the model and saves it as your default
/permissionsManages your allow, ask and deny rules
/rewindRewinds code, conversation or both to an earlier point
/resumeReopens an earlier conversation
/reviewReviews your current changes or a pull request for bugs
/security-reviewChecks the changes on your branch for security vulnerabilities
/doctorRuns a setup checkup and proposes fixes
/statusShows your version, model, account and connection
/login and /logoutSigns in, signs out or switches accounts
/exitLeaves Claude Code

A few keys do as much work as the commands:

KeyWhat it does
EscStops Claude mid-task so you can redirect it
Esc twice (empty prompt)Opens the rewind menu
Shift+TabCycles permission modes
@Mentions a file, with path autocomplete
! at the startShell mode: runs a command yourself, then Claude responds to the output
Ctrl+GOpens your prompt, or a plan, in your text editor
Ctrl+CInterrupts a running task. With nothing running, it clears your input, and a second press exits
Ctrl+RSearches your command history

And from your regular terminal, outside a session:

claude "fix the build error"        # start a session with a task
claude -p "explain this function"   # one answer, then exit
claude -c                           # continue the last conversation here
claude -r                           # pick an earlier conversation
claude update                       # update to the latest version
claude doctor                       # check your install

Good first tasks for Claude Code

Start with work that is easy to check. Anthropic’s best-practices guide calls verification the biggest lever: give Claude tests, a build or a screenshot to compare against, and it can check and fix its own work instead of waiting for you to spot mistakes.

  • Understand a codebase: explain how authentication works in this project
  • Write missing tests: write tests for the auth module, run them, and fix any failures
  • Fix a bug from an error: paste the error message and add find the root cause and fix it
  • Update docs: update the README with installation instructions
  • Refactor something small: refactor the payments module to use async/await instead of callbacks
  • Review before you push: run /review, or ask review my changes and suggest improvements
  • Git chores: create a new branch called feature/signup or help me resolve merge conflicts

Be specific. “Fix the bug” sends Claude searching through your code. “Fix the login bug where users see a blank screen after entering the wrong password” points it straight at the problem and uses fewer tokens. The habits in our AI prompting guide apply here too: context, constraints and a clear finish line.

How to use Claude Code safely

Claude Code edits files and runs commands on your machine, so treat it like a capable new teammate at your keyboard. Anthropic’s docs put the responsibility plainly: you review proposed code and commands before you approve them.

  • Use git, and commit before big tasks. Rewind restores Claude’s file edits, but it doesn’t track changes made by shell commands such as rm, mv or cp, and it is not a replacement for version control.
  • Block what should never happen. Permission rules are enforced by Claude Code itself, not by the model, so they hold even if Claude misreads an instruction. Deny rules apply in every mode. See the example below.
  • Keep secrets out. Deny reads of your .env files, and keep API keys out of prompts and CLAUDE.md.
  • Be careful with untrusted content. Prompt injection is a real risk, so don’t pipe untrusted content straight into Claude and check commands before you approve them. Only add MCP servers from providers you trust: Anthropic says it doesn’t security-audit them.
  • Keep bypass permissions inside a container or VM.
  • Know the data policy. On Free, Pro and Max, Anthropic trains on your data, including Claude Code sessions, only when your model-improvement setting is on, and you can change it in your claude.ai privacy settings. On Team, Enterprise and the API, Anthropic doesn’t train on code or prompts sent to Claude Code unless your organization opts in.

This settings file lets Claude run your lint and test commands without asking, while blocking pushes and reads of .env files:

{
  "permissions": {
    "allow": [
      "Bash(npm run lint)",
      "Bash(npm run test *)"
    ],
    "deny": [
      "Bash(git push *)",
      "Read(./.env)",
      "Read(./.env.*)"
    ]
  }
}

Save it as .claude/settings.json in your project to share it with your team, or as ~/.claude/settings.json to apply it everywhere. Deny rules win over allow rules. Run /permissions to see every rule and the file it came from. Rolling Claude Code out to a team? Put the ground rules in writing first: our AI acceptable use policy guide shows what to cover.

How to control Claude Code costs and usage limits

Claude Code’s usage grows with context: each request carries the conversation so far, including every file Claude has read and every command output. Keep the context lean and your plan limits, or your API bill, go further.

  • Check with /usage. On Pro, Max, Team and Enterprise it shows your plan limits and what is using them, including skills, subagents and MCP servers.
  • Run /clear between unrelated tasks. Stale context costs tokens on every message, and clearing costs nothing.
  • Use /compact on long tasks you want to continue. Add focus instructions, such as /compact focus on the test failures. Compacting reads the whole conversation, so it is a large request itself.
  • Plan first, stop early. Use plan mode on big jobs and press Esc as soon as Claude heads the wrong way. Anthropic’s cost guide recommends both to avoid expensive rework.
  • Match the model to the job. Anthropic’s docs say Sonnet handles most coding tasks well and costs less than Opus. Switch with /model, and lower /effort for simple tasks.
  • Trim the extras. Turn off MCP servers you aren’t using in /mcp, and keep CLAUDE.md short.
  • Avoid accidental API billing. Make sure no ANTHROPIC_API_KEY is set if you mean to use your subscription.

Paying through the API instead? Anthropic reports an average of about $13 per developer per active day across enterprise deployments, or $150 to $250 per developer per month, with 90% of users under $30 per active day. Your own numbers depend on the model, the size of your codebase and how much you automate. For scripted runs with claude -p, the --max-budget-usd flag caps what a single run can spend.

Claude Code troubleshooting: common problems and fixes

ProblemFix
command not found: claude or 'claude' is not recognizedThe install folder isn’t on your PATH. On a Mac with the default Zsh shell, run the two lines below, then open a new terminal. On Windows, add %USERPROFILE%\.local\bin to your PATH.
'irm' is not recognized or The token '&&' is not a valid statement separatorYou used the PowerShell command in CMD, or the CMD command in PowerShell. Run the command for the shell you are in.
Login fails or keeps askingRun /logout, close Claude Code, start claude again and sign in. If the browser doesn’t open, press c to copy the login link.
403 error after loginCheck that your subscription is active in your claude.ai settings. On a Console account, an admin must give you the Claude Code or Developer role.
You are billed at API rates instead of using your planAn ANTHROPIC_API_KEY environment variable is taking over. Remove it, run /login and choose your Claude account.
The desktop Code tab asks you to upgradeClaude Code needs a paid plan. Upgrade, then restart the app if it asks you to sign in again.
Claude ignores your CLAUDE.mdRun /context and check the file is listed under Memory files. Shorten long files and remove rules that contradict each other.
Claude forgets instructions or makes more mistakes in a long sessionThe context window is filling up. Run /compact, or /clear and start again. After two failed corrections, Anthropic suggests clearing and writing a better first prompt.
App unavailable in regionClaude Code isn’t available in your country. Check Anthropic’s supported countries list.
Anything elseRun /doctor in a session, or claude doctor in your terminal, for a setup checkup.

The PATH fix for Zsh on macOS:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

For other shells and errors, Anthropic keeps a full list in its installation troubleshooting guide.

Claude Code and the Claude certifications

Learning Claude Code for work? It also features in Anthropic’s certification exams. In the published outline for Claude Certified Architect: Foundations (CCAR-F), Claude Code Configuration & Workflows is 20% of the exam, and two of the six scenarios the exam draws from are Code Generation with Claude Code and Claude Code for CI. Claude Certified Developer: Foundations (CCDV-F) lists Claude Code as one of its eight domains, and Anthropic’s free Claude Code in Action course is on the CCAR-F prep list.

These exams are open only to people at Claude Partner Network organizations, so check who can take the Claude certification first. Then start with our Claude certification guide, the Claude Certified Architect overview, the CCAR-F study guide or the CCDV-F study guide. Our free practice questions are original, written from the published exam guides:

Free CCAR-F practice questions →

Free CCDV-F practice questions →

HOW TO // AI is not affiliated with or endorsed by Anthropic. Claude and Claude Code are trademarks of Anthropic PBC; we reference them descriptively. All content is original.

Related guides

Frequently asked questions

Is Claude Code free?

No, Claude Code isn't included in the free Claude plan. You need a Pro, Max, Team or Enterprise plan (Pro is $20 a month), or a Claude Console account that bills per use at API rates. Anthropic's Claude Code courses on Claude Academy are free.

Which Claude plan do I need for Claude Code?

Any paid plan: Pro, Max, Team or Enterprise. Pro is the cheapest way in at $20 a month, or $17 a month billed annually. Max starts at $100 a month for 5x or 20x the Pro usage, which helps if you hit limits often.

How do I install Claude Code?

On macOS, Linux or WSL, run curl -fsSL https://claude.ai/install.sh | bash. In Windows PowerShell, run irm https://claude.ai/install.ps1 | iex. Then open a new terminal, run claude --version to confirm it worked, and start it by typing claude inside your project folder.

Do I need to know how to code to use Claude Code?

You don't need terminal experience to start: Anthropic has a beginner terminal guide, and the desktop app's Code tab works without a terminal. You are responsible for reviewing what Claude changes, though, so being able to read code and run your tests gets you better and safer results.

What is CLAUDE.md in Claude Code?

CLAUDE.md is a Markdown file of instructions that Claude Code reads at the start of every session, such as build commands, coding conventions and project rules. Run /init to generate one, keep it under about 200 lines, and edit it with /memory.

What is plan mode in Claude Code?

Plan mode lets Claude read your code and propose a plan without editing anything until you approve it. Press Shift+Tab until the status bar shows plan mode, type /plan, or start with claude --permission-mode plan.

How do I undo changes in Claude Code?

Press Esc twice on an empty prompt, or run /rewind, then restore the code, the conversation or both to an earlier prompt. Rewind doesn't undo changes made by shell commands such as rm or mv, so keep using git for real version history.

Does Claude Code use my Claude usage limits?

Yes. On Pro and Max, Claude and Claude Code share the same five-hour session limit and weekly limit. Run /usage in Claude Code to see where you stand.

Can I use Claude Code in VS Code?

Yes. Install the Claude Code extension from the VS Code Extensions view (it needs VS Code 1.94.0 or later and also works in Cursor), then sign in with your Claude account. Usage counts toward the same plan limits as the terminal.

Scroll to Top