Commit Career

August 27, 2026 · Umesh Subedi

Claude Code Tutorial 2026: Complete Guide to AI-Powered Coding

On this page

Claude Code is Anthropic's official agentic developer environment engineered to read, edit, execute, test, and maintain software projects across command-line interfaces, IDE extensions, desktop applications, and web runtimes. Unlike passive chat interfaces or inline autocomplete tools, Claude Code operates as an autonomous pair programmer capable of running terminal commands, traversing multi-file codebases, executing test suites, and orchestrating Git workflows directly inside your workspace. This tutorial provides a complete technical guide to installing, configuring, and mastering Claude Code across Windows, macOS, Linux, WSL, VS Code, and browser environments. It covers essential CLI commands, automated hooks, model selection, pricing structures, practical developer prompts, and objective head-to-head comparisons against tools like Cursor, OpenAI Codex, and Google Gemini. Model capabilities, subscription tiers, and API pricing change over time. Check Anthropic's official documentation before deploying Claude Code in production workflows.

What Is Claude Code?

Claude Code is an agentic software development tool created by Anthropic that operates directly within a project repository through the command line, editor extensions, or cloud virtual machines.

To understand the product landscape, developers must distinguish between "Claude Code" and broader semantic terms such as "Claude coding," "coding with Claude," or "Claude AI for coding." General Claude coding refers to the broad practice of using Anthropic's language models for software development tasks, such as copying snippets out of the standard Claude web chat or querying the raw API. "Claude Code" specifically denotes the official agentic developer environment built by Anthropic to interact with your local environment, file system, shell, and version control.

What Makes Claude Code Agentic

Traditional AI coding assistants act passively by offering inline code suggestions at the active text cursor or answering natural language questions inside a side panel. Claude Code operates autonomously across an agentic execution loop:

  • Repository Awareness: It ingests your directory tree, builds project maps, and reads configuration files such as CLAUDE.md to understand existing architectural patterns.

  • Direct File System Modification: It creates, updates, renames, and deletes files across multiple directories simultaneously rather than outputting isolated code blocks for manual copying.

  • Terminal Execution: It runs shell commands, executes package managers, starts local development servers, and processes build outputs directly in your terminal.

  • Self-Correcting Iteration: When a build fails or a test suite throws a stack trace, Claude Code reads the execution error, diagnoses the underlying cause, and adjusts its implementation without requiring manual intervention.

  • Git Integration: It checks branch status, stages modified files, generates descriptive commit messages, and creates pull requests.

Who Should Use Claude Code?

  • Experienced Software Engineers: To delegate repetitive tasks, perform multi-file refactoring, automate unit test generation, and speed up pull request reviews.

  • DevOps and Infrastructure Engineers: To write shell scripts, maintain Infrastructure-as-Code (IaC) configurations, automate CI/CD pipelines, and diagnose deployment logs.

  • Beginner Developers and Students: To explore unfamiliar codebases, receive step-by-step guidance on complex algorithms, and verify syntax against current industry patterns.

What Can You Do With Claude Code?

Claude Code handles technical tasks across the entire software development lifecycle:

  • Code Generation: Build new features, create API endpoints, generate database schemas, and scaffold microservices from natural language descriptions.

  • Automated Debugging: Trace error stack traces across multiple layers of an application, identify logic flaws, patch underlying source code, and verify fixes against your runtime.

  • Multi-File Refactoring: Restructure legacy modules, update deprecated API signatures across an entire repository, and migrate codebases between framework versions.

  • Test Suite Automation: Generate comprehensive unit, integration, and end-to-end tests using frameworks like PyTest, Jest, Vitest, or JUnit, and run them automatically to ensure full branch coverage.

  • Code Review and Security Scans: Scan pending diffs for hardcoded credentials, injection risks, memory leaks, and architectural anti-patterns before pushing changes.

  • Repository Exploration: Ingest complex, undocumented legacy repositories and summarize architectural structures, module dependencies, and entry points.

  • Documentation Maintenance: Automatically generate docstrings, maintain project README.md files, and construct OpenAPI specifications matching active route implementations.

  • Git Workflow Automation: Create feature branches, stage modified assets, craft standardized commit messages, and submit pull requests to platforms like GitHub or GitLab.

Claude Code can accelerate software development, but the quality of the results still depends on understanding the technologies you're working with. If you're building toward a full stack development career, Commit Career's course covers JavaScript, React, Node.js, databases, APIs, Git, deployment, and AI-assisted development through practical projects.

