Skip to main content

Claude Code Complete Guide (2026 Edition)

Claude Code guide for 2026: install it, learn the agent loop, then set up CLAUDE.md, permission modes, subagents, hooks, skills and MCP, plus plans and costs.

Founder of IImagined.ai

Published
May 8, 2026
Updated
Oct 7, 2026
Reading time
14 min read
Quick answer

Claude Code is Anthropic's agentic coding tool: it reads your codebase, edits files, runs commands and checks its own work from the terminal, your IDE, a desktop app or the browser. To use it well, treat the context window as the budget, give Claude a check it can run, and move repeated instructions into CLAUDE.md, skills, subagents, hooks and MCP servers. It needs a Pro, Max, Team, Enterprise or Console account.

This Claude Code guide in one paragraph: install Claude Code, run claude in a project, log in with a paid Claude plan or a Console account, describe the outcome you want, and let Claude explore, plan, edit and run your tests before you review the diff. The rest of 2026's feature set, from CLAUDE.md to subagents, hooks, skills and MCP, exists to make that loop cheaper, safer and repeatable.

Checked October 2026 against Anthropic's Claude Code docs: overview, setup, best practices, permission modes, subagents, hooks, skills, MCP, memory, model configuration and costs, plus the Claude pricing page. Claude Code ships often; flags and defaults below can move between versions.

This is the annual refresh of our Claude Code guide. It replaces the May 2026 version, which predated several of these features. If you only need the install steps, our step-by-step install guide is shorter. If MCP is new to you, read our Model Context Protocol guide alongside this one; it is the hub for everything Claude Code connects to.

What Claude Code is, and where it runs

Claude Code is an agentic coding tool, not a chat window with a code box. It reads your files, runs shell commands, edits code across many files, stages commits and opens pull requests. You can run the same agent in five places:

  • Terminal CLI: the full-featured version, and the one you can script with claude -p in CI.
  • VS Code and Cursor: an extension with inline diffs, @-mentions and plan review. Our Claude Code in VS Code setup guide covers the settings.
  • JetBrains IDEs: a plugin that needs the CLI installed separately.
  • Desktop app: the Code tab in the Claude app, with side-by-side sessions and scheduled tasks. It needs a paid subscription.
  • Web: claude.ai/code, for long tasks on repositories you do not have locally, including from the mobile app.

The mental model that makes Claude Code click

Two ideas explain almost every best practice in Anthropic's docs. First, Claude Code runs a loop: it gathers context, plans, acts, checks the result and repeats until the work looks done. Second, everything in that loop, every file it reads and every command output, lands in one context window, and Anthropic says performance degrades as that window fills. The context window is the budget you are managing.

The Claude Code loop
  1. 01
    Gather context

    Reads CLAUDE.md, searches files, often via the Explore subagent.

  2. 02
    Plan

    Proposes an approach; in plan mode it waits for your approval.

  3. 03
    Act

    Edits files and runs commands within your permission mode.

  4. 04
    Verify

    Runs the tests, build or linter you gave it, and reads the result.

  5. 05
    Report

    Shows the diff and the evidence, or loops back to fix.

So the two habits that matter most follow directly. Give Claude a check it can run, because without one "looks done" is the only stop signal and you become the test suite. And keep the context clean: one task per session, /clear between unrelated tasks, and side research pushed into subagents so only the summary comes back.

Claude Code tutorial: what does a first session look like?

From install to first merged change
  1. 1
    Install

    curl -fsSL https://claude.ai/install.sh | bash on macOS, Linux or WSL; irm https://claude.ai/install.ps1 | iex in PowerShell.

  2. 2
    Start in a project

    cd into the repo and run claude. Log in in the browser, or approve your ANTHROPIC_API_KEY.

  3. 3
    Run /init

    Claude scans the repo and writes a starting CLAUDE.md with build and test commands.

  4. 4
    Plan first

    Press Shift+Tab until the status bar shows plan mode, describe the change, and read the plan.

  5. 5
    Approve and let it verify

    Ask it to run the tests or build and show you the output, not just say it passed.

  6. 6
    Review and commit

    Read the diff, then ask Claude to commit with a descriptive message and open a PR.

