Skip to main content

Claude Code Complete Guide: From Setup to Advanced Workflows

A compact Claude Code orientation, verified for 2.1.305. Installation, first session, CLAUDE.md, Hooks, MCP, and Custom Agents, with cross-links to the deeper 2026 edition.

Updated October 21, 2026: Corrected the system requirements, install methods, and sign-in steps for Claude Code 2.1.305, replaced the $CLAUDE_FILE_PATHS hook and the non-existent memory MCP package with working examples, updated the subagent and skill formats, noted that sessions now start in auto permission mode, and refreshed the model guidance to Haiku 5.5 / Sonnet 5.5 / Opus 5.5 / Fable 5.1.

Start here instead: the Claude Code Complete Guide 2026 is the current, deeper edition of this tutorial, with the full hooks, MCP, Director Mode, and cost chapters. This page stays as the short orientation path; follow the cross-links below for anything you want in depth.

This is a compact Claude Code orientation. Whether you’re new to AI-assisted development or looking to master advanced features, this guide gets you oriented and points you at the deep dives.


What is Claude Code?

Claude Code is Anthropic’s official AI coding assistant. What makes it different from other tools:

  • Terminal Native: Runs in the terminal, and also in VS Code, the desktop app, and the web
  • Project-Level Understanding: Reads the files each task needs across your codebase, not just the open file
  • Agent Architecture: Can autonomously execute tasks, not just answer questions

Why Choose Claude Code?

FeatureClaude CodeCursorGitHub Copilot
InterfaceTerminalIDEEditor Plugin
AutonomyHigh (Agent)MediumLow
CustomizationVery HighMediumLow
Best ForComplex tasks, automationGUI preferenceSimple completion

Choose Claude Code if you love the terminal, want maximum control, and need to handle complex tasks.


Installation & Setup

System Requirements

  • macOS: 13.0+
  • Windows: Windows 10 1809+ or Windows Server 2019+ (Git for Windows is optional but recommended)
  • Linux: Ubuntu 20.04+ / Debian 10+ / Alpine Linux 3.19+
  • Hardware: 4 GB+ RAM, x64 or ARM64
  • Plan: a Claude Pro, Max, Team, or Enterprise subscription, a Claude Console account, or access through a supported cloud provider

Installation Methods

Method 1: Native Installer (Recommended)

# macOS / Linux / WSL
curl -fsSL https://claude.ai/install.sh | bash

# Windows PowerShell
irm https://claude.ai/install.ps1 | iex

Native installations update themselves in the background.

Method 2: Homebrew, WinGet, or npm

# Homebrew (macOS/Linux) - does not auto-update
brew install --cask claude-code

# WinGet (Windows) - does not auto-update
winget install Anthropic.ClaudeCode

# npm - requires Node.js 22+, never use sudo
npm install -g @anthropic-ai/claude-code

First-Time Setup

After installation, run:

claude

The first run will guide you through:

  1. Authentication: sign in through the browser with your Claude subscription or Claude Console account (you can also run claude auth login)
  2. Permission Settings: decide what operations Claude can perform

Claude Code is not part of the free Claude.ai plan. For API billing instead of a subscription, sign in with claude auth login --console or set ANTHROPIC_API_KEY.

Verify Installation

claude --version
# Prints the installed version, for example 2.1.305

claude doctor
# Read-only install and settings diagnostics, without starting a session

Basic Usage

Starting a Conversation

Run in any project directory:

cd /path/to/your/project
claude

Claude Code doesn’t index the repository up front. It loads your CLAUDE.md (or AGENTS.md) and git state, then reads the files each task needs.

Basic Commands

CommandFunction
claudeStart interactive conversation
claude "do something"Start a session with an initial prompt
claude -p "do something"One-shot run (print mode), then exit
claude --helpView all options
/helpGet help during conversation
/clearClear conversation history
Ctrl+CInterrupt the current operation; press again at an empty prompt to exit
/exitExit Claude

Conversation Mode

In conversation, describe tasks in natural language:

You: Create a date formatting utility function in src/utils/

Claude: I'll create that utility function...
[Claude shows the file and content to create, waits for confirmation]

Interactive terminal and VS Code sessions start in auto mode when no permission mode is configured, so a classifier reviews most actions instead of asking you every time. Set permissions.defaultMode in your settings to override it.

Plan Mode

Press Shift+Tab to cycle permission modes until you reach plan mode, or type /plan:

You: /plan Implement user login feature

Claude: Let me analyze the requirements and plan the implementation...
[Claude researches the codebase, proposes a plan, but doesn't modify any files]

Plan Mode is ideal for: Complex features, when you’re unsure how to proceed


CLAUDE.md Configuration

CLAUDE.md is Claude Code’s most important configuration file. It tells Claude your project rules.

Creating CLAUDE.md

Create CLAUDE.md in your project root:

# Project Name

## Tech Stack
- Node.js + TypeScript
- React + Tailwind CSS
- PostgreSQL

## Development Rules
- Use pnpm as package manager
- All code must have TypeScript types
- Run `pnpm lint && pnpm test` before committing

## Directory Structure
- `src/` - Main source code
- `tests/` - Test files
- `docs/` - Documentation

## Forbidden Actions
- Don't use any type
- Don't delete existing tests
- Don't push directly to main branch

Quick Initialization

Use the built-in command to auto-generate:

claude
/init

Claude will analyze the project structure and generate an appropriate CLAUDE.md. Refine it later with /memory, and run /doctor prompt-audit to find instructions written for older models.

CLAUDE.md Locations

LocationPurpose
project-root/CLAUDE.mdProject-specific rules
~/.claude/CLAUDE.mdPersonal global rules
project-root/AGENTS.mdRead instead of CLAUDE.md when a project has no CLAUDE.md

Advanced Features

1. Hooks (Automation Triggers)

Hooks let you automatically run your own commands at fixed points in Claude’s lifecycle. You register them in a settings.json file, and each hook receives the event as JSON on stdin.

Common Use Cases:

  • Auto-format after editing files
  • Run tests after every modification
  • Block dangerous commands

Configuration Example (.claude/settings.json):

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "jq -r '.tool_input.file_path' | xargs pnpm lint --fix"
          }
        ]
      }
    ]
  }
}

