How to use Claude Code: setup, first session and habits

From zero to productive: install it, sign in, run your first task, and learn the few commands and habits that matter.

Last updated

Abstract illustration of glowing steps rising from left to right

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 or a Claude Console account. Then you just describe what you want in plain English ("fix the login bug where users see a blank screen") and Claude reads your code, edits files and runs commands, asking you before anything risky.

That's the whole loop. The rest of this guide is about the handful of things that turn it from "neat demo" into something you rely on every day: a short CLAUDE.md, plan mode, permissions, a check Claude can run, and knowing when to start fresh. Everything below was checked against Anthropic's documentation and the claude CLI (version 2.1.332) on November 29, 2026. Claude Code changes almost weekly, so if something looks different on your screen, the official docs win.

What you need before you start

  • A terminal and a project. Any code folder works, even an empty one.
  • A supported system. As of November 2026: macOS 13.0 or later, Windows 10 1809 or later, Ubuntu 20.04+, Debian 10+ or Alpine 3.19+, with 4 GB of RAM or more.
  • An account that includes Claude Code. A Claude Pro, Max, Ultra, Team or Enterprise subscription, a Claude Console account (pay per use with API credits), or access through Amazon Bedrock, Google Cloud or Microsoft Foundry. The free claude.ai plan does not include Claude Code. What each plan costs is on our Claude Code pricing page.

If you've never opened a terminal, Anthropic has a short terminal guide linked from the quickstart. There's also a desktop app, a VS Code extension, a JetBrains plugin and a web version at claude.ai/code, but the terminal is where every feature shows up first, so this guide uses it.

How to install Claude Code

Pick the line for your system. The native installer is the one Anthropic recommends, and it updates itself in the background.

macOS, Linux or WSL:

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

Windows PowerShell:

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

Windows CMD:

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

The installer shows no progress bar while it downloads, so give it a minute. Then open a new terminal window and check it worked:

claude --version

You should see a version number followed by (Claude Code). If your shell says claude isn't found, the install folder isn't on your PATH yet; the official troubleshooting page has the fix for each shell.

Prefer a package manager? These work too, but they do not auto-update by default:

Method Install Update
Homebrew brew install --cask claude-code brew upgrade claude-code
WinGet winget install Anthropic.ClaudeCode winget upgrade Anthropic.ClaudeCode
npm (needs Node.js 22+) npm install -g @anthropic-ai/claude-code@latest same command again

Anthropic also publishes signed apt, dnf and apk repositories for Debian, Fedora, RHEL and Alpine. On Windows, installing Git for Windows is optional but recommended, so Claude can use a Bash shell; without it, Claude uses PowerShell. Never install the npm package with sudo: it causes permission problems and breaks auto-updates.

For a health check of the install and your settings at any point, run:

claude doctor

How to set up Claude Code and sign in

Go to your project and start it:

cd /path/to/your/project
claude

On first launch Claude Code opens your browser to log in. Sign in with your claude.ai account (or your Console account), and the terminal says Login successful. If the browser doesn't open, press c to copy the login URL and paste it yourself. You only do this once; Claude Code stores the login (in the macOS Keychain on a Mac, in ~/.claude/.credentials.json on Linux and Windows).

Useful later:

  • /login inside a session switches accounts, /logout signs you out.
  • claude auth status in your shell shows which account you're using.
  • /status inside a session shows version, model, account and connectivity.
  • If Claude Code is throwing errors or hanging for no clear reason, check whether Claude Code is down before you debug your own setup.

One trap worth knowing on day one: if you have an ANTHROPIC_API_KEY environment variable set and you approve it when Claude Code asks, it uses that key instead of your subscription, and usage is billed to that API account. If you meant to use your subscription, run unset ANTHROPIC_API_KEY and check /status.

Your first session

Claude Code reads files as it needs them, so you don't have to paste code in. Start by asking about the project:

what does this project do? explain the folder structure

Then try a small, real change:

add input validation to the signup form so empty emails are rejected, and add a test for it

Claude finds the right files, shows you what it's changing, and runs commands. Git works conversationally too: "what files have I changed?", "commit my changes with a descriptive message", "create a branch called fix/signup-validation".

The input box has a few tricks worth learning right away:

