Learn Claude Code

An interactive tutorial to get you productive with Anthropic's AI-powered CLI tool.

What is Claude Code?

Your AI pair-programmer, right in the terminal

Claude Code is an agentic coding tool by Anthropic that lives in your terminal. It can read your codebase, edit files, run commands, and help you build software faster.

Key idea Unlike chat-based AI tools, Claude Code operates directly in your project directory. It sees your files, understands context, and can take actions on your behalf.

What it can do:

Terminal
$ claude Claude Code v1.x Type your request, or /help for commands. claude> fix the failing tests in src/auth

Quick check: Where does Claude Code run?

Installation

Get Claude Code up and running in seconds

Claude Code is installed globally via npm. You need Node.js 18+ on your machine.

Terminal
$ npm install -g @anthropic-ai/claude-code added 1 package in 12s $ claude --version 1.0.x

After installing, navigate to any project directory and launch it:

Terminal
$ cd my-project $ claude Welcome to Claude Code! I can see 42 files in your project. claude> _
Tip On first launch Claude Code will ask you to authenticate with your Anthropic API key or sign in to your account.

Try it: Type the install command

Basic Usage

Talking to Claude Code — prompts and slash commands

Once Claude Code is running, you simply type natural language requests. You can also use slash commands for specific actions:

CommandWhat it does
/helpShow available commands
/clearClear conversation context
/compactSummarize conversation to save context
/costShow token usage and cost
/reviewReview code changes
/commitCreate a git commit for current changes
Terminal
claude> add input validation to the signup form I'll add validation to src/components/SignupForm.tsx. Editing src/components/SignupForm.tsx... + Added email format validation + Added password strength check + Added error messages display claude> /commit Created commit: "Add input validation to signup form"

Quick check: Which slash command would you use to see how many tokens you've used?

Permissions & Safety

You stay in control of what Claude Code does

Claude Code asks for your approval before performing certain actions. These are categorized into permission levels:

Terminal
Claude wants to run: npm test Allow? [y]es / [n]o / [a]lways y = allow once n = deny this action a = always allow this command
Always allow Pressing a will save the permission so you won't be asked again for that specific action. You can manage saved permissions in the settings.

You can also pre-configure allowed tools by passing flags:

Terminal
$ claude --allowedTools "Bash(npm test)" "Bash(npm run lint)" Pre-approved: npm test, npm run lint

Quick check: When Claude Code wants to edit a file, what should you do?

Real Workflows

Common patterns for everyday development

Here are some practical ways developers use Claude Code daily:

Bug fixing

Terminal
claude> the login page crashes when email is empty, fix it

Code review

Terminal
claude> review the changes in my current branch for security issues

Writing tests

Terminal
claude> write unit tests for the PaymentService class

Non-interactive / headless mode

You can also use Claude Code in scripts and CI pipelines with the -p flag:

Terminal
$ claude -p "explain what this project does" --output-format json

Try it: Write a prompt for Claude Code

Ask Claude Code to do something useful with your project (at least 10 characters):

Tips & Cheat Sheet

Level up your Claude Code workflow

Pro tips

Quick Reference

ActionHow
Start Claude Codeclaude
Resume last sessionclaude --continue
One-shot promptclaude -p "..."
Clear context/clear
Compact context/compact
Check cost/cost
Create commit/commit
Exit/exit or Ctrl+C
CLAUDE.md Drop a CLAUDE.md file in your project root with build instructions, coding conventions, or anything you want Claude to know. It's like a README for your AI assistant.

Final quiz: How do you resume your last Claude Code conversation?