Skip to main content
Claude Code Author: 16 min read
Published:

Claude Code Tutorial 2026 — Complete English Guide

Complete English tutorial for Claude Code in 2026: CLI install, first project, hooks, slash commands, MCP servers, Agent SDK, and production workflows — step by step, nothing skipped.

Table of contents

Claude Code is Anthropic's official agentic coding CLI — a terminal-based software agent that reads your codebase, proposes file edits, runs commands, and completes multi-step engineering tasks with your approval at each step. This guide covers everything you need to go from zero to a productive daily workflow: installation, your first session, core patterns, MCP servers, hooks, and the most common mistakes to avoid. If you want to go deeper after reading, the KursVideoAI Claude Code course covers production workflows end to end.

What you'll have after this tutorial:

  • Claude Code installed and authenticated on your machine.
  • A working CLAUDE.md with project conventions loaded automatically.
  • Understanding of the plan-edit-run loop and how to review diffs.
  • Awareness of subagents, MCP servers, and hooks at a practical level.
  • A short list of tips and pitfalls that save most beginners hours of frustration.

What is Claude Code?

Claude Code is a command-line tool built by Anthropic that turns Claude — the AI model — into a software agent that lives in your terminal. Unlike a browser chat interface, Claude Code has direct access to your filesystem, can read and write files, execute shell commands, manage git, and complete multi-step engineering tasks without you pasting code back and forth.

The key distinction from IDE plugins like GitHub Copilot or Cursor is scope: those tools autocomplete code inline, in a single file, in real time. Claude Code works at the task level. You describe what you want — "add rate limiting to the API", "refactor the auth module to use JWTs", "write tests for the payment service" — and it figures out which files to read, what to change, and in what order. You review and approve every action before it touches anything.

Under the hood, Claude Code sends your code (and your approval history) to Anthropic's API, which runs the Claude model — Sonnet or Opus depending on your settings. The model produces a structured plan, and the CLI executes it locally on your machine. Nothing is stored on Anthropic's servers beyond the API request/response cycle governed by their standard data policies.

Claude Code was released publicly in 2025 and has since been adopted as a primary development tool by many individual developers and engineering teams. It supports every major language and framework, because it works at the text level rather than requiring language-specific plugins. Explore how it stacks up against alternatives at our AI coding tools comparison hub.

Install and setup

Installation takes under five minutes. The only prerequisite is Node.js 18 or higher.

Check your Node version first:

node --version
# Should print v18.x.x or higher

If you need to install or upgrade Node.js, the easiest routes are:

  • macOS: brew install node (requires Homebrew)
  • Windows/Linux: download from nodejs.org or use nvm

Then install the Claude Code CLI globally:

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