Type or press What it does
/ Opens the menu of commands and skills
@ then a path Mentions a file so its contents go into your message
! at the start Runs a shell command directly and adds the output to the session
Ctrl+V (Cmd+V in iTerm2, Alt+V on Windows) Pastes an image, such as a screenshot of a bug or a design
\ then Enter, or Ctrl+J New line without sending (Shift+Enter also works in iTerm2, WezTerm, Ghostty, Kitty, Warp and Windows Terminal 1.25 or later)
Esc Stops Claude mid-action and keeps the work so far
Esc twice on an empty prompt Opens the rewind menu to roll back code, conversation or both
Shift+Tab Cycles permission modes
Ctrl+D twice, or /exit Quits

From your shell, claude -c continues the most recent conversation in this folder, claude -r lets you pick an older one, and claude -p "explain this function" runs a single question and exits, which is handy in scripts.

The commands that matter

There are dozens of slash commands. These are the ones you'll actually use in your first month:

Command What it's for
/init Generates a starter CLAUDE.md for the project (or suggests improvements to an existing one)
/clear Starts a new conversation with empty context. Use it between unrelated tasks
/compact Summarizes the conversation so far to free up space; you can add focus, like /compact keep the API changes
/context Shows what is filling the context window
/plan Enters plan mode, optionally with a task: /plan fix the auth bug
/model Switches the model and saves it as your default
/permissions Manages allow, ask and deny rules
/resume Goes back to an earlier conversation
/rewind Rolls code and conversation back to a checkpoint
/usage Shows session cost and your plan's usage limits (/cost is an alias)
/mcp Manages MCP server connections and their logins
/memory Edits your CLAUDE.md files and auto memory
/code-review Reviews the current diff for bugs (/review is an alias)
/doctor Diagnoses setup problems and proposes fixes

Write a short CLAUDE.md

CLAUDE.md is a Markdown file Claude reads at the start of every session. It's how you tell Claude the things it can't figure out by reading your code. Run /init in a new project and Claude drafts one for you; then trim it.

Where it can live:

File Scope
~/.claude/CLAUDE.md Your preferences, in every project
./CLAUDE.md or ./.claude/CLAUDE.md The project, shared with your team through git
./CLAUDE.local.md Your personal notes for this project (add it to .gitignore)

If your repo already has an AGENTS.md for other agents like Codex, Claude Code reads it when there's no CLAUDE.md. You can also import it from a CLAUDE.md with a line like @AGENTS.md.

Anthropic's own advice is to keep it short (under 200 lines) and to only write down what isn't in the repo. The best things to put in it:

  • The exact commands to run tests, lint and typecheck, and how to run a single test file
  • Places where the code is misleading (an old pattern new code must not copy)
  • Decisions that live in people's heads: how deploys work, which helper the team settled on
  • Anything you've had to correct twice