How to Install Claude Code

Before installing Claude Code, verify that your local environment meets the minimum system requirements:

  • Node.js: Version 18.0 or higher.

  • Package Manager: npm, yarn, or pnpm.

  • Version Control: Git installed and configured.

  • Authentication: An active Anthropic subscription (Pro, Max, Team, Enterprise) or an Anthropic Console API key.

Claude Code CLI Installation

The command-line interface is the primary operational environment for Claude Code. Official installation instructions are maintained at the Claude Code Installation Guide.

Native npm Installation

Bash

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

macOS Installation via Homebrew

Bash

brew install --cask claude-code

Shell Script Installation (macOS and Linux)

Bash

curl -fsSL https://claude.ai/install.sh | bash

Verify your installation by checking the installed version:

Bash

claude --version

How to Install Claude Code on Windows

Windows developers can install Claude Code natively using PowerShell or Command Prompt (CMD).

PowerShell Installation

Open PowerShell as an administrator and execute:

PowerShell

irm https://claude.ai/install.ps1 | iex

Command Prompt (CMD) Installation

DOS

curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

Note: Ensure Git for Windows is installed and added to your system PATH environment variable to enable Git-based workflow features inside Claude Code.

Claude Code on WSL

Running Claude Code inside Windows Subsystem for Linux (WSL) provides a native Linux environment for Windows users:

  1. Launch your WSL terminal (e.g., Ubuntu).

  2. Verify Node.js availability: node -v (Install Node.js 18+ via nvm if missing).

  3. Execute the standard Linux installation script:

Bash

curl -fsSL https://claude.ai/install.sh | bash

  1. Navigate to your project directory located within the Linux file system (e.g., /home/username/projects/app) rather than mounted Windows drives (/mnt/c/) to ensure optimal file access speed and watcher performance.

Claude Code Terminal Setup

After completing installation, initialize Claude Code inside your target project directory:

Bash

cd /path/to/your/project

claude

On your first run, Claude Code prompts you to authenticate:

  1. Follow the terminal prompt to open your browser and authenticate your Claude subscription account.

  2. Alternatively, set an environment variable to authenticate using an Anthropic API key:

Bash

export ANTHROPIC_API_KEY="your-api-key-here"

To configure terminal keybindings, such as setting Shift + Enter for multi-line prompts inside integrated terminals, run the internal configuration wizard:

Bash

/terminal-setup

How to Use Claude Code in VS Code

The official Claude Code VS Code extension brings agentic development features directly into the editor interface. Consult the Claude Code IDE Integrations Guide for complete specification details.

Feature / Step

Setup and Operational Details

Prerequisites

VS Code version 1.98.0 or higher and an active Claude Code CLI installation.

Installation

Open Extensions (Cmd+Shift+X / Ctrl+Shift+X), search for Claude Code (anthropic.claude-code), and click Install.

Authentication

Click the Claude spark icon (orange symbol) in the top-right editor toolbar, status bar, or side panel, and sign in via browser OAuth or inherited ANTHROPIC_API_KEY.

Execution Modes

Edit Mode (Default): Proposes changes with manual approval per file.


Auto-Accept Mode: Automatically applies file edits without prompting.


Plan Mode: Analyzes repository context and writes structured plans without altering files.

Visual Diffs

Displays native side-by-side green/red diff views inside the main editor window before applying modifications to disk.

Checkpoints & Rewind

Automatically captures code and chat snapshots. Double-press Esc to rewind both conversation state and disk files to a prior stable checkpoint.

Context Mentions

Type @ in the prompt box to attach specific files, folders, or line selections to the prompt payload.

CLI vs. VS Code Extension Comparison

While the VS Code extension offers visual side-by-side diffs and graphical @-mentions, the raw CLI environment is better suited for headless server environments, multi-repository directory chaining using /add-dir, complex Unix shell piping (tail -n 100 app.log | claude -p "debug error"), and custom continuous integration scripts.

How to Use Claude Code on the Web

Claude Code on the Web enables developers to run autonomous coding sessions entirely in cloud virtual machines managed by Anthropic, removing local compute requirements.

Web Session Workflow

  1. Visit claude.ai/code and authenticate with your account credentials.

  2. Connect your GitHub account and authorize repository access.

  3. Select the target repository and active target branch from the web workspace drop-down menu.

  4. Input your natural language development request.

  5. Claude Code provides an isolated virtual container, clones your repository, executes setup scripts, builds features, runs verified unit tests, and submits a remote GitHub feature branch or pull request.

