developer tools

How to Use Claude Code: A Complete Step-by-Step Tutorial

From first install to shipping real features — everything you need to get Claude Code working in your project today.

Updated July 2026·beginner·30-45 min·10 steps
Phase 1 — Setup & Authentication
Step 01

Install Claude Code

5 min

Claude Code installs as a global CLI tool. Pick the method that matches your OS. Native installs auto-update — no manual version management required.

Never used a terminal before?

The commands below (curl, npm) look intimidating if you've never touched a terminal, but you're only ever copy-pasting one line and pressing Enter — you don't need to understand what it does. On Mac, open the Terminal app (search for it with Spotlight); on Windows, install Git for Windows first (see the callout below) and use its Bash terminal. This guide later has you configure a real backend stack (TypeScript, Prisma, PostgreSQL) — that part is Claude's job, not yours. You're driving by describing what you want in plain English; Claude writes and runs the actual code.

macOS & Linux

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

Windows — PowerShell

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

Windows — Command Prompt

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

npm (any OS)

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

Git for Windows is strongly recommended. It provides a Bash shell that gives Claude Code access to Unix-style file tools. Download it at gitforwindows.org.

Auto-updates

The native installer (curl/PowerShell) handles updates automatically. The npm install requires manual npm update -g @anthropic-ai/claude-code when new versions ship.

Watch — Full Claude Code Tutorial for Non-Technical Beginners in 2026
claude — bash — 120×40 ╔═══════════════════════════════════════════════╗ Claude Codev1.4.0 ║ ║ Model: claude-sonnet-4-5 ║ Directory: ~/projects/my-app ╚═══════════════════════════════════════════════╝ Type /help for commands, /exit to quit claude>

Verify the install by running claude --version. If you see a version number, you're ready for Step 2.

Step 02

Log In

2 min

Run claude for the first time. It will prompt you to authenticate before doing anything else.

$ claude
No active session found. Opening login...

A browser window opens to complete OAuth. Once you authenticate, your credentials are stored locally and you won't be asked again.

Supported account types

  • Claude Pro / Max / Team / Enterpriseclaude.ai subscription
  • Anthropic Console — pay-per-token API access at console.anthropic.com
  • Amazon Bedrock — Claude hosted in AWS
  • Google Cloud Vertex AI — Claude hosted in GCP
  • Microsoft Azure AI Foundry — Claude hosted in Azure
Switching accounts

Inside any Claude Code session, type /login to log out and re-authenticate with a different account or provider.

Step 03

Start Your First Session

2 min

Always navigate to your project directory first. Claude Code reads your files from the working directory — context is everything.

$ cd /path/to/your/project
$ claude

  Claude Code v1.4.0
  Model: claude-sonnet-4-5
  Directory: /path/to/your/project

  Type /help for commands, /exit to quit

claude>

The startup screen confirms three things: the version, the model in use, and the working directory. If the directory is wrong, exit and cd to the right place.

Essential session commands

  • /help — list all available slash commands
  • /resume — continue a previous session with its full message history
  • /clear — wipe context and start fresh within the same session
  • /exit — quit Claude Code
Phase 2 — Core Developer Workflows
Step 04

Ask Your First Question

5 min

Start by having Claude understand your project. It reads files automatically — no manual copy-pasting, no context loading. Just ask.

  • what does this project do?
  • what technologies does this project use?
  • where is the main entry point?
  • explain the folder structure

Claude will scan package.json, README.md, config files, and source directories to build an accurate answer. It tells you which files it reads, so you can see exactly what it's working from.

No manual context loading

Unlike chat interfaces where you paste code snippets, Claude Code directly accesses your filesystem. It finds the relevant files itself. Ask naturally, as if talking to a senior engineer who just cloned the repo.

Cost mitigation: add a .claudeignore

Because Claude reads files automatically to build context, it can waste tokens scanning huge, irrelevant directories — node_modules, dist, build, lockfiles, generated assets. Create a .claudeignore file in your project root (same syntax as .gitignore) listing these directories so Claude skips them. On a large project, this is the single biggest lever for keeping token usage — and API cost, if you're on pay-per-token — under control.

Example exchange:

claude> what technologies does this project use?

Reading package.json... src/index.ts... tsconfig.json...

This is a TypeScript Node.js API using:
• Express 4.18 for HTTP routing
• Prisma 5.x as the ORM, connected to PostgreSQL
• Zod for request validation
• Jest for testing (see jest.config.ts)
• Docker Compose for local DB setup (docker-compose.yml)

Entry point is src/index.ts, which bootstraps Express and
registers routes from src/routes/.
Step 05

Make Your First Code Change

10 min

Ask Claude to write something small and concrete. The "hello world" pattern is a reliable way to see the full approval workflow in action.

  • add a hello world function to the main file

Here's what happens next — Claude runs through a three-step loop before touching anything:

  1. Finds the file — locates src/index.ts (or wherever main lives in your stack)
  2. Shows the diff — displays exactly what it intends to add or change
  3. Asks for approval — waits for your "yes" before writing anything