Run /hooks in a session to see what is registered.

👉 Detailed guide: Claude Code Hooks Complete Guide · deeper examples in the 2026 edition

2. MCP (Model Context Protocol)

MCP lets Claude connect to external tools and data sources.

Installation Examples:

# Remote HTTP server
claude mcp add --transport http notion https://mcp.notion.com/mcp

# Local stdio server
claude mcp add my-server -- node ./my-mcp-server/index.js

There is no claude mcp install command. Run /mcp in a session, or claude mcp list, to check that each server connected.

👉 Detailed guide: Claude Code MCP Setup Guide

3. Custom Agents

Create subagents specialized for specific tasks.

Creation Method: ask Claude to write one, or create the file yourself. /agents now just prints a reminder to do that.

<!-- .claude/agents/code-reviewer.md -->
---
name: code-reviewer
description: Reviews code for bugs, security, and maintainability. Use after writing or modifying code.
tools: Read, Grep, Glob
model: sonnet
---

Review the changes and report correctness, security, and maintainability issues.

Put the file in .claude/agents/ for one project, or ~/.claude/agents/ for all of them.

👉 Detailed guide: Claude Code Agents Complete Guide

4. Custom Skills

Skills are reusable instructions Claude loads when relevant, or that you invoke with /name. Custom commands have been merged into skills: .claude/commands/deploy.md and .claude/skills/deploy/SKILL.md both create /deploy.

Creation Method:

Create .claude/skills/deploy/SKILL.md:

---
description: Deploys to production. Use when the user asks to ship, release, or deploy.
---

Execute the following deployment steps:
1. Run tests
2. Build project
3. Deploy to Cloudflare Pages

Usage: /deploy

👉 Detailed guide: Claude Code Skills Complete Guide


Best Practices

1. Keep Context Clean

Use /context to see what is filling the window, then /compact or /clear

Old conversation history consumes tokens and can confuse Claude.

2. Use Plan Mode

For complex tasks, enter plan mode first (/plan or Shift+Tab)
Let Claude research before taking action

3. Give Clear Instructions

Bad: “Improve this function”

Good: “Refactor the calculateTotal function to use reduce instead of a for loop, and add TypeScript types”

4. Use Test-Driven Development

You: Write tests first, confirm they fail, then implement the feature to make tests pass

Claude performs best when it has clear test targets.

5. Use Built-in Tools

CommandPurpose
/initInitialize CLAUDE.md
/contextSee what is filling the context window
/usageCheck session cost and plan limits (/cost is an alias)
/memoryManage memory
/modelSwitch models
/effortAdjust how much reasoning the model applies

FAQ

Q: Claude won’t execute my command?

A: Check the permission prompt. Claude waits on a dialog with options such as Yes, Yes, and don’t ask again, Yes, and switch to auto mode, and No. Pick one with the arrow keys and Enter.

Q: How to reduce costs?

A:

  1. Use /context, then /compact or /clear, to drop history you no longer need
  2. Plan before executing (/plan)
  3. Use Haiku 5.5 for simple, mechanical tasks, and lower /effort when a task doesn’t need deep reasoning

Q: Claude’s generated code has errors?

A:

  1. Provide more context (related files)
  2. Use test-driven development
  3. Clearly indicate errors, let Claude fix them

Q: How to use with a team?

A:

  1. Add CLAUDE.md to version control
  2. Add .claude/ directory to version control (exclude settings.local.json)
  3. Use project scope for MCP settings

Q: Which model should I pick?

A: On the Anthropic API, haiku, sonnet, opus, and fable resolve to Haiku 5.5, Sonnet 5.5, Opus 5.5, and Fable 5.1. Opus 5.5 is the default model on Pro, Max, Team, and Enterprise plans; Fable 5.1 is the most capable tier and is never a default. Opus 5.5, Sonnet 5.5, and Haiku 5.5 run at medium effort by default. Other providers resolve some aliases to older models.

Q: Which programming languages are supported?

A: Claude Code supports all major programming languages, including but not limited to:

  • JavaScript/TypeScript
  • Python
  • Go
  • Rust
  • Java/Kotlin
  • C/C++
  • Swift
  • PHP
  • Ruby

Next Steps

Congratulations on completing the Claude Code basics! Recommended reading:

  1. Claude Code Complete Guide 2026 - The current, deeper edition of this guide
  2. Hooks Complete Guide - Build automated workflows
  3. MCP Setup Guide - Extend Claude’s capabilities
  4. Agents Complete Guide - Create custom agents
  5. Director Mode Methodology - Advanced development mode

Resources


Last updated: 2026-10-21