Web vs. Local Workflow Comparison

Operational Aspect

Web Workflow (claude.ai/code)

Local Workflow (CLI / VS Code)

Execution Host

Anthropic-managed cloud virtual machine

Local machine or server environment

Hardware Overhead

Zero local CPU/RAM utilization

Dependent on local computer performance

Mobile Access

Accessible via web browsers and mobile apps

Limited to active terminal sessions

Environment Access

Requires remote GitHub repository access

Works on uncommitted, local-only repositories

Tool Execution

Runs inside sandboxed container limits

Has full access to local dev environments, tools, and scripts

Claude Code Commands

Claude Code includes built-in commands and operational flags to manage agent sessions, configure environments, and direct model behavior. Refer to the official Claude Code Commands Reference for comprehensive syntax guidance.

Command / Flag

Purpose

Example Use Case

claude

Launches an interactive agentic session in the current directory.

claude

claude "prompt"

Starts an interactive session with an initial natural language task.

claude "refactor auth middleware"

claude -p "prompt"

Single-shot mode: runs prompt, outputs response to terminal, and exits.

claude -p "explain index.ts"

claude -c -p "prompt"

Resumes the most recent conversation session, executes prompt, and exits.

claude -c -p "run build check"

claude --model <alias>

Overrides default model for the session (sonnet, opus, haiku).

claude --model opus

/terminal-setup

Configures keybindings for multi-line inputs in integrated terminals.

/terminal-setup

claude update

Updates the installed Claude Code package to the latest official release.

claude update

claude auth logout

Terminates active user sessions and removes stored authentication tokens.

claude auth logout

/add-dir <path>

Adds an external folder path to the active agent context window.

/add-dir ../shared-libs

/compact

Compresses current conversation history to preserve available context space.

/compact

Claude Code Hooks

Hooks provide programmable, deterministic guardrails around Claude Code's agentic loop. Defined inside .claude/settings.json or global configuration files, hooks run user-defined shell scripts or evaluators automatically during session lifecycle events.

Primary Hook Lifecycle Events

  • SessionStart: Triggers when a session initializes or resumes.

  • PreToolUse: Executes after the agent builds tool parameters but before execution. It can approve (allow), reject (deny), or alter inputs.

  • PostToolUse: Triggers immediately after a tool call completes, allowing automated testing, linting, or formatting.

  • Stop: Triggers when the agent completes its work loop.

Realistic Guardrail Hook Example

This PreToolUse hook blocks destructive terminal commands (such as rm -rf) before execution.

Configuration (.claude/settings.json)

JSON

{

  "hooks": {

    "PreToolUse": [

      {

        "matcher": "Bash",

        "hooks": [

          {

            "type": "command",

            "command": ".claude/hooks/block-destructive.sh"

          }

        ]

      }

    ]

  }

}

Middleware Script (.claude/hooks/block-destructive.sh)

Bash

#!/bin/bash

COMMAND=$(jq -r '.tool_input.command')

if echo "$COMMAND" | grep -q 'rm -rf'; then

  jq -n '{

    hookSpecificOutput: {

      hookEventName: "PreToolUse",

      permissionDecision: "deny",

      permissionDecisionReason: "Destructive remove command blocked by PreToolUse guardrail."

    }

  }'

else

  exit 0

fi

Claude Coding Models: Which Model Should You Use?

Choosing the right underlying model depends on task complexity, speed requirements, and token costs. You can select specific models using the Claude Code Model Configuration options.

Model

Primary Strengths

Recommended Use Cases

Cost Profile

Limitations

Claude Sonnet 5

High intelligence, balanced execution speed, optimal code generation.

Default model for general development, feature additions, and bug fixes.

Standard rate ($2.00 input / $10.00 output per MTok).

Higher resource consumption than Haiku on trivial single-line edits.

Claude Opus 5

Frontier reasoning, superior multi-file architectural understanding.

Complex legacy refactoring, enterprise system design, deep debugging.

Premium rate ($5.00 input / $25.00 output per MTok).

Slower generation speed compared to Sonnet; usage subject to lower rate limits.

Claude Haiku 4.5

High-speed throughput, lightweight token usage.

Automated linting, quick documentation checks, simple single-file scripts.

Budget rate ($1.00 input / $5.00 output per MTok).

Reduced context reasoning on complex multi-file codebase dependencies.

How Much Does Claude Code Cost?