The setup docs list macOS 13 or later, Windows 10 1809 or later, Ubuntu 20.04, Debian 10 or Alpine 3.19, and 4 GB of RAM. On native Windows, Git for Windows is recommended so Claude can use Bash; without it Claude Code falls back to PowerShell. The npm package still exists and needs Node.js 22 or later, but it installs the same native binary. Do not install it with sudo.

How do you use Claude Code day to day?

Prompts that name the symptom, the location and what "done" looks like beat short requests every time. Compare "fix the login bug" with "users report that login fails after session timeout; check the token refresh in src/auth/, write a failing test that reproduces it, then fix it." The second gives Claude a place to look and a check to pass.

  • Point at files with @ instead of describing where code lives.
  • Press Esc to stop Claude mid-action and redirect it; context is kept.
  • Press Esc twice or run /rewind to restore earlier code, conversation or both. Claude snapshots files before each change.
  • Run /clear between unrelated tasks, and after correcting Claude twice on the same issue. A fresh session with a better prompt usually wins.
  • Run /compact Focus on the API changes when you need to keep going but want the history condensed.
  • Skip planning for one-line changes. Anthropic's rule of thumb: if you could describe the diff in one sentence, skip the plan.

Permission modes

Permission modes decide what Claude may do without asking. Switch them mid-session with Shift+Tab or start with claude --permission-mode plan. Recent versions start interactive sessions in auto mode where it is available, which has a separate classifier review actions in the background.

ModeRuns without askingBest for
defaultReads onlyReviewing every action, sensitive work
acceptEditsReads, file edits and common filesystem commandsIterating on code you are reviewing
planReads; no edits until you approve a planExploring a codebase before changing it
autoEverything, with background safety checks by a classifierLong tasks with fewer prompts
dontAskOnly pre-approved tools; anything else is deniedLocked-down CI and scripts
bypassPermissionsEverythingIsolated containers and VMs only

Claude Code guide to the 2026 features: CLAUDE.md, skills, subagents, hooks and MCP

Each of these answers the same question differently: where should an instruction live so Claude follows it at the right moment without wasting context?

FeatureWhat it isWhere it livesUse it for
CLAUDE.mdProject instructions loaded at the start of every sessionCLAUDE.md, ~/.claude/CLAUDE.md, CLAUDE.local.mdBuild commands, conventions, gotchas Claude cannot infer
SkillsInstructions or procedures loaded only when used; callable as /name.claude/skills/<name>/SKILL.mdRepeatable workflows: deploy, release notes, PR review
SubagentsHelpers with their own context, prompt, tools and model.claude/agents/<name>.mdResearch, review or testing that would flood the main context
HooksShell commands that run at lifecycle events, every time"hooks" in .claude/settings.jsonFormatting, blocking risky commands, gating the stop on tests
MCP serversConnections to outside tools and dataclaude mcp add, or .mcp.jsonIssue trackers, docs, databases, design files
PluginsBundles of skills, agents, hooks and MCP serversInstalled from a marketplaceSharing one setup across a team

CLAUDE.md: the always-on instructions

Claude Code reads CLAUDE.md at the start of every session, from your working directory and every directory above it, plus ~/.claude/CLAUDE.md for personal preferences and a gitignored CLAUDE.local.md for private project notes. If your repo already has an AGENTS.md, Claude Code can read that instead. The docs recommend keeping each file under 200 lines: put in what Claude cannot work out from the code (commands, environment quirks, rules) and leave out file-by-file descriptions it can read itself.

Keep it in CLAUDE.md
  • Build, test and lint commands
  • Rules that apply to every task
  • Environment quirks and required variables
  • Short facts Claude cannot infer from code
Move it to a skill
  • Multi-step procedures such as a release
  • Long reference material for one area
  • Anything you paste into chat more than twice
  • Workflows you want to run as /name

Skills

A skill is a folder with a SKILL.md file: YAML frontmatter that says when to use it, then the instructions. Unlike CLAUDE.md, the body loads only when the skill is used, so long material costs almost nothing until needed. Custom slash commands have been merged into skills, so .claude/commands/deploy.md and .claude/skills/deploy/SKILL.md both create /deploy. Claude Code also bundles skills such as /code-review, /debug and /verify, and skills follow the open Agent Skills standard.

