Projects Blog Tools Music Contact
← All Posts
Tech July 14, 2026

Everything Claude Code: Anthropic's AI CLI Guide (2026)

By: Evgeny Padezhnov

Illustration for: Everything Claude Code: The Complete Guide to Anthropic’s AI Coding Tool (2026)

Claude Code is an agentic coding tool that runs where developers already work: the terminal. It reads files, edits code, runs commands, and drives a full task from one prompt. Anthropic ships it as a CLI, an IDE extension, a desktop app, and a web app. This guide covers what it does, how it is built, and how to use it without wasting tokens or trust.

What Claude Code Actually Is

Claude Code is not a chat window bolted onto an editor. It is an agent with tools. Given a task, it plans, reads the codebase, makes edits, runs tests, and reports back. The model decides which files to open and which commands to run.

The tool runs on Anthropic's Claude models. As of 2026 the family includes Opus 4.8, Sonnet 5, and Haiku 4.5. Opus handles the hardest reasoning. Haiku is the fast, cheap tier for routine calls. The exact model IDs are claude-opus-4-8, claude-sonnet-5, and claude-haiku-4-5-20251001.

Model Model ID Best for Relative speed Relative cost
Opus 4.8 claude-opus-4-8 Hardest reasoning, complex refactors Slower Highest ($5/M in, $25/M out)
Sonnet 5 claude-sonnet-5 Balanced day-to-day coding Fast Medium
Haiku 4.5 claude-haiku-4-5-20251001 Routine, high-volume calls Fastest Lowest

Switch tiers with /model; /fast keeps Opus but speeds output rather than dropping to a smaller model.

The core idea worth internalizing: Claude Code is agentic by default. It acts, not just suggests. That changes how developers review its work — you check diffs and command output, not chat replies.

Full documentation lives at the official Claude Code docs.

Installation and First Run

The CLI installs through npm as a global package.

npm install -g @anthropic-ai/claude-code
claude

Running claude in any project directory starts an interactive session. The tool detects the working directory, checks whether it is a git repository, and reads the local CLAUDE.md if one exists.

Authentication uses either a Claude subscription (Pro or Max) or an Anthropic API key. Subscription auth logs in through the browser. API auth reads ANTHROPIC_API_KEY from the environment.

Common mistake: setting ANTHROPIC_API_KEY while logged in with a Max subscription. The key can override subscription auth and route usage to metered billing. Practice shows this surfaces as unexpected "credit low" messages. Check which auth is active before debugging billing.

Model selection happens with /model or a config flag. Fast mode, toggled with /fast, keeps Opus but speeds output. It does not downgrade to a smaller model.

How the Agent Loop Works

Claude Code operates in a loop: read context, call a tool, read the result, decide the next step. Each tool call is explicit and reviewable.

   ┌───────────────┐
   │  Read context │
   └───────┬───────┘
           ▼
   ┌───────────────┐     independent tool calls
   │   Call tool   │ ◄── run in parallel in one turn
   └───────┬───────┘
           ▼
   ┌───────────────┐
   │  Read result  │
   └───────┬───────┘
           ▼
   ┌───────────────┐   more steps needed
   │    Decide     │ ────────────────────┐
   └───────┬───────┘                     │
           │ done                        │ loop back to
           ▼                             ▼
   ┌───────────────┐              ( Call tool )
   │    Report     │
   └───────────────┘

The core tools are narrow and predictable:

Independent tool calls run in parallel in a single step. Reading three files at once is one turn, not three. This matters for speed on large tasks.

Concretely, the model does not hallucinate file contents. It reads the file, then edits the exact text. If the target string is not unique or does not match, the edit fails loudly instead of corrupting the file.

CLAUDE.md: Project Memory That Survives Sessions

CLAUDE.md is the most important file for real work. Claude Code loads it automatically at session start. It holds project-specific instructions that override default behavior.