Claude Code does not feature a separate purchase price. Access is managed through Anthropic tier subscriptions or usage-based API keys. Consult the official Claude Pricing Page for updated rates.

Subscription vs. API Usage Comparison

Access Tier

Price

Included Usage & Capabilities

Best For

Claude Pro

$20/month ($17/month billed annually)

Full Claude Code access across terminal, web, desktop, and VS Code. Includes rolling 5-hour window usage limits.

Individual developers working on small-to-medium codebases.

Claude Max 5x

$100/month

Approximately 5x the usage limits of the Pro plan per 5-hour window.

Daily full-time developers managing larger codebases.

Claude Max 20x

$200/month

Approximately 20x the usage limits of the Pro plan; priority model capacity.

Power users running continuous multi-agent sessions.

Team (Premium)

~$100/seat/month

Full Claude Code access per seat, central admin controls, SSO, and shared billing.

Engineering teams requiring central admin governance.

API Pay-As-You-Go

Billed per million tokens (MTok)

Uncapped execution billed strictly on input/output tokens used. Prompt caching reduces input costs up to 50%+.

Automated CI/CD pipelines and headless server integrations.

Claude Code API and Python

Developers should distinguish between Claude Code (the agentic environment tool), the Claude API (the direct HTTP service), and the Anthropic Python SDK (the programmatic wrapper library).

While Claude Code uses the API internally under the hood, developers can write independent Python scripts using the anthropic package to build custom developer utilities.

Verifiable Python API Example

Python

import anthropic

# Instantiates client using ANTHROPIC_API_KEY environment variable

client = anthropic.Anthropic()

response = client.messages.create(

    model="claude-sonnet-5",

    max_tokens=1024,

    messages=[

        {

            "role": "user",

            "content": "Write a type-safe Python function that validates email addresses using regex."

        }

    ]

)

print(response.content[0].text)

Claude Code Best Practices

Follow these developer practices grounded in Anthropic's Official Claude Code Best Practices to maximize accuracy and manage token consumption:

  • Define Project Rules in CLAUDE.md: Place a CLAUDE.md file in your project root containing build commands, testing rules, styling preferences, and architectural guidelines. Claude Code ingests this file automatically at session start.

  • Explore with Plan Mode First: Use Plan Mode (Shift+Tab in VS Code or pass architectural prompts) before letting the model modify files. Validate the proposed plan before authorizing file writes.

  • Manage Context Space Proactively: Avoid loading unnecessary files into the context window. Run /compact periodically during long sessions to summarize chat history.

  • Execute Granular Tasks: Break large feature requests into small, testable milestones instead of requesting full system builds in a single prompt.

  • Verify Edits with Automated Tests: Require Claude Code to run your local test suite after modifying files to catch regression errors early.

  • Commit Work Frequently: Maintain clean Git working trees so you can revert unexpected agent modifications using standard Git commands or Claude Code checkpoints (Esc Esc).

Claude Code Prompts for Developers

The following prompts provide clear structure for real-world engineering workflows:

Building a Feature

Plaintext

Build a RESTful GET endpoint /api/v1/users/{id} using Express and TypeScript. Include input parameter validation using Zod, handle 404 resource errors cleanly, and write an integration test verifying the response payload structure.

Debugging Stack Traces

Plaintext

I am receiving the following error stack trace during integration tests:

[Paste error log here]

Trace the root cause through the src/services/auth service module, explain why the failure is occurring, and apply a fix that handles null token payloads.

Refactoring Legacy Code

Plaintext

Refactor the function processOrders in src/legacy/orders.js to use modern async/await syntax instead of nested callbacks. Maintain identical return signatures and export public interfaces cleanly

Automated Test Suite Generation

Plaintext

Create a PyTest unit test suite for utils/calculator.py. Cover edge cases including division by zero, floating point precision limits, and empty array inputs. Run PyTest and fix any failing tests.

Code Review and Security Audit

Plaintext

Review uncommitted git diffs across the project. Scan specifically for unhandled promise rejections, SQL injection vulnerabilities, and hardcoded API keys. Provide a bulleted list of security risks.

Claude Code vs. Cursor

Evaluation Metric

Claude Code

Cursor

Primary Interface

Command-Line Interface (CLI), VS Code Extension, Web (claude.ai/code), Desktop App.

Standalone custom IDE fork based on VS Code.

Agentic Capability

High autonomous capability: executes terminal scripts, manages Git, and updates multi-file repositories independently.

