Claude Code: The Complete Guide (2026)
Claude Code is Anthropic's command-line coding agent. It lives in your terminal, reads and edits the files in your repository, runs shell commands, and works through multi-step tasks on its own. This guide explains how to use Claude Code the way it's meant to be used: as an agent you delegate work to, not an autocomplete box you babysit.
I've been running Claude Code daily across client sites, internal tools, and one-off scripts. The pattern that separates people who get value from it and people who get frustrated is simple. The frustrated ones treat it like a smarter Copilot. The productive ones set up the project memory, the tools, and the agent team once, then hand off whole features and review the result.
This is the hub. Each section below is a short, concrete overview that links out to a deeper guide on that one piece. If you already know what Claude Code is and just want the parts that move the needle, jump to CLAUDE.md, MCP servers, and subagents.
One shortcut before we start: if you want a working setup instead of a blank terminal, grab the free Claude Code Agent Team Starter Pack. It's a 5-agent team you drop into any repo. I reference it throughout this guide because it's the configuration I actually use.
What Is Claude Code?
Claude Code is an agentic coding tool that runs in your terminal and operates on your whole project rather than the line you're typing. You give it a goal in plain language. It reads the relevant files, decides what to do, edits code, runs tests, reads the output, and keeps going until the task is done or it needs your input.
That "keeps going on its own" part is the difference from inline assistants. An autocomplete tool predicts the next few tokens at your cursor. Claude Code plans across many files, runs commands, and reacts to what it sees. It's closer to handing a task to a junior engineer than to using a fancy snippet expander.
It runs on Anthropic's Claude models, usually Opus for planning and heavier reasoning and Sonnet for faster execution, and you can switch between them mid-session. Crucially, it asks permission before running commands or editing files unless you've pre-approved those actions, so you stay in control of anything destructive.
The short version: Claude Code reads your repo, writes the change in the smallest reasonable diff, runs the checks, and reports back. The skill is in setting up the memory, tools, and guardrails so it does that well, which is what the rest of this guide covers.
Once you're comfortable with the basics, you extend it. Reusable shortcuts become Claude Code skills, external data and APIs come in through Claude Code MCP servers, and specialized roles become subagents. Each of those gets its own section below.
Installing & First Run
Installation is one command. Claude Code ships as an npm package, so you need Node installed, then:
npm install -g @anthropic-ai/claude-code cd your-project claude
On first launch it walks you through authentication, either with your Anthropic account (Pro or Max) or an API key. From there you're in an interactive session inside your project. Type a request in plain English and it goes to work.
The first thing I do in any new repo is run /init. That generates a starter CLAUDE.md by reading your project structure, so the agent has baseline context from session one. The second thing I do is drop in a subagent team. Both are covered below.
First-run tip: resist the urge to fire off a giant task immediately. Start with something small and read-only, like "explain how auth works in this codebase," to see how it reads files and reports. You'll learn its rhythm faster than by throwing a feature at it cold.
How Claude Code Works: The Agent Loop
Under the hood, Claude Code runs an agent loop. Every turn follows the same pattern: the model decides what to do, calls a tool, reads the result, and decides again. It repeats until the task is done or it needs you.
Tools, Permissions, and Context
Three concepts make the loop work, and understanding them is what turns Claude Code from a toy into a tool:
| Concept | What It Is | Why It Matters |
|---|---|---|
| Tools | Actions the agent can take: read file, edit file, run a shell command, search, call an MCP server | Every action is a tool call. More tools (via MCP) means more the agent can do. |
| Permissions | The allow/ask/deny rules that gate each tool. Configured in settings. | Controls what runs without asking. Pre-approve safe reads; require confirmation for deploys. |
| Context | Everything currently in the model's window: your messages, file contents, tool output | Bigger context costs more tokens and dilutes focus. Managing it is the core skill. |
Permissions are where most teams either feel safe or get burned. By default Claude Code asks before it runs a command or edits a file. You can loosen that with an allowlist for safe, repetitive actions (like running tests) and tighten it for anything outward-facing. The right setup lets the agent move fast on chores while still stopping to ask before it deploys or deletes.
Context is the other lever, and it's the one that costs you money. Every file the agent reads and every tool result stays in the window and gets re-sent on the next turn. That's why a tidy CLAUDE.md and tight task scoping matter so much, which is the next section.
CLAUDE.md & Context Engineering
CLAUDE.md is a Markdown file that Claude Code reads automatically at the start of every session. It's your project's memory. Build commands, naming conventions, the deploy method, and the gotchas that bit you last week all live here, and the agent picks them up without you re-explaining anything.
This is the single highest-leverage thing you can set up. A project with a good CLAUDE.md gets fewer wrong assumptions, fewer "wait, we don't use that library" corrections, and more changes that match how your code already works. A project without one makes the agent guess every session.
What Belongs in CLAUDE.md
- Commands: how to build, test, lint, and run the project
- Deploy method: exactly how this project ships, so the agent never guesses
- Conventions: naming, file structure, the patterns to match
- Gotchas: the non-obvious traps and the bugs you've already fixed once
- What to ignore: generated folders, vendor code, anything not worth reading
Keep it short.
CLAUDE.md is loaded on every single turn, so every line is a recurring token cost. A bloated 5,000-word memory file quietly inflates your bill and buries the rules that matter. Treat it like a cheat sheet, not a wiki. Prune it the way you'd prune a README you actually maintain.
"Context engineering" is just the discipline of deciding what the agent should and shouldn't be carrying. CLAUDE.md is the persistent layer; clearing the conversation between unrelated tasks is the per-session layer. Get both right and the agent stays sharp and cheap. Our full CLAUDE.md guide walks through a template and real examples.
MCP Servers: Giving Claude Code New Tools
Out of the box, Claude Code can read files, edit them, and run shell commands. MCP servers extend that. MCP, the Model Context Protocol, is an open standard for connecting an agent to external tools and data: a database, a browser, a design tool, a third-party API, your file system.
Once an MCP server is configured, its tools show up alongside the built-in ones and the agent calls them like any other action. Want Claude Code to query your Postgres database, drive a real browser, or pull live docs for a library? That's an MCP server. It's the difference between an agent that can only touch local files and one that can reach into the systems your work actually depends on.
Common MCP Servers
- Filesystem & shell control: broader file and process access than the defaults
- Databases: query and inspect Postgres, Supabase, and others directly
- Browsers: drive a real browser to test pages and scrape content
- Docs: pull current library documentation instead of relying on training data
One MCP server worth knowing early is Desktop Commander, which gives the agent deeper control over your machine's files and terminal. I walk through it in the Desktop Commander MCP guide. For the full setup process and a shortlist of servers worth installing, see the Claude Code MCP servers guide.
Subagents & Agent Teams
Subagents are specialized agents defined as Markdown files in your project's .claude/agents/ folder. Each one has its own system prompt, its own tool permissions, and, importantly, its own context window. The main thread delegates a single step to a subagent, the subagent does that one job in isolation, and only the distilled result comes back.
That isolation is the whole point. A research sweep that reads 40k tokens of code stays in the researcher's context. The implementer never sees that noise, only the clean summary of what it needs to change. You get specialist focus on each step and a main thread that stays uncluttered. You also pin each subagent to a model, so a planning agent runs on Opus while a routine research agent runs on cheaper Sonnet.
A Concrete 5-Agent Team
Here's the team I actually run, which is the same one in the free starter pack:
| Agent | Role | Model | Edits Code? |
|---|---|---|---|
| orchestrator | Plans, decomposes, delegates in order. Entry point for any 3+ step task. | Opus | No |
| researcher | Read-only scout. Maps the code and cites file:line. | Sonnet | No |
| implementer | Writes the change in the smallest diff and verifies what it touched. | Opus | Yes |
| reviewer | Adversarial review against the plan. Blocking vs non-blocking findings. | Opus | No |
| shipper | Final gate: test, build, deploy and verify. Confirms before destructive actions. | Sonnet | No |
The flow is research → implement → review → ship, one step at a time. The orchestrator never writes code; it passes the actual artifact forward, not a paraphrase. The review step is what catches the plausible-but-wrong changes a single pass would have shipped.
Free Download
Claude Code Agent Team Starter Pack
The exact 5-agent team from this section, ready to drop into any repo. Orchestrator, researcher, implementer, reviewer, and shipper, each with its prompt, tool permissions, and model already set. Free.
Get the Free Agent TeamSlash Commands & Hooks
Two more features turn Claude Code from an assistant into something you can shape around your own workflow: slash commands and hooks.
Slash Commands
A slash command is a saved prompt you trigger with /name. Instead of retyping "review the current diff for bugs and check it against our conventions" every time, you save it once and call /review. Built-ins like /init and /clear ship with it; the more advanced versions are what Anthropic now packages as skills. Our Claude Code skills guide covers building your own.
Hooks
Hooks are shell commands that fire automatically on events, like after the agent edits a file or before it finishes a turn. The classic use is running your formatter or linter on every edit so the agent's output is always clean, or blocking a commit that fails a check. Anything you'd describe as "every time X happens, do Y" belongs in a hook, because the harness runs it deterministically rather than relying on the model to remember.
You don't need either to get started. But once a workflow repeats more than a few times, turning it into a slash command or a hook is what keeps your sessions fast and consistent.
Managing Token Cost
Claude Code bills against a Claude subscription or API credits, and most of the cost is input tokens. The agent re-reads files and re-sends conversation history on every turn, so a long, messy session gets expensive fast. The good news: the same habits that cut cost also improve output quality, because a focused context produces better reasoning.
Where the Tokens Go, and How to Cut Them
- Trim CLAUDE.md. It loads every turn, so every extra paragraph is a recurring tax.
- Clear between tasks. Run
/clearwhen you switch to something unrelated so old context stops re-sending. - Scope tightly. Point the agent at the files that matter instead of letting it explore the whole repo.
- Right-size the model. Let Sonnet handle routine edits and reserve Opus for planning and hard reasoning.
- Use subagents. A heavy research sweep stays in the subagent's window instead of bloating your main thread.
I go deep on this, including how to read your usage and where the spend actually hides, in the Claude Code token optimization guide. If you're hitting usage limits on a Pro or Max plan, the Claude Code credits breakdown explains how the limits and credits actually work.
Claude Code vs Other AI Coding Tools
Claude Code isn't the only AI coding tool, and it isn't the right one for every moment. The useful distinction is between inline assistants and agents.
| Tool | Shape | Best At |
|---|---|---|
| Claude Code | Terminal agent | Autonomous multi-step tasks, refactors, automation, scripting |
| Cursor | AI IDE | Tight inline editing and autocomplete while you type |
| GitHub Copilot | Inline assistant | Line-by-line suggestions in your existing editor |
In practice these aren't mutually exclusive. Plenty of developers keep an IDE assistant for the tight loop of writing code by hand and reach for Claude Code when they want to delegate a whole feature or chore. The full breakdown, including where each one wins and loses, is in our Claude Code vs Cursor comparison.
Common Workflows
Theory aside, here's what using Claude Code looks like day to day. Two patterns cover most of my work.
Ship a Feature
For anything more than a one-liner, I hand the task to the orchestrator and let the team run. The orchestrator restates the goal, lists acceptance criteria, then sends the researcher to map the relevant files. The implementer makes the change in the smallest diff, the reviewer checks it against the plan, and the shipper runs the tests, builds, and (with my confirmation) deploys. My job shrinks to writing a clear request and reviewing the result.
> use the orchestrator to add email verification to the signup flow
orchestrator → researcher (maps auth + signup files)
→ implementer (writes the change)
→ reviewer (checks vs acceptance criteria)
→ shipper (test, build, deploy — asks first)Automate a Repetitive Task
The other big win is chores: bumping dependencies, migrating a config format across dozens of files, generating boilerplate, cleaning up dead code. These are exactly the tasks a single autonomous pass handles well, because the steps are mechanical and verifiable. Describe the chore, let it run, and check the diff. Wrap the ones you repeat in a slash command so next time it's one word.
Want this set up for you? If you'd rather have your team's Claude Code workflow, agents, and guardrails configured properly instead of figuring it out yourself, that's exactly what our AI Workflow Audit ($750) does. We map your workflow and hand back the configuration.
Best Practices
After a few hundred sessions, the habits that consistently produce good results come down to a handful of rules.
- Invest in CLAUDE.md first. It's the highest-leverage setup step. Every wrong assumption you fix once belongs in it.
- Delegate, don't micromanage. For 3+ step work, hand it to an orchestrator and review the output rather than driving each edit by hand.
- Keep the review step. A second adversarial pass catches the plausible-but-wrong changes a single pass ships.
- Require evidence. Make the agent run the check and paste the output. Never accept "the build passed" without seeing it.
- Confirm before destructive actions. Deploys, deletes, and anything outward-facing should require an explicit yes.
- Clear between tasks. A fresh context is cheaper and sharper than a long, drifting one.
- Stay in scope. Out-of-scope discoveries get reported back, not silently expanded into the change.
None of these are exotic. They're the same standards you'd expect from a careful engineer, encoded into how you set the agent up. The starter pack bakes them into every agent's prompt so you don't have to remember them.
Frequently Asked Questions
What is Claude Code?
Claude Code is Anthropic's command-line coding agent. It runs in your terminal, reads and edits files in your repository, runs shell commands, and works through multi-step tasks on its own using a read-act-observe loop. Unlike an autocomplete tool, it operates on the whole project rather than the current line, and it asks permission before running commands or editing files unless you have pre-approved them.
How do I install Claude Code?
Install it with npm: run 'npm install -g @anthropic-ai/claude-code', then run 'claude' inside any project directory. On first launch it walks you through authentication with your Anthropic account or an API key. You can also point it at an existing repo and run '/init' to generate a starter CLAUDE.md file that documents the project for future sessions.
Is Claude Code free?
No. Claude Code bills against either a Claude Pro/Max subscription or pay-as-you-go API credits. Most of the cost comes from input tokens, since the agent re-reads files and conversation history on each turn. You control spend by keeping context tight, using cheaper models for routine work, and clearing the conversation between unrelated tasks.
What models does Claude Code use?
Claude Code runs on Anthropic's Claude models, typically Opus for heavy reasoning and planning and Sonnet for faster, cheaper execution. You can switch models mid-session, and subagents can each be pinned to a specific model so that, for example, a planning agent uses Opus while a research agent uses Sonnet.
What is a CLAUDE.md file?
CLAUDE.md is a Markdown file Claude Code reads automatically at the start of every session. It acts as persistent project memory: your build commands, conventions, deploy method, and gotchas. A good CLAUDE.md means you stop re-explaining your project every time and the agent makes fewer wrong assumptions.
What are MCP servers in Claude Code?
MCP (Model Context Protocol) servers are plugins that give Claude Code new tools and data sources, such as a database, a browser, your file system, or a third-party API. Once an MCP server is configured, its tools appear alongside the built-in ones and the agent can call them directly. They are how you extend Claude Code beyond reading and editing local files.
What are subagents in Claude Code?
Subagents are specialized agents defined as Markdown files in your project's .claude/agents/ folder. Each has its own system prompt, its own tool permissions, and its own context window. The main thread delegates a step to a subagent, the subagent does that one job in isolation, and only the distilled result comes back, which keeps the main context clean and improves quality.
Is Claude Code better than Cursor?
They solve overlapping problems differently. Cursor is an IDE built around inline editing and autocomplete. Claude Code is a terminal agent built around autonomous multi-step tasks and is easy to script and automate. Many developers use both: Cursor for tight edit loops while typing, Claude Code for delegating whole features, refactors, and chores. We cover the trade-offs in our Claude Code vs Cursor comparison.
How do I reduce Claude Code token costs?
Keep CLAUDE.md short, clear the conversation between unrelated tasks, scope each request to the files that matter, and route heavy reasoning to Opus while letting Sonnet handle routine edits. Subagents help too, because a research sweep that burns 40k tokens stays in the subagent's context instead of polluting your main thread.
Can Claude Code deploy code on its own?
It can, but only if you let it. Claude Code asks permission before running commands and editing files unless you have pre-approved those actions in settings. For outward-facing actions like deploys or deletes, the safe pattern is to require confirmation, which is exactly how the shipper subagent in our starter pack is configured.
Go From Reading About It to Building With It
This guide covers the map. If you want the hands-on version, Build with Claude Code is a $299 course that takes you from install to shipping real features with an agent team, MCP servers, and a token budget that doesn't spiral.
It's built on the exact setup in this article: the 5-agent team, a tight CLAUDE.md, the MCP servers worth installing, and the workflows I use on client work every day. The founding cohort waitlist is open now.
Join the Founding WaitlistRelated reading:
- Claude Code Skills
- Claude Code MCP Servers
- CLAUDE.md Guide
- Claude Code vs Cursor
- Claude Code Token Optimization
- Free Claude Code Agent Team Starter Pack
- Build with Claude Code (Course)
Last updated: May 2026

Written by
Sep Gaspari
Founder & Digital Marketing Strategist, Zio Advertising | Kelowna, BC
15+ years in digital marketing, Google Ads, and SEO. I've helped businesses across 12+ industries generate qualified leads and grow revenue through data-driven strategies. I don't just run campaigns—I obsess over results, test relentlessly, and treat your budget like it's my own.
Connect on LinkedIn→
