Claude Code: Terminal Agent Setup and Workflow Guide

Install Claude Code, write a CLAUDE.md, and run safe agentic edits. Pricing, models, permission modes, and a beginner workflow — current as of June 2026.

TL;DR

Claude Code is Anthropic’s command-line coding agent. It lives in your terminal, reads and edits files across your whole repo, runs commands, and works task by task instead of one snippet at a time. It runs Anthropic models only — Claude Opus 4.7 and Sonnet 4.6 (June 2026). You get it through a paid Claude plan: Pro at $20/month ($17/month billed annually, which now also bundles Claude Cowork), or Max at $100/month (5x usage) and $200/month (20x). The free Claude.ai plan does not include Claude Code. The reliable loop is: /init to write a CLAUDE.md, plan before large edits with Shift + Tab, review every /diff, then run tests before you commit.

What Claude Code actually is

Claude Code is a terminal agent. You run one command, claude, inside a project, and from then on Claude can read your files, propose and apply edits across many of them, run your build and test commands, and report back — all without leaving the shell.

Two names get confused, so to be clear:

  • Claude Code: Anthropic’s command-line AI coding agent that reads, edits, and runs code in your terminal (and in VS Code or JetBrains via an extension that drives the same CLI).
  • Claude.ai: Anthropic’s web and desktop chat assistant. Useful for one-off questions, but it cannot touch your repo directly.

Claude Code runs only on Anthropic models. As of June 2026 the lineup is Claude Opus 4.7 (the strongest, top of the SWE-bench Verified leaderboard at 87.6%) and Claude Sonnet 4.6 (the fast workhorse). Switch between them mid-session with /model. On a Pro plan the default is Sonnet 4.6; Max plans default to Opus.

Who this is for

Developers comfortable with a terminal: you can cd into a directory, read a git diff, and run npm test or the equivalent without looking it up. If those are still unfamiliar, learn them first — Claude Code assumes you can drive the shell.

When to reach for it

Reach for Claude Code on multi-file changes, agentic tasks that need several steps (read, edit, run, fix), and exploring an unfamiliar codebase. For a single quick question or a throwaway snippet, plain Claude.ai chat is faster.

Pricing and access (June 2026)

You need a paid Claude subscription. The free Claude.ai tier does not unlock Claude Code.

PlanPrice (USD/month)Usage vs ProWhat you get
Pro$20 ($17 annual)baselineClaude Code + Claude Cowork; defaults to Sonnet 4.6
Max 5x$1005xHigher limits, Opus by default, priority access
Max 20x$20020xHighest limits for heavy daily agentic work

Two things catch people out. First, Claude Code and Claude.ai chat share the same usage budget — burning tokens in the browser eats into the same bucket your terminal agent draws from. Second, Team Standard ($20/seat) does not include Claude Code; the included version starts at Team Premium ($100/seat, 5-seat minimum), Enterprise, or any individual Pro/Max plan. You can also run it pay-as-you-go against an Anthropic API key (Console account) instead of a subscription. Check current numbers on the Claude pricing page.

Install it

Anthropic’s recommended path is the native installer (it auto-updates in the background). System requirements: macOS 13+, Windows 10 1809+, or Ubuntu 20.04+ / Debian 10+, with 4 GB RAM.

# macOS, Linux, WSL
curl -fsSL https://claude.ai/install.sh | bash
# Windows PowerShell
irm https://claude.ai/install.ps1 | iex

Prefer a package manager? brew install --cask claude-code on macOS, winget install Anthropic.ClaudeCode on Windows, or the npm global package (needs Node.js 18+):

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

Do not run the npm install with sudo — it causes permission problems. If you hit EACCES errors, use a Node version manager like nvm or point npm at a directory you own. Confirm the install, then run a health check:

claude --version
claude doctor

The first time you run claude it opens a browser to log in. Full options are in the official setup docs.

First task in 60 seconds

  1. cd into a project root (the level with package.json, pyproject.toml, Cargo.toml, or .git).
  2. Run claude and finish the browser login.
  3. Type /init to generate a CLAUDE.md.
  4. Give it a small, concrete task: Add a /health endpoint to src/server.ts that returns 200 and the build SHA. Show me the plan first, do not edit yet.

Keyboard Shortcuts Guide

Claude Code shortcuts can vary by terminal, IDE, operating system, and version. The safest habit is to press ? inside a session to see the shortcuts available in your current environment. If Shift + Enter does not insert a newline, run /terminal-setup first.