Strong inline completion and chat-driven editing directly within the IDE editor canvas.

Context System

Automatically reads CLAUDE.md, .claude/settings.json, and supports custom hooks.

Uses local repository vector indexing (.cursorrules) for fast symbol lookups.

Terminal Operations

Native full access to system shell, package management, and test execution environments.

Integrated terminal support with user-triggered command approvals.

Ideal Target User

Engineers who prefer terminal-driven workflows, command automation, and multi-file agentic tasks.

Developers seeking a ready-to-use, visual IDE with strong inline autocompletion.

Claude Code vs. OpenAI Codex

Feature

Claude Code

OpenAI Codex

Product Structure

Complete agentic ecosystem operating across terminal, IDE, web, and desktop.

Historical cloud model/API engine powering tools like GitHub Copilot.

Execution Surface

Runs directly inside local project terminals or cloud virtual environments.

Interfaced via third-party extension integrations, cloud sandboxes, or raw API calls.

Lifecycle Control

Managed via deterministic shell scripts (PreToolUse and PostToolUse hooks).

Managed via IDE host parameters or custom client-side wrapper code.

Claude vs. Gemini for Coding

Capability

Anthropic Claude (Sonnet / Opus)

Google Gemini (2.5 Pro / Flash)

Context Window Size

Up to 1,000,000 tokens on higher subscription tiers.

Up to 2,000,000 tokens natively across input modalities.

Code Reasoning & Style

High accuracy on complex multi-file logic, minimizing boilerplate AI text.

Excellent large-payload ingestion (processing entire video streams or monolithic repos).

Ecosystem Integration

Deep CLI integration via Claude Code, GitHub connection, and Model Context Protocol (MCP).

Deep native integration across Google Cloud Platform, BigQuery, and Google Workspace.

Claude Code vs. ChatGPT for Coding

Feature

Claude Code

ChatGPT (GPT-4o / Canvas)

Interaction Surface

Terminal-native execution, VS Code panel, desktop app, and cloud VMs.

Conversational web chat, desktop application, and interactive Canvas editor window.

File Access

Reads and modifies local directory structures directly without manual pasting.

Requires manual file uploads or copy-pasting code snippets into web input fields.

Build & Test Automation

Runs local package managers, builds source files, and executes test suites autonomously.

Generates written code suggestions that must be manually copied, pasted, and tested by the user.

Frequently Asked Questions

Is Claude Code free?

No, Claude Code is not free. Using the CLI, VS Code extension, desktop application, or web runtime requires an active paid Claude plan (Pro, Max, Team, Enterprise) or pay-as-you-go billing configured through an Anthropic Console API key.

Is Claude Code open source?

No, Claude Code is proprietary software developed by Anthropic. While the tool uses open standards such as the Model Context Protocol (MCP) and accepts user-defined shell hooks, its core agent logic and underlying language models remain closed-source.

How much does Claude Code cost?

Claude Code is bundled into Claude paid subscriptions starting at $20 per month ($17 per month billed annually) for Pro, $100 per month for Max 5x, and $200 per month for Max 20x. API usage is billed per million tokens based on the active model.

Is Claude Code better than Cursor?

Claude Code is better suited for developers seeking terminal-based autonomy, shell command execution, and multi-file tasks. Cursor provides a smoother visual experience for developers who want a ready-to-use IDE with strong inline autocompletion.

Is Claude Code better than Codex?

Claude Code provides a complete agentic environment that runs terminal scripts, refactors repositories, and executes tests. OpenAI Codex serves primarily as an API foundation engine integrated into third-party IDE extensions.

Is Claude coding better than ChatGPT for coding?

Claude Code offers a clear advantage over standard ChatGPT for complex codebase work because it reads local repository files directly, executes terminal commands, and runs automated tests without requiring manual copy-pasting.

Is Claude Code free for students?

Anthropic does not offer an official, standalone free tier for Claude Code for students. Students must purchase a standard paid Claude subscription plan or use API credits to access Claude Code interfaces.

Can I use Claude Code on Windows?

Yes, Claude Code supports Windows natively via PowerShell and Command Prompt (CMD). It also runs smoothly inside Linux environments using Windows Subsystem for Linux (WSL).

Can Claude Code work with Python?

Yes, Claude Code works with Python environments. It can create Python scripts, debug framework errors (such as Django, FastAPI, or Flask), run PyTest test suites, manage Virtual Environments (venv), and execute PIP packages.