Subagents

A subagent runs in its own context window with its own system prompt, tools and model, and returns only a summary. Claude Code includes built-in ones, such as Explore, a fast read-only agent for searching a codebase, and a general-purpose agent. You add your own as Markdown files in .claude/agents/:

---
name: code-reviewer
description: Reviews code for quality and best practices
tools: Read, Glob, Grep
model: sonnet
---

You are a code reviewer. When invoked, analyze the code and provide
specific, actionable feedback on quality, security, and best practices.

That example is from Anthropic's docs. Only name and description are required, and Claude uses the description to decide when to delegate, so keep it short and specific. Subagent requests count toward the same usage limits as your main session; the saving is context, not quota.

Hooks

Hooks are shell commands Claude Code runs at fixed points: PreToolUse (which can block a tool call), PostToolUse, SessionStart, Stop, Notification and more. They are deterministic: the action always happens, instead of depending on the model remembering. Anthropic's example formats every file Claude edits:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          { "type": "command", "command": "jq -r '.tool_input.file_path' | xargs npx prettier --write" }
        ]
      }
    ]
  }
}

Put it in .claude/settings.json and check it with /hooks. A Stop hook that runs your test script and blocks the turn until it passes is the strongest version of "verify before you say done".

MCP servers

MCP connects Claude Code to tools outside your repo: issue trackers, docs, databases, design files. Add a remote server with claude mcp add --transport http notion https://mcp.notion.com/mcp, or commit a .mcp.json so the whole team shares it. Claude Code uses MCP tool search by default, so tool definitions load when Claude looks for them rather than all at once, but every server is still code you trust with access, so connect what a project needs rather than everything you use. Our MCP guide explains servers, clients and transports in depth.

Scripts, CI and parallel sessions

Claude Code follows the Unix habit of doing one job and taking input from a pipe. claude -p "prompt" runs a single non-interactive task and prints the result, so you can pipe logs into it or call it from a script. Anthropic's examples include piping the last 200 lines of a log for anomalies and passing a list of changed files from git diff for a security review.

In CI, pair it with an exact allowlist so nothing unexpected runs: claude -p "run the test suite" --permission-mode dontAsk --allowedTools "Bash(npm test)" "Read". Anything that would prompt is denied instead. For code review and issue triage there are official GitHub Actions and GitLab CI/CD integrations. Keep bypassPermissions (the --dangerously-skip-permissions flag) for containers or VMs you can throw away; the docs say so plainly.

For more than one task at a time, you have three levels. Subagents split work inside one session. Background agents run several full sessions you can watch from one screen. Agent teams let a lead session spawn and supervise others. Give parallel sessions their own git worktree so they do not edit the same files; subagents can do this with isolation: worktree in their frontmatter. More sessions means more usage, so start with one and add a second only when the first is waiting on you.

Claude Code pricing, models and costs

Anthropic's setup docs say Claude Code needs a Pro, Max, Team, Enterprise or Console account; the free plan does not include it. Checked October 2026 on the pricing page, Pro is $17 a month billed annually ($200 up front) or $20 monthly, and Max starts at $100 a month with 5x or 20x Pro's usage. With a Console account you pay per token instead: Claude Opus 5.5 lists $4 per million input tokens and $20 per million output, Sonnet 5.5 $2 and $10, and Haiku 5.5 $0.10 and $0.50 for prompts up to 100K tokens. Our LLM API pricing comparison sets those against OpenAI and Gemini.

$13
Average Claude Code cost per developer per active day across enterprise deployments on API billing
  • $150 to $250 per developer per month on average
  • 90% of users stay below $30 per active day
  • Run /usage to see your own session and plan usage

Source: Anthropic, Claude Code docs "Manage costs effectively", checked October 2026