Put durable facts here: build commands, test commands, architecture notes, and hard rules. A good CLAUDE.md answers "how do I not break this repo" before the agent touches anything.

# Project: payment-service

## Commands
- Test: `npm run test:unit`
- Build: `npm run build`
- Lint: `npm run lint --fix`

## Rules
- Never edit files in `/generated` — they come from codegen.
- All DB changes go through migrations in `db/migrations/`.

The /init command bootstraps a CLAUDE.md by scanning the codebase. It documents structure, conventions, and commands automatically. Edit the result — generated docs are a starting point, not the final word.

There is a second memory layer. A persistent file-based memory stores facts across sessions as small Markdown files with frontmatter. It captures who the user is, feedback on how to work, and ongoing project state. Key point: this memory lives on the machine. If the box is rebuilt, that memory is gone unless it was committed to git or a database. Treat local memory as a cache, not a source of truth.

Slash Commands and Plan Mode

Slash commands trigger built-in and custom actions. Common ones:

Plan mode is a safety gate for large or risky changes. In plan mode the agent researches and drafts a plan without editing files. The developer approves the plan before any write happens. Try it: enter plan mode before a refactor that touches many files. Review the plan, then let it execute. This catches wrong assumptions before they become 30 bad edits.

Custom slash commands live as Markdown files in .claude/commands/. Each file becomes a reusable prompt. Teams share them through the repo, so everyone runs the same review or deploy routine.

Subagents: Parallel Work Without Context Bloat

Subagents are separate agent instances launched for a scoped task. The parent delegates, the subagent works in its own context, and only the final result returns to the parent. The parent keeps the conclusion, not the raw file dumps.

This solves a real problem. Searching across a large codebase floods the main context with file contents. A subagent does the search, reads what it needs, and returns a short answer. The main session stays clean.

Built-in agent types cover common cases. An Explore agent runs read-only searches across many files. A Plan agent designs implementation strategy. A general-purpose agent handles open-ended multi-step work. Custom agent types are defined in .claude/agents/.

When several searches are independent, launch subagents in one message. They run concurrently. On a wide audit, this turns a long sequential crawl into a parallel fan-out.

A frequent misuse: delegating a single-file lookup you could do directly. Subagents have setup cost. Use them when the work spans many files, or when you need a conclusion instead of the file contents.

MCP: Connecting External Tools and Data

The Model Context Protocol (MCP) is an open standard for connecting AI tools to external systems. MCP servers expose tools — database queries, API calls, ticket lookups — that Claude Code can call like any built-in tool.

An MCP server can wrap a Postgres database, a Jira board, a monitoring dashboard, or an internal service. Once connected, the agent queries live data instead of guessing. A get_task tool returns the actual ticket. A search_memory tool returns real prior decisions.

Configuration lives in the Claude Code settings. Servers connect over stdio or HTTP. The Model Context Protocol specification documents the standard and lists reference servers.

Key point: MCP is why Claude Code fits into existing infrastructure. It reads the systems a team already runs, so answers reflect production state, not a stale snapshot.

One caveat from practice: interactively-authenticated MCP servers may be missing in headless or scheduled runs. If a cron job cannot reach a server that works interactively, check the auth model first.

Hooks and Permissions: Control What the Agent Does

Hooks run shell commands at defined points in the agent lifecycle. They are configured in settings.json, not requested from the model. The harness executes them, which makes them reliable.

Hook events include PreToolUse and PostToolUse. A PreToolUse hook can inspect a tool call and block it. A PostToolUse hook can run a formatter after every edit. This is how teams enforce "run prettier after each write" or "never allow rm -rf on production paths."

Permission modes control how much the agent can do without asking. Read-only modes require approval for every write. Looser modes auto-approve safe operations. A denied tool call is real feedback — the agent should adapt, not retry the same command.

Automated behaviors — "whenever X happens, do Y" — must be hooks. The model cannot promise to always run a command; only the harness guarantees it. If a rule must hold every time, encode it as a hook.