Shortcut / inputWhat it doesWhen to use it
?Shows the current shortcut helpWhen you forgot a key, changed terminals, or just installed Claude Code
Ctrl + CCancels the current input or interrupts generationWhen Claude is going off track or a command is taking too long
EscInterrupts the current Claude response or tool callWhen you want to redirect without losing the completed work
Esc then EscOpens the rewind / checkpoint menuWhen you need to return to an earlier conversation or code state
Shift + TabCycles permission modes: default, auto-accept edits, Plan, and related modesWhen moving from planning to editing, or tightening permissions again
Ctrl + RSearches prompt historyTo recover an earlier long prompt or command
/ Browses prompt history; also moves within multiline inputTo reuse or adjust the previous task
Ctrl + OOpens the detailed transcript viewTo inspect which files Claude read and which tools it ran
Ctrl + LRedraws the terminal screenWhen the terminal display looks stale or broken
Ctrl + BBackgrounds a running taskWhen a long task should not block the current screen
Ctrl + TShows or hides the task listWhen background tasks, subagents, or long commands are running
Ctrl + A / Ctrl + EMoves to the start / end of the current lineWhen editing a long prompt
Ctrl + K / Ctrl + U / Ctrl + WDeletes to end of line / start of line / previous wordTo rewrite input quickly
Ctrl + YPastes back recently deleted textTo recover a prompt fragment you just removed
Shift + EnterInserts a newlineFor multiline requirements, logs, or checklists
Ctrl + JInserts a newline in many terminalsFallback when Shift + Enter is not supported
\ then EnterUniversal newline inputWorks across terminal setups
/ at the startOpens the command / skill menuTo find /plan, /diff, /skills, or a custom skill
@ + pathReferences a file or directoryTo tell Claude exactly which file, component, or config directory to read
! at the startEnters shell mode and brings command output back into contextTo show Claude npm test, git status, or logs

On macOS, shortcuts such as Option + P for model switching, Option + T for thinking mode, and Option + O for fast mode may require configuring Option as Meta in your terminal. iTerm2, Apple Terminal, and VS Code place this setting in different places; if the shortcut does nothing, check the terminal settings first.

The working loop, step by step

1. Start from the right directory

Enter the project root, then run:

claude

The project root is usually the level with package.json, pyproject.toml, Cargo.toml, or .git. Avoid launching from src/, app/, or components/; otherwise Claude may reason from a partial project view.

2. Initialize project memory first

For a new repository, run:

/init

This creates or updates CLAUDE.md. Include:

  • What the project is and the main tech stack.
  • Common commands: install, dev, test, build, format.
  • Directory map: pages, components, APIs, scripts, and tests.
  • Files Claude should avoid: production config, migrations, generated output, secrets-related files.
  • Code style: naming, component organization, error handling, testing habits.

Use /memory later to view or edit the active CLAUDE.md.

3. Plan before large edits, and know the permission modes

For broad changes, do not start with code. Press Shift + Tab to cycle the session’s permission mode. The status bar shows where you are:

  • default — Claude asks before each file edit and each shell command.
  • acceptEdits (auto-accept edits) — applies file edits and basic filesystem commands without asking, but still prompts for other Bash commands. Use it for a tight edit-then-git diff loop.
  • plan — Claude researches and proposes changes without touching anything. Approving the plan exits plan mode and starts editing.

There is also auto mode (requires Claude Code v2.1.83+), where a separate classifier model vets each action before it runs and blocks anything that escalates beyond your request — a safer middle ground than bypassPermissions, which disables checks entirely and should only run in a throwaway container or worktree.

Open a session in plan mode and give it a scoped brief:

Add a forgot-password flow to the login page. Read the relevant files and propose an implementation plan. Do not edit code yet.

Review three things:

  • Did it read the right files?
  • Did the plan expand beyond the requested scope?
  • Did it include validation: tests, build, or manual check paths?

If the plan is too large, narrow it: “UI only, no API integration”, “only these two files”, or “write tests first, do not implement.”

4. Use /skills and specific /skill-name commands

People sometimes say “use /skill”, but the more reliable model is:

  • Type / to open available commands, built-in workflows, plugin commands, and skills.
  • Use /skills to list skills available in the current session.
  • To run a skill, use its own slash name, such as /security-review, /simplify, or /claude-api; follow what your / menu shows.
  • Custom skills usually live in .claude/skills/<name>/SKILL.md, and the invocation name is usually /<name>.

