Install Claude Code, learn the REPL, tools, and session management
Welcome to Claude Code Mastery! In this first lesson, you'll install Claude Code, run your first session, and understand the core tools and workflow that make it so powerful.
Claude Code is an agentic coding tool that lives in your terminal. It can read, write, and execute code in your local environment — not in a sandbox or a cloud VM, but right on your machine, with full access to your project files.
Think of it as having a senior engineer pair-programming with you, except they can also run your tests, commit to git, search the web, and navigate your browser.
| Surface | Description |
|---|---|
| CLI (Terminal) | The primary interface — an interactive REPL |
| VS Code Extension | Graphical panel integrated into VS Code / Cursor |
| JetBrains Plugin | Native integration with IntelliJ-based IDEs |
| GitHub Actions | Automated CI/CD workflows triggered by PRs / issues |
| Chrome Extension | Browser automation from within Claude Code |
| Claude.ai (Web) | Run Claude Code remotely from the web app |
Full access
Unlock all 14 lessons, templates, and resources for Claude Code Mastery. Free.
Q: What makes Claude Code different from a regular chatbot?
Claude Code is an agentic coding tool — it runs in your terminal with full access to read, write, execute, and search your project files. Unlike a chatbot that gives a single response, Claude Code maintains a session, uses tools (Bash, Edit, Read, Grep), and iterates on tasks autonomously.
node --version)npm install -g @anthropic-ai/claude-code
brew install claude-code
claude --version
# Update later:
claude update
# or: npm update -g @anthropic-ai/claude-code
# or: brew upgrade claude-code
On first run, Claude Code prompts you to sign in:
claude
# → Opens browser for authentication
| Account | Model Access | Notes |
|---|---|---|
| Pro | Opus 4.6 (with limits) | Personal use |
| Max | Opus 4.6 (default) | Higher limits |
| Team | Opus 4.6 | Shared billing |
| Enterprise | Opus 4.6 available | Managed policies |
| API Key | Any model | Pay-per-token |
export ANTHROPIC_API_KEY="your-api-key-here"
claude
Claude Code also supports AWS Bedrock, Google Vertex AI, and Anthropic Foundry for enterprise deployments.
Q: What are the two ways to authenticate with Claude Code?
ANTHROPIC_API_KEY environment variable for pay-per-token usagecd ~/my-project
claude
You're now in the Claude Code REPL. Type naturally:
> What does this project do?
> Find the main entry point
> Explain the auth module
claude -p "Explain the architecture of this project"
Pro Tip: The
-pflag is your gateway to scripting and CI/CD. We'll use it extensively in Lesson 11.
| Command | What It Does |
|---|---|
/help | Show available commands |
/clear | Clear conversation context |
/compact | Summarize and compress context |
/cost | Show token usage for this session |
/model | Switch models mid-session |
/status | Show account info and current model |
/memory | Open memory files in your editor |
/permissions | View and manage permission rules |
/init | Bootstrap a CLAUDE.md for your project |
/resume | Resume a previous conversation |
/rename | Name the current session |
| Shortcut | Action |
|---|---|
Shift+Tab | Cycle permission modes (Normal → Accept Edits → Plan) |
Ctrl+O | Toggle verbose mode (see thinking) |
Option+T / Alt+T | Toggle extended thinking |
Ctrl+C | Cancel current operation |
Escape | Interrupt Claude's current turn |
Complete the commands:
claude ___ "your prompt"/ ___/ ___claude -p "your prompt" (or --print)/cost/compactClaude Code comes with several built-in tools that it uses automatically:
| Tool | Purpose | Requires Permission? |
|---|---|---|
| Read | Read file contents | No (read-only) |
| Glob | Find files by pattern | No |
| Grep | Search file contents | No |
| Edit | Modify existing files | Yes (per session) |
| Write | Create new files | Yes (per session) |
| Bash | Run shell commands | Yes (per command) |
| WebFetch | Fetch web pages | Yes |
| Task | Spawn subagents | Yes |
npm test")Q: Which tools does Claude Code use without asking permission?
Read-only tools don't require permission: Read, Glob, and Grep. Everything else — Edit, Write, Bash, WebFetch, Task — requires your approval.
The most effective Claude Code workflow follows three phases:
> Give me an overview of this codebase
> What testing framework does this project use?
> Show me how authentication works
> I need to add rate limiting to the API. Create a plan.
Or use Plan Mode explicitly:
claude --permission-mode plan
> Implement the rate limiting plan we discussed
> Run the tests to verify
> Create a PR with these changes
claude --continue # Resume most recent session
claude -c # Short form
claude --resume auth-refactor # Resume by name
claude -r abc123 # Resume by session ID
Inside a session:
> /rename auth-refactor
Fill in the blanks:
claude ___claude ___ <name>/___ <name>claude -c (or --continue)claude -r <name> (or --resume)/rename <name>claude to start an interactive session/cost to see token usage/clear to reset context/rename my-first-session to name itclaude -c to resumeReflection: What surprised you about the output? How much did it cost?
Scenario: You're reviewing a large PR and want Claude to analyze it without accidentally modifying any files.
What mode would you use?
Use Plan Mode: claude --permission-mode plan
This restricts Claude to read-only operations. It can analyze files, search code, and suggest changes, but cannot edit files or run commands.
You can also toggle modes mid-session with Shift+Tab.
| Concept | One-Liner |
|---|---|
| What it is | Terminal-based agentic coding tool with file/shell/web access |
| Install | npm i -g @anthropic-ai/claude-code or brew install claude-code |
| Auth | Browser sign-in or ANTHROPIC_API_KEY env var |
| CLI entry | claude starts interactive; claude -p is headless |
| Permission tiers | Read-only (auto), Bash (per-command), Edits (per-session) |
| Core workflow | Explore → Plan → Execute |
| Session resume | claude -c continues; claude -r name resumes |
| Key commands | /cost, /clear, /compact, /model, /init |
Next up: Configuration & Settings → — Learn the settings hierarchy, model selection, and permission rules.