src/index.ts — proposed change
import express from 'express';import registerRoutes from './routes';function helloWorld(): string return 'Hello from Claude Code!';const app = express();app.use(express.json());registerRoutes(app);app.listen(3000);app.listen(3000, () => console.log(helloWorld()));
Always asks first

Claude Code never silently modifies files. Every edit is shown as a diff and requires your explicit approval. You can review, reject, or ask for changes before anything is written to disk.

Safety & guardrails

The same approval gate applies to shell commands, not just file edits. Anything state-changing — npm run build, a database migration, git push, deleting a file — prompts for your permission the first time in a session before it runs. You can grant blanket approval for a specific command type if you're going to run it repeatedly, but Claude Code will not silently execute destructive commands on your machine without you seeing them first.

Accept all mode

If you trust Claude for a session and want to skip approval on each edit, type accept all or press the corresponding key when prompted. This applies for the duration of the session only.

USERPROMPTCLAUDETHINKSCLAUDEREADS FILESEDITS CODERUNS CMDSOUTPUT+ APPROVALloop continues until task is complete
Watch — FULL Claude Code Tutorial for Beginners in 2026! (Step-By-Step)
Step 06

Use Git with Claude Code

5 min

Claude Code has native git awareness. Ask in plain English — it translates to the correct git commands without you needing to remember flags.

  • what files have I changed?
  • commit my changes with a descriptive message
  • create a new branch called feature/quickstart
  • show me the last 5 commits
  • help me resolve merge conflicts

Example — commit workflow:

claude> commit my changes with a descriptive message

Running: git status
  M  src/index.ts
  M  src/routes/users.ts

Running: git diff (reading changes...)

Proposed commit message:
  "feat: add helloWorld function and update server startup log"

Shall I commit with this message? (y/n)
Merge conflict resolution

When you hit a merge conflict, you don't need to find or paste the file path yourself. Because Claude Code is natively git-aware, just type resolve my current merge conflicts — it runs git status to find the blocked files automatically, reads both branches, understands the intent of each change, and proposes a resolution as a diff for your approval.

Step 07

Fix a Bug or Add a Feature

10 min

This is Claude Code's core use case. Describe what's broken or what you want, and Claude locates the relevant code, understands the context, and implements a solution.

  • add input validation to the user registration form
  • there's a bug where users can submit empty forms — fix it

What Claude does internally:

1. Locates the registration form component
2. Reads the current validation logic (or notes the absence of it)
3. Checks existing patterns in your codebase (Zod, Yup, native HTML, etc.)
4. Implements validation consistent with your stack
5. Runs existing tests to verify nothing broke
6. Shows a diff for your approval

For bugs, describe the symptom rather than the cause. "Users can submit empty forms" is more useful than "the validation function returns true incorrectly" — Claude will find the cause.

Test integration

After making a change, Claude will offer to run your test suite. If tests fail, it analyzes the failure output and proposes a fix — all within the same session without you leaving the terminal.

Step 08

Common Workflows

Ongoing

Once you're comfortable with the basics, these are the four workflows you'll use daily:

01
Code Refactoring

Prompt: refactor the authentication module to use async/await Claude audits callback patterns/promises, rewrites to async/await, preserves error logic, and displays the diff before applying.

02
Writing Unit Tests

Prompt: write unit tests for the calculator functions Claude analyzes your test suite framework (Jest, PyTest, etc.) and writes assertions covering happy paths and edge cases.

03
Auto-Documentation

Prompt: update the README with installation instructions Claude parses setup scripts, configs, and dependencies to generate accurate, zero-boilerplate README guides.

04
Smart Code Reviews

Prompt: review my changes and suggest improvements Claude inspects your git diff, analyzes correctness and style, and outputs suggestions as structured comments.

Phase 3 — Mastering the Tool & CI/CD
Step 09

Commands Reference

Two categories: shell commands you run before starting a session, and slash commands you use inside one.

Shell commands

CommandWhat it does
claudeStart an interactive session in the current directory
claude "task"Start a session with an initial task pre-loaded
claude -p "query"One-shot: run a single query, print output, exit — no interactive session
claude -cContinue the most recent session
claude -rResume a past session (shows a list to pick from)

Session commands (inside Claude)

CommandWhat it does
/clearClear message history and start a fresh context window
/helpList all available slash commands and keyboard shortcuts
/exitQuit Claude Code and return to the shell
/loginLog out and re-authenticate (switch accounts or providers)
/resumePick up a previous session with full conversation history
Step 10

Advanced Features and Interfaces

The basics get you 80% of the value. These features unlock the rest — especially for teams and complex projects.

CLAUDE.md

A CLAUDE.md file in your project root acts as persistent memory for Claude. Put your tech stack, coding conventions, environment setup, and key constraints here. Claude reads it at the start of every session — automatically, no prompting required.