Use a skill when:

  • The task has a repeatable workflow, such as security review, release checks, API migration, or documentation generation.
  • The workflow needs reference docs, scripts, or templates, not just a short prompt.
  • The team wants everyone to run the same checklist.

Skip a skill when:

  • The task is a one-off small question and a direct prompt is faster.
  • You only need to reuse one short instruction; a custom slash command or prompt template is enough.

5. Put boundaries around execution

After approving a plan, give Claude a narrow task:

Execute step 1 from the plan. Only modify files under src/routes/auth and src/components/auth. Do not commit. When done, list changed files and validation commands.

Good boundaries usually include:

  • Which files or directories may change.
  • Which files or directories must not change.
  • Which step this round covers.
  • What validation should run after the edit.
  • Whether Claude may commit. Default to no unless you explicitly ask.

6. Review the diff before continuing

After each round, check:

/diff

Look for:

  • Unrelated files changed.
  • New dependencies, config, or environment variables.
  • Code that looks complete but does not cover the real path.

If the diff is wrong, press Esc, or use Esc + Esc to rewind. For small problems, say: “Keep A, revert B, only fix C.”

7. Finish with tests and builds

Before Claude validates, specify the commands:

Run npm test and npm run build. If either fails, explain the failure first; do not make broad edits immediately.

If the project has no tests, ask for at least:

  • git diff --check for whitespace errors.
  • Typecheck or build.
  • Manual checks for key pages or APIs.
  • A list of anything Claude could not verify.

8. Manage context during long tasks

When context gets long, use:

  • /context to see what is taking up context.
  • /compact to summarize the session; add: “Keep changed files, open todos, validation results, and omit casual chat.”
  • /clear to start a new task while keeping CLAUDE.md project memory.
  • /resume to return to an earlier session.

A useful habit after each milestone:

Summarize current state: changed files, key decisions, test results, remaining todos, and recommended next step. Keep it under 20 lines.
  1. Run claude in the project.
  2. Use /init to create CLAUDE.md.
  3. Press Shift + Tab into plan mode before editing.
  4. Approve one small step.
  5. Review with /diff.
  6. Run tests / build.
  7. Commit manually.
  8. Move to the next step.

Three mistakes that cost the most time

  • Launching from a subdirectory. Run claude from the repo root, not src/ — otherwise the agent reasons from a partial view and edits the wrong files.
  • Skipping CLAUDE.md. Without it, every session re-derives your stack and conventions, and gets them wrong more often.
  • Letting it commit unreviewed. Read the /diff first, every round. Unreviewed commits are the top source of regressions.

FAQ

Q: How much does Claude Code cost? A: It is included with a paid Claude plan: Pro at $20/month ($17/month billed annually), or Max at $100/month (5x usage) and $200/month (20x), as of June 2026. The free Claude.ai plan does not include it. You can also pay per token against an Anthropic API key. Claude Code and Claude.ai chat share one usage budget, so heavy browser chats reduce what is left for the terminal agent.

Q: Which model does Claude Code use, and can I change it? A: It runs Anthropic models only — Claude Opus 4.7 (strongest) and Sonnet 4.6 (faster). Pro defaults to Sonnet 4.6; Max defaults to Opus. Switch any time with /model. It cannot run GPT-5.5 or Gemini; for that, use a multi-model IDE like Cursor instead.

Q: Do I need to know the command line? A: Basic terminal comfort is required. You run claude in your project root, navigate directories, and read diff output. If cd, git status, and ls are not familiar yet, learn those first.

Q: What is CLAUDE.md for? A: It is the persistent project brief Claude Code reads on every run — coding conventions, build and test commands, the directory map, and files to leave alone. Generate it with /init and edit it with /memory.

Q: Will Claude Code commit changes automatically? A: Only if you ask. By default it edits files but does not commit. Keep it that way, review the /diff, and treat its output like a junior teammate’s pull request.

Q: How is this different from chatting with Claude.ai? A: Claude.ai is a web chat that cannot touch your repo. Claude Code is an agent in your terminal that reads and edits files and runs commands. Use Claude.ai for one-off questions, Claude Code for multi-file changes in a real codebase.

Tags: #Claude #Tutorial #Claude Code