Skip describing your folder structure and architecture. Claude reads the repo itself, and every extra line costs attention on every task. This is also why agents do better in codebases with strong conventions and a real test suite: there is less to explain and something to check against. (That's the idea behind RailsFast, which ships with an AGENTS.md, a CLAUDE.md and a CI script an agent can run.)

Use plan mode for anything bigger than a small fix

In plan mode Claude reads files and explores, then writes a plan, but it can't edit your source until you approve. It's the habit to build first for any change that touches several files.

Get into it by pressing Shift+Tab until the mode indicator says plan, by starting a prompt with /plan, or by launching with claude --permission-mode plan. When the plan is ready you can approve it and let Claude work, approve it but review each edit, or keep planning. Press Ctrl+G to edit the plan in your own editor first.

When you don't know exactly what you want yet, let Claude interview you instead. Anthropic's docs suggest a prompt like this one, then a fresh session to build from the spec:

I want to add rate limiting to the public API but haven't thought it through yet. Interview me until you could write the spec, then write it to SPEC.md.

Understand permissions

Permission modes decide what Claude can do without asking you. As of November 2026 there are six:

Mode Runs without asking Good for
manual (also written default in the docs) File reads and other actions that need no approval Sensitive or unfamiliar code
acceptEdits Reads, file edits and common filesystem commands Iterating on code you're reviewing
plan Reads, plus classifier-approved commands when auto mode is available; no source edits Exploring before changing
auto Everything, with a background safety classifier Long tasks, fewer prompts
dontAsk Reads and pre-approved tools; everything else is denied CI and scripts
bypassPermissions Everything Isolated containers and VMs only

Since version 2.1.283, interactive terminal and VS Code sessions start in auto mode. A separate model checks each action before it runs and blocks things like curl | bash, production deploys, force pushes over other people's work, and sending sensitive data to outside servers. Anthropic is clear that it "does not guarantee safety", so review anything you can't undo. If you'd rather approve everything yourself, press Shift+Tab to cycle to Manual, or start with claude --permission-mode manual.

For commands you run all the time, add an allow rule instead of approving them over and over. In .claude/settings.json:

{
  "permissions": {
    "allow": ["Bash(npm test)"]
  }
}

Deny rules work the same way and block in every mode, including bypass. That's where rules that must never bend belong, not in CLAUDE.md.

Give Claude a check to run

This is the habit that makes the biggest difference. Claude stops when the work looks done. If it has a test, a build, a linter or a script that comes back pass or fail, it can run it, read the failure and fix it on its own. Without one, you become the test suite.

So say it in the prompt: "run the auth tests after, and keep going until they pass." Put the test command in CLAUDE.md. And when Claude says it's done, ask for the evidence (the command it ran and the output), not just "all tests pass".

Skills, MCP and subagents

You don't need any of these on day one. When you do:

Skills are folders with a SKILL.md file of instructions. Claude loads one automatically when it's relevant, or you run it with /skill-name. Put personal skills in ~/.claude/skills/<name>/SKILL.md and project skills in .claude/skills/<name>/SKILL.md (commit them so your team gets them). Custom slash commands have been merged into skills; old .claude/commands/ files still work. Only description is recommended in the frontmatter, because that's how Claude decides when to use it:

---
description: Summarizes uncommitted changes and flags anything risky. Use when the user asks what changed or wants a commit message.
---

Summarize the current diff in two or three bullet points, then list any risks.

Run /skills to see what you have. Skills also come bundled inside plugins, which you manage with /plugin. Our guide to Claude Code skills covers installing and writing them.

MCP servers connect Claude Code to outside tools: your issue tracker, a database, Figma, Stripe. (New to the idea? Read what is MCP.) Add a remote server from your shell:

claude mcp add --transport http notion https://mcp.notion.com/mcp

For a local server, put its command after --:

claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable -- npx -y airtable-mcp-server

Servers are local to the current project by default; add --scope user for all your projects or --scope project to write a shared .mcp.json. claude mcp list shows them, claude mcp remove <name> removes one, and /mcp inside a session handles logins. Only connect servers you trust: a server that fetches outside content can carry prompt injection.

Subagents are helpers that run in their own context window and report back a summary. Claude already uses built-in ones (Explore, Plan, general-purpose) on its own. To make your own, ask Claude ("create a code-reviewer subagent in .claude/agents/") or write a Markdown file with name and description in the frontmatter in .claude/agents/ or ~/.claude/agents/. They're useful for parallel work, noisy searches and an independent review; they also spend extra tokens, so they don't make the same answer better by themselves.

Common mistakes

  • One endless session. Mixing three unrelated tasks means every new turn re-reads all of them. /clear between tasks is free.
  • Correcting the same thing a third time. After two failed corrections, /clear and write one better prompt that includes what you learned. Anthropic's own docs recommend exactly this.
  • Vague prompts when you know what you want. Name the file, describe the symptom, and say what "fixed" looks like. "Fix the bug" costs you a round of corrections.
  • A giant CLAUDE.md. Long files reduce how well Claude follows them. Keep it under 200 lines and move rarely needed procedures into skills.
  • No safety net. Commit before big changes. Checkpoints (/rewind) only cover files Claude edited with its own file tools, not files changed by shell commands, so they work alongside git, not instead of it.
  • Bypass mode on your real machine. --dangerously-skip-permissions is meant for containers without internet access. On your laptop, use auto mode or allow rules.
  • An old API key in your shell. See the sign-in section: it can silently bill the wrong account.

How to update Claude Code

If you used the native installer, you don't have to do anything: Claude Code checks for updates on startup and while running, installs them in the background, and the new version takes effect next time you start it. To update right now:

claude update

It prints the new version, or Claude Code is up to date if you already have the latest. For other install methods, use the package manager: brew upgrade claude-code (or brew upgrade claude-code@latest if you installed that cask), winget upgrade Anthropic.ClaudeCode, npm install -g @anthropic-ai/claude-code@latest (not npm update -g), or your normal apt/dnf/apk upgrade.

Two settings worth knowing: autoUpdatesChannel set to "stable" gets you a version that is typically about a week old and skips releases with major regressions, and DISABLE_AUTOUPDATER set to "1" in the env block of settings.json turns off background updates. You can change the channel from /config too.

How to uninstall Claude Code

Remove it the same way you installed it.

Native install on macOS, Linux or WSL:

rm -f ~/.local/bin/claude
rm -rf ~/.local/share/claude

Native install on Windows PowerShell:

Remove-Item -Path "$env:USERPROFILE\.local\bin\claude.exe" -Force
Remove-Item -Path "$env:USERPROFILE\.local\share\claude" -Recurse -Force

Package managers: brew uninstall --cask claude-code, winget uninstall Anthropic.ClaudeCode, or npm uninstall -g @anthropic-ai/claude-code.

That leaves your settings and history behind. To remove those too (this deletes your settings, allowed tools, MCP configuration and session history), delete ~/.claude and ~/.claude.json, plus .claude/ and .mcp.json inside any project. The VS Code extension, JetBrains plugin and desktop app also write to ~/.claude/, so uninstall them first or the folder comes back. If claude still runs afterwards, you have a second installation somewhere; claude doctor before uninstalling helps you find it.

Frequently asked questions

Is Claude Code free?

No. As of November 2026 the free claude.ai plan does not include Claude Code. You need a Pro, Max, Ultra, Team or Enterprise subscription, a Claude Console account billed per use, or access through a cloud provider such as Amazon Bedrock. Our Claude Code pricing page compares the options.

How do I start Claude Code in the terminal?

Open a terminal, move into your project folder with cd, and type claude. The first time, it opens your browser so you can sign in. Use claude -c to continue your last conversation in that folder, or claude "fix the build error" to start with a task.

Can I see Claude Code history?

Yes. Type /resume inside a session, or run claude -r from your shell, to open a picker of past conversations; claude -c reopens the most recent one in the current folder. Name a session with /rename and you can resume it later by name with claude --resume <name>.

How do I make Claude Code stop asking for permission?

Recent versions start in auto mode, which skips routine prompts and has a classifier check risky actions. For specific commands, add allow rules with /permissions or in .claude/settings.json, or switch to acceptEdits with Shift+Tab to auto-approve file edits. Bypass mode (--dangerously-skip-permissions) removes all checks and belongs only in isolated containers.

How do I change the model in Claude Code?

Type /model to open a picker; your choice becomes the default for new sessions. You can also start a session with claude --model sonnet (aliases like opus and sonnet always point to the latest model of that family), or press Option+P on macOS (Alt+P elsewhere) to switch without clearing your prompt.

How do I compact context in Claude Code?

Run /compact, optionally with what to keep, like /compact keep the API changes and the test commands. Claude Code also compacts automatically before the context window fills. If the old conversation isn't useful anymore, /clear is cheaper than compacting.

How do I add skills to Claude Code?

Create a folder with a SKILL.md file in ~/.claude/skills/ (all your projects) or .claude/skills/ (this project), with a description in the frontmatter saying when to use it. Claude picks it up automatically when relevant, or you run it with /skill-name. Skills from plugins are installed and managed with /plugin.

How do I add an MCP server to Claude Code?

Run claude mcp add --transport http <name> <url> for a remote server, or claude mcp add <name> -- <command> for a local one. Then use /mcp inside a session to log in to servers that need it. claude mcp list shows what's connected.

Can Claude Code view images?

Yes. Paste a screenshot into the prompt with Ctrl+V (Cmd+V in iTerm2, Alt+V on Windows) and it appears as an image you can refer to, which is the fastest way to show Claude a broken layout or a design to match.

Sources

All checked on November 29, 2026.

Checklist

Grab your free launch checklist 🚀

The definitive checklist to launch any project. It includes pre-launch steps & a detailed launch checklist you can go through to get your new project off the ground.

Secure connection. No spam.