Skills: Packaged Expertise

Skills are reusable capabilities the agent invokes on demand. Each skill bundles instructions and sometimes scripts for a specific job. Examples include a deep-research harness, a security review, a verify routine that runs the app and checks behavior, and a config editor.

Skills keep specialized knowledge out of the main prompt until needed. The agent loads a skill only when the task matches. A security-review skill runs a full review of pending branch changes. A verify skill launches the app to confirm a fix works in reality, not just in tests.

In practice, skills turn one-off expert workflows into repeatable commands. A team writes the review process once. Every session runs it the same way.

Where Claude Code Runs

The same agent ships across four surfaces:

Context and configuration carry across surfaces where they share a project. CLAUDE.md, skills, and MCP servers work the same in the CLI and the IDE.

How Claude Code Compares

Claude Code is one of several agentic coding tools. The differences are in interface, autonomy, and how far each one extends.

Dimension Claude Code Cursor Aider GitHub Copilot
Interface Terminal, IDE, desktop, web AI-first IDE (VS Code fork) Terminal IDE plugin + CLI
Agentic autonomy High — plans and drives full tasks High — agent mode Medium — chat-driven edits Medium — agent mode, growing
Multi-file edits Yes Yes Yes Yes
Extensibility (MCP/plugins) MCP, hooks, skills, subagents MCP + extensions MCP support Extensions + MCP
Plan/review gate Plan mode + /code-review Manual diff review Per-change diff preview PR-level review
Pricing model Subscription (Pro/Max) or API key Free / ~$20 Pro / ~$40 Teams Free OSS + your API key Free / ~$10 Pro / ~$19 Business

Claude Code is source-available (not open source); Aider is fully open source and runs on your own API key.

A Practical Workflow

A reliable pattern for non-trivial tasks:

  1. Write or update CLAUDE.md with build and test commands.
  2. Enter plan mode for the task. Review the plan.
  3. Let the agent execute, running tests as it goes.
  4. Run /code-review on the diff before committing.
  5. Commit only when the user asks, on a branch, not the default branch.

In practice this loop catches wrong assumptions at the plan stage and bugs at the review stage. The cost is two review passes. The payoff is fewer broken commits.

Common mistake: dumping a vague one-line prompt and accepting the first result. Specific context produces specific work. Name the files, the constraint, and the definition of done. The agent is only as scoped as the prompt.

Another failure mode worth naming honestly: on very long sessions, context fills and gets summarized. Facts established early can lose fidelity after compaction. For long-running work, keep durable facts in CLAUDE.md or a database, not only in the conversation.

What to Try Right Now

Run /init in a real repository. Read the generated CLAUDE.md, then add your exact test and build commands and one hard rule the agent must never break. Start the next task in plan mode and approve the plan before any edit. That single habit — plan, review, then execute — prevents most of the damage an over-eager agent can do, and it costs nothing but one extra confirmation.

For deeper reference, the Anthropic engineering blog documents patterns for agentic coding, subagent design, and context management drawn from building the tool itself.

Information is accurate as of the publication date. Terms, prices, and regulations may change — verify with relevant professionals.

✦ Squeeze AI
  1. Claude Code is agentic by default: it reads files, edits code, and runs commands autonomously rather than suggesting changes. This shifts the review workflow — developers check diffs and command output, not chat replies.
  2. Independent tool calls run in parallel within a single agent step — reading three files simultaneously counts as one turn, not three, which reduces latency on large tasks.
  3. Setting ANTHROPIC_API_KEY in the environment while authenticated with a Pro/Max subscription can silently override subscription auth and route all usage to metered billing, surfacing as unexpected "credit low" errors.
  4. The Edit tool performs exact string replacement against the actual file content it just read, not a cached or inferred version — so a non-unique target string will cause the edit to fail rather than produce a silent wrong result.

Powered by B1KEY