Plan Mode

Before taking any action, Claude outlines its full approach and waits for your sign-off. Use it for large refactors, database migrations, or anything where a wrong move is costly. Enable it by asking: use plan mode for this.

MCP — Model Context Protocol

Connect Claude to external tools — databases, REST APIs, Slack, Jira, custom scripts. MCP turns Claude into an agent that can query live data and take real-world actions beyond the filesystem.

Skills & Hooks

Extend Claude's behavior with custom slash commands (Skills) and lifecycle hooks that trigger on specific events — file saves, test runs, commit attempts. Build a workflow that fits your team's process exactly.

Available interfaces

Claude Code isn't only a terminal tool. The same agent runs across multiple surfaces:

Terminal CLIclaude.ai WebDesktop AppVS Code ExtensionJetBrains PluginSlack IntegrationGitHub ActionsGitLab CI/CD

For CI/CD use cases, claude -p "..." in non-interactive mode integrates cleanly into pipelines. See the official quickstart docs for GitHub Actions YAML examples.

AI Coding Agent Myths vs. Truths

Myth
Claude Code will replace software engineers.
Truth: Claude Code acts as a highly efficient developer assistant. It accelerates refactoring, test writing, and bug hunting, but still requires architectural guidance, logic validation, and senior oversight.
Myth
Running Claude Code on a project is insecure.
Truth: Claude Code runs locally on your machine and only sends specific file context selected for each query to Anthropic's API. It does not upload your entire database or project folder.
Myth
API token costs make agents too expensive.
Truth: Prompt caching reduces repeating context costs by up to 90%. Setting up a proper .claudeignore prevents scanning massive dependency/build folders, keeping costs minimal.

Frequently Asked Questions

Not strictly — Claude Code can explain codebases, generate code, and handle git for you without deep programming knowledge. That said, familiarity with a terminal helps significantly. If you know how to cd into a folder and run a command, you have enough to get started. The more you understand about what Claude is doing, the better you'll be able to guide it.
Claude Code is included in Claude Pro, Max, Team, and Enterprise plans at no additional charge — usage counts against your plan's limits. If you use the Anthropic Console, you pay per token at API rates. Cloud provider pricing (Bedrock, Vertex, Azure) follows each provider's Claude pricing schedule. Check console.anthropic.com for current token prices. One thing that catches API-rate users off guard: Claude Code reads files automatically to build context, and on a large project that can add up fast — scanning node_modules or a big dist folder burns tokens without you asking it to. Add a .claudeignore file (see Step 4) to exclude directories Claude shouldn't read, and prompt caching helps reduce the cost of repeated context within a session, but it is not a substitute for keeping the readable surface area small.
Your code stays on your machine. Claude Code only sends to Anthropic's servers what you include in prompts — the specific file contents it reads as context for a given request. It does not upload your entire project in the background. Review Anthropic's privacy policy for full details on data handling.
claude launches an interactive session where you have a back-and-forth conversation. claude "task" also launches an interactive session, but pre-populates your first message — useful for jumping straight in. claude -p "task" is the non-interactive variant: it runs the query once, prints the output to stdout, and exits — ideal for scripting and CI pipelines.
It's a Markdown file you create at the root of your project (or in a parent directory for global settings). Claude reads it at the start of every session. Use it to document your tech stack, coding style, environment setup commands, naming conventions, and any constraints Claude should know about. Think of it as onboarding documentation for an AI collaborator. The more context you put here, the less you have to re-explain every session.
Yes. Claude Code can run any shell command — npm test, pytest, cargo build, make, whatever your project uses. It will ask for your approval before running a command for the first time in a session. You can grant blanket approval for a command type to streamline repeated runs.
In Plan Mode, Claude lays out the full sequence of actions it intends to take before doing anything. This is useful when the task is complex, touches many files, or carries risk (database schema changes, large refactors, infrastructure modifications). Review the plan, ask questions, request adjustments, then approve. Claude proceeds only after you confirm.
Yes. Claude Code integrates with GitHub Actions, so you can run it as part of your CI/CD pipeline — for automated code review, test generation, or changelog drafting on every pull request. There is also a native GitHub integration for comment-driven workflows. See the Claude Code GitHub repo for CI configuration examples.
All major languages and most minor ones — if it is a text file, Claude can read and write it. This includes Python, TypeScript, JavaScript, Go, Rust, Java, C/C++, Ruby, PHP, Swift, Kotlin, Elixir, Haskell, SQL, shell scripts, infrastructure-as-code (Terraform, Pulumi), and configuration formats (YAML, TOML, JSON). Language support is not a separate feature — it is a function of the underlying model's training.
claude opens a persistent, interactive session where you have a conversation. Your message history accumulates and Claude uses prior context for each response. claude -p "query" is stateless: one query in, one response out, then the process exits. Use -p in shell scripts, GitHub Actions, cron jobs, or any automated context where you do not need back-and-forth dialogue.