Now authenticate. Run claude and it will open a browser window for OAuth login. Sign in with your Anthropic account (create one free at console.anthropic.com if you don't have one). Your credentials are stored in your OS keychain. You only need to do this once per machine.

After login, you'll see the Claude Code interactive REPL in your terminal. Type /help to see available slash commands, or just start asking questions about your codebase.

Set up a CLAUDE.md file

The first thing worth doing in any project is creating a CLAUDE.md file at the root. Claude Code loads this file automatically at the start of every session — it is your persistent project-specific instructions file.

A good starting CLAUDE.md looks like this:

# Project conventions

## Stack
- Node.js 20, TypeScript strict, Express 4, PostgreSQL via Prisma
- Tests: Vitest, run with `npm test`
- Linting: ESLint + Prettier, run with `npm run lint`

## Rules
- Never commit directly to main — always create a feature branch
- Run `npm test` before marking any task done
- Use named exports, not default exports
- All new database queries must go through the repository layer in src/db/

The more specific your CLAUDE.md, the less you'll need to repeat yourself in every session. Add to it whenever you find yourself giving Claude Code the same instruction twice.

Your first session

Navigate to a project you know well — ideally one with a test suite already in place — and run claude.

A good first session is exploratory: ask Claude Code to orient itself before giving it tasks.

> Explain the architecture of this project in 3-4 sentences.
> What are the most important files to understand before making changes?
> Where does request authentication happen?

Claude Code will read the relevant files and respond with a summary. This is useful both to verify it has understood the project correctly and to spot anything in your CLAUDE.md you should add.

Then give it a small, well-defined task — something you could describe in a single sentence with a clear done condition:

> Add email validation to the signup endpoint in src/routes/auth.ts.
   Return a 400 with message "Invalid email format" if the email doesn't match a basic regex.
   Add a test for the new validation in tests/auth.test.ts.

Claude Code will propose a plan, show you the file diffs, and ask for confirmation before applying anything. Read every diff before saying yes — this is the habit that keeps you in control.

After applying, run your test suite manually to confirm green, or ask Claude Code to run it:

> Run the tests now and tell me if they pass.

Core workflow: plan, edit, run

After a few sessions, most Claude Code users settle into a three-step loop that applies to nearly every task.

1. Plan

Before touching any code, describe the task and ask Claude Code for a plan. The /plan slash command or a plain "outline what you would do" prompt works well. A good plan names the specific files to change and explains why, without writing any code yet. Review the plan and push back on anything that seems wrong before proceeding.

2. Edit

Once the plan looks right, ask Claude Code to implement it. It will propose diffs one file at a time (or in a batch for small changes). Approve each diff individually. If a diff looks wrong, say so: "the validation logic should go in the service layer, not the controller" and it will revise.

3. Run

After edits are applied, run your test suite, linter, or build. If something fails, paste the error output to Claude Code and ask it to fix it. This loop — edit, run, fix — is where Claude Code saves the most time: it can read stack traces and error messages and usually diagnose the issue in seconds.

For larger features, break work into milestones and complete one at a time. Claude Code's context window is large, but staying focused on one concern per session produces better results than trying to rewrite a whole subsystem at once.

Useful features

Slash commands

Claude Code's REPL has a set of built-in slash commands that speed up common actions. The most useful ones:

  • /help — list all available commands
  • /clear — clear the conversation context (start fresh without closing the session)
  • /compact — summarize the conversation so far to free up context window space
  • /status — show current model, token usage, and active permissions
  • /memory — view and edit what Claude Code has stored about your preferences
  • /review — ask Claude Code to review the current git diff for bugs or issues

Multi-file awareness

Claude Code does not need you to paste file contents. It reads files directly from your filesystem when it needs them. You can reference files by name in plain English: "look at src/services/payments.ts and tell me if the error handling is complete." It will read the file and respond.

Git integration

Claude Code can run git commands with your permission: create branches, stage files, write commit messages, and push. A common pattern: after completing a feature, ask "create a commit for this with a descriptive message" and review the message before approving.

Subagents and MCP servers

Subagents

For complex tasks that require parallel research — "investigate the three options for database connection pooling and recommend one" — Claude Code can spawn subagents: lightweight parallel instances that each explore one option and report back. The orchestrating session synthesizes the results. You trigger this with the /agent command or by describing a task that naturally parallelizes.

Subagents are especially useful for large codebases where different parts of a task require reading different sections of code simultaneously. They run within the same permission model as the main session — no extra approval required.

MCP servers

MCP (Model Context Protocol) is an open standard that extends what Claude Code can see and do beyond your local filesystem. An MCP server is a process that exposes resources (data Claude Code can read) and tools (actions Claude Code can take) via a standardized JSON protocol.

Common MCP integrations include:

  • Database MCP: let Claude Code query your development database directly, so it can check real schema and data when diagnosing bugs
  • GitHub/GitLab MCP: read issues, PRs, and CI logs from inside a session
  • Figma MCP: read design specs and generate component code that matches the design system
  • Documentation MCP: connect to your team's internal docs or a third-party API reference

You configure MCP servers in .claude/settings.json under the mcpServers key. Each server entry specifies a command to launch the MCP process and any environment variables it needs. After adding a server, restart Claude Code and it will have access to the new tools.

The MCP specification is open and growing — new community-built servers appear regularly. For a curated list of vetted integrations, see the Claude Code course.

Hooks: automate repetitive guardrails

Hooks are shell commands that Claude Code runs automatically at defined points in its lifecycle — before applying a file edit, after a command completes, when the session ends. They let you enforce project rules without relying on Claude Code remembering them.

Examples of things you can automate with hooks:

  • Run the linter after every file edit: npm run lint -- --fix
  • Run the test suite before every git commit
  • Post a Slack notification when Claude Code finishes a long task
  • Log session summaries to a local file for audit purposes
  • Block file edits in specific protected directories

Hooks are configured in .claude/settings.json (project-level) or ~/.claude/settings.json (user-level). A hook entry specifies the lifecycle event (PostToolUse, PreToolUse, Stop, etc.) and the shell command to run.

Think of hooks as the CI/CD layer for your Claude Code workflow: once set up, they enforce standards automatically on every session without you having to remember to ask.

Tips for productive sessions

  • Keep tasks small and well-defined. "Refactor the entire backend" is a recipe for drift. "Move the database connection logic from app.ts into src/db/connection.ts and update the two files that import it" is a task Claude Code can complete reliably.
  • Invest 10 minutes in a good CLAUDE.md. Every convention you record there is one less thing you'll repeat in every session. Update it whenever you give the same instruction twice.
  • Use /compact on long sessions. Claude Code's context fills up. When responses start getting less precise, /compact summarizes the history so the model can keep full context of the current task.
  • Read every diff before approving. Claude Code is accurate but not infallible. Two seconds reviewing a diff is the cheapest bug-prevention step available.
  • Run your tests yourself. Don't take "tests pass" on faith — run them yourself at least at the end of a task. Claude Code can misread test output in noisy terminal environments.
  • Give context about constraints. If you're on a tight deadline, say so. If a dependency is off-limits ("don't add any new npm packages"), say so up front. Claude Code respects stated constraints better than it infers unstated ones.
  • Use the VS Code extension for split-view comfort. Running Claude Code in a VS Code integrated terminal while watching diffs in the editor sidebar is the most comfortable setup for most developers.

Common pitfalls

Approving diffs without reading them

The single most common mistake new Claude Code users make is approving every diff immediately. Claude Code is usually right — but when it's wrong it can introduce subtle bugs that take much longer to find than they would have taken to prevent. Slow down on diffs for files you care about.

Starting sessions without a CLAUDE.md

Without project context, Claude Code defaults to generic conventions. It might pick the wrong testing framework, write imports in a style your team doesn't use, or miss project-specific constraints. Ten minutes writing a CLAUDE.md pays back within the first session.

Asking for too much in one session

"Migrate the whole app from REST to GraphQL" is a week of work. Asking Claude Code to do it in a single session produces a half-finished migration with inconsistencies across files. Break large tasks into phases, complete each phase, commit it, and start a fresh session for the next phase.

Forgetting that Claude Code can't see your running server

Claude Code reads static files and runs commands. It cannot observe a running process (logs, metrics, live state) unless you explicitly pipe that output to it. If you're debugging a runtime issue, copy the relevant logs and paste them into the session, or ask Claude Code to add instrumentation that will capture the data you need on the next run.

Granting too many permissions early

Claude Code defaults to asking before every command and edit, which is intentional. As you get comfortable, you can add pre-approved commands in settings.json — but do it selectively. Pre-approving npm test is safe. Pre-approving arbitrary shell commands is not. Start conservative and loosen permissions as you identify the specific commands that slow you down.

Frequently asked questions

What is Claude Code and how is it different from other AI coding tools?

Claude Code is Anthropic's official agentic coding CLI. Unlike GitHub Copilot (an autocomplete plugin) or Cursor (an AI-enhanced IDE), Claude Code operates from your terminal, reads your entire codebase, executes shell commands, runs tests, and can complete multi-file tasks end-to-end — with your approval at each step. It is a general-purpose software agent, not just a code suggester. See how it compares at Claude Code vs. Cursor and Claude Code vs. Copilot.

Do I need to pay for Claude Code?

Claude Code itself is free to install. It uses Anthropic's API under the hood, so you pay for the tokens consumed per session — billed through your Anthropic Console account. Claude Code works best on Claude Sonnet and Claude Opus models. Heavy daily use typically runs $5–$30/month depending on project size and session frequency. There is no flat subscription for the CLI itself.

Is Claude Code safe to run on my codebase?

Yes, by design. Claude Code asks for explicit approval before applying any file edit or running any shell command. You review every diff and confirm each action. You can also restrict permissions in the project's .claude/settings.json — for example, block file deletions or limit which directories Claude Code can touch. Treat it like a capable pair programmer who asks before touching anything.

What is a CLAUDE.md file?

CLAUDE.md is a plain-text instructions file you place at the root of your project. Claude Code loads it automatically at the start of every session. Use it to record project-specific conventions: 'always use TypeScript strict mode', 'never commit to main directly', 'run npm test before marking a task done'. It is the fastest way to give Claude Code persistent context about your codebase.

Can Claude Code run my tests and fix failures automatically?

Yes. Claude Code can execute any shell command you permit — including npm test, pytest, cargo test, or any custom script. A common pattern is to ask Claude Code to 'make this test pass' and let it edit code, run the test suite, read the failure output, and iterate until green. You approve each command and diff, so you stay in control throughout.

What are MCP servers in Claude Code?

MCP (Model Context Protocol) is an open standard that lets Claude Code connect to external tools and data sources — databases, APIs, design systems, issue trackers. An MCP server exposes resources and tools that Claude Code can call during a session, extending what it can see and do beyond your local filesystem. You configure MCP servers in .claude/settings.json under the 'mcpServers' key.

How is Claude Code different from Claude.ai in a browser?

Claude.ai is a chat interface for general conversation. Claude Code is a software agent: it has direct access to your filesystem, can run terminal commands, manage git, read and write files, and complete multi-step engineering tasks autonomously. It is specifically designed for software development workflows, not general chat.

Can I use Claude Code inside VS Code or another IDE?

Yes. Claude Code has an official VS Code extension that embeds the terminal-based agent inside the editor. There are also integrations for JetBrains IDEs. The underlying agent is the same — the IDE integration just saves you switching between windows. See our Claude Code course for a full IDE setup walkthrough.

Next steps: If you want a structured path from zero to production-ready Claude Code workflows, the KursVideoAI Claude Code course covers advanced session management, team MCP setups, hook libraries, and real-world case studies. See the full courses catalog or compare Claude Code to other tools at our comparison hub — including Claude Code vs. Cursor and Claude Code vs. Copilot.

Want to master Claude Code and agentic coding?

220 pages PDF for developers and non-coders. Lifetime access.

See the course →