Pick models by alias rather than version: sonnet for daily coding, opus for complex reasoning, haiku for simple tasks, opusplan to plan with Opus and execute with Sonnet, and fable or best for the hardest long-running work where your plan includes Fable. On the Anthropic API the aliases currently resolve to Opus 5.5, Sonnet 5.5 and Haiku 5.5. A cheap trick from the subagent docs: define your own Explore subagent with model: haiku to run codebase searches on the lowest-cost model.

Claude Code vs Cursor and other AI coding tools

AI editors such as Cursor and Windsurf (now Devin Desktop) started from inline completion and grew agents; Claude Code started as an agent and grew editor integrations. Claude Code's own extension runs inside Cursor, so it is not either-or. Choose Claude Code when you want one configuration (CLAUDE.md, hooks, subagents, MCP) that works in your terminal, CI, the desktop app and the browser. Our Cursor vs Windsurf comparison and Cursor guide cover the editor side, and our vibe coding guide covers building with these tools when you are not a full-time developer.

Your first week with Claude Code

Do these in your first week
  • Install natively and confirm claude --version
  • Run /init and cut the generated CLAUDE.md to what Claude cannot infer
  • Use plan mode on one multi-file change and edit the plan before approving
  • Give every task a check: a test, a build or a screenshot to compare
  • Add one PostToolUse hook for your formatter
  • Turn one procedure you keep pasting into a skill
  • Connect one MCP server your project actually needs
  • Check /usage at the end of each day to learn your real costs

Claude Code is one tool in building a real product. Our AI SaaS Builder program uses it, together with the Claude API, Supabase, Next.js and Stripe, to take an idea to a paid product.

Claude Code: FAQ

What is Claude Code?

Claude Code is Anthropic's agentic coding tool. It reads your codebase, edits files, runs commands and works with git, from a terminal CLI, extensions for VS Code, Cursor and JetBrains, a desktop app or the browser at claude.ai/code. You describe the outcome you want; Claude explores the code, plans, makes the changes and runs checks, asking permission according to the mode you choose.

How do I install Claude Code?

On macOS, Linux or WSL run curl -fsSL https://claude.ai/install.sh | bash; on Windows PowerShell run irm https://claude.ai/install.ps1 | iex. Homebrew, WinGet, Linux package managers and npm (Node.js 22 or later) also work. Open a new terminal, check claude --version, then run claude inside a project folder and log in when prompted. Native installs update themselves in the background.

Is Claude Code free?

No. Anthropic's setup docs say Claude Code needs a Pro, Max, Team, Enterprise or Console account, and the free claude.ai plan does not include it. Checked October 2026, Pro costs $17 a month billed annually ($200 up front) or $20 monthly, and Max starts at $100 a month. With a Console account you pay per token at API prices instead.

How much does Claude Code cost to run?

On Pro or Max the cost is your subscription, and usage counts against plan limits shown by /usage. On API billing you pay per token: Anthropic's costs page puts the average across enterprise deployments at about $13 per developer per active day and $150 to $250 per developer per month, with 90% of users under $30 per active day. Your own spend depends on model and context size.

What are Claude Code subagents, hooks and skills?

Subagents are helpers with their own context window, system prompt and tool access, defined as Markdown files in .claude/agents. Hooks are shell commands that run automatically at lifecycle events such as after every file edit. Skills are SKILL.md files with instructions or procedures that Claude loads only when relevant, or that you run as a slash command such as /deploy.

Should I use Claude Code or Cursor?

They overlap more each year, and Claude Code even runs inside Cursor as an extension. Pick Claude Code if you want an agent that works across the terminal, CI, the desktop app and the web with the same configuration, hooks and subagents. Pick an AI editor if you mostly want inline completions and edits while you type. Many developers use both.

Every guide in this hub

Free · no card needed

Start with the free Starter Kit.

A unit economics calculator from AI SaaS Builder, plus four more working files.

Starter Kit5 files · free
All Access · all four programs · $99/mo

Use Claude Code to ship something people pay for.

AI SaaS Builder, included in All Access, covers building with Claude Code and the Claude API, Supabase, Next.js and Stripe, with the other three programs, live coaching and the private community in one subscription.

See All Access: $99/mo →30-day money-back guarantee
Free

Learning Claude Code?

Join the free Discord to swap CLAUDE.md files, hooks and subagent configs with other builders.