Quick Answer
Claude Code is Anthropic's agentic coding tool that runs directly in your terminal. To get started, you need Node.js 18+, a terminal, and an API key. Install Claude Code via npm (npm install -g @anthropic-ai/claude-code), configure your API credentials, and run claude in any project directory to start your first AI-powered coding session. For beginners, the recommended setup uses TeamoRouter as a unified API gateway -- it simplifies credential management, provides prompt caching (critical for keeping costs low), and works even in regions where direct Anthropic API access is restricted. This guide walks through every step.
What Is Claude Code?
Claude Code is a command-line agentic coding tool developed by Anthropic. Unlike Claude Web (the browser-based chat interface), Claude Code operates directly inside your terminal with full access to your filesystem, git history, and shell environment. It can read your codebase, edit files, run commands, create commits, and manage pull requests -- all while you supervise.
Think of it as an AI pair programmer that lives in your terminal. You describe what you want to build or fix, and Claude Code explores your project, writes the code, runs tests, and iterates until the task is done. It is not just a chatbot that outputs code snippets; it is an agent that actively works on your codebase.
Key capabilities in 2026 include:
- Full codebase awareness: Claude Code indexes your project and understands the architecture before making changes.
- Multi-file editing: It can create, modify, and delete files across your entire project in a single session.
- Terminal command execution: It runs build commands, tests, linters, and git operations directly.
- Git integration: It stages changes, writes commit messages, creates branches, and opens PRs.
- MCP server support: Through the Model Context Protocol, it connects to external tools like databases, APIs, and web search.
For beginners, Claude Code can feel like having a senior developer sitting next to you, explaining what they are doing and why, while you retain full control over every change.
Prerequisites: What You Need Before Installing
Before installing Claude Code, make sure you have these basics in place:
1. Node.js 18 or Later
Claude Code is distributed as an npm package and requires Node.js. To check your version:
node --version
If you do not have Node.js installed, download it from nodejs.org (the LTS version is recommended for beginners) or use a version manager:
# macOS / Linux: install via nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
nvm install --lts
# macOS: install via Homebrew
brew install node
2. A Terminal Application
- macOS: Terminal.app (built-in) or iTerm2
- Windows: Windows Terminal, PowerShell, or Git Bash
- Linux: Any terminal emulator (GNOME Terminal, Konsole, etc.)
Beginners on Windows should use Windows Terminal or Git Bash for the best experience. Command Prompt works but has some limitations with interactive CLIs.
3. An API Key for Claude Access
Claude Code accesses Claude models through an API. You have two options:
- Direct Anthropic API: Sign up at console.anthropic.com, create an API key, and prepay for usage. Works if you are in a supported region.
- TeamoRouter unified gateway (recommended for beginners): TeamoRouter provides a single API key that works across Claude, GPT, Gemini, and other models. It offers prompt caching (critical for keeping agent costs low), a unified billing dashboard, and works globally including in regions where Anthropic does not offer direct access. Sign up at teamorouter.com.
We strongly recommend the TeamoRouter path for beginners. It removes the most common pain point -- runaway costs from uncached agent loops -- and simplifies setup to a single API key and base URL.
4. Basic Terminal Familiarity
You do not need to be a command-line expert, but you should be comfortable with:
- Navigating directories (
cd,ls/dir) - Running a command and reading its output
- Basic file operations (optional -- Claude Code handles these for you)
If terms like "terminal" and "command line" are new to you, spend 15 minutes with a beginner terminal tutorial before proceeding. The learning curve is small and pays off enormously.
Step 1: Install Claude Code
With Node.js installed, installing Claude Code is a single command:
npm install -g @anthropic-ai/claude-code
The -g flag installs Claude Code globally, making the claude command available in any directory.
Verify the installation:
claude --version
You should see a version number like 1.0.x. If you get a "command not found" error, restart your terminal or check that your npm global bin directory is in your PATH.
Alternative Installation Methods
- Homebrew (macOS):
brew install claude-code(if available in your tap) - Direct download: Anthropic provides standalone binaries for some platforms at their GitHub releases page.
- npm without global install:
npx @anthropic-ai/claude-coderuns Claude Code without installing it permanently.
For beginners, the global npm install is the simplest and most reliable method.
Step 2: Configure Your API Connection
This is the most important step, and where beginners most often run into trouble. Claude Code needs to know which API endpoint to use and which key to authenticate with.
Option A: TeamoRouter Gateway (Recommended for Beginners)
If you signed up for TeamoRouter (step 3 in prerequisites), configure Claude Code like this:
# Set your TeamoRouter API key
export ANTHROPIC_API_KEY="tr-your-teamorouter-key-here"
# Point Claude Code to TeamoRouter's Anthropic-compatible endpoint
export ANTHROPIC_BASE_URL="https://api.teamorouter.com/anthropic"
To make these settings permanent (so you do not need to re-enter them every time you open a terminal), add them to your shell configuration file:
# For zsh (macOS default): add to ~/.zshrc
echo 'export ANTHROPIC_API_KEY="tr-your-teamorouter-key-here"' >> ~/.zshrc
echo 'export ANTHROPIC_BASE_URL="https://api.teamorouter.com/anthropic"' >> ~/.zshrc
source ~/.zshrc
# For bash (Linux default): add to ~/.bashrc
echo 'export ANTHROPIC_API_KEY="tr-your-teamorouter-key-here"' >> ~/.bashrc
echo 'export ANTHROPIC_BASE_URL="https://api.teamorouter.com/anthropic"' >> ~/.bashrc
source ~/.bashrc
Why TeamoRouter is better for beginners:
- Prompt caching works out of the box: Claude Code resends long contexts on every turn. Without caching, your token consumption can balloon 10x. TeamoRouter achieves a cache hit rate above 99% under load, meaning most of your context is cached and billed at just 10% of full price.
- One key for all models: If you later want to try Codex, Gemini CLI, or Cursor, your TeamoRouter key works across all of them. No need to manage multiple accounts and billing dashboards.
- Global access: Works from anywhere, including regions where Anthropic does not offer direct service.
For more on the unified gateway approach, see TeamoRouter's AI API gateway.
Option B: Direct Anthropic API
If you prefer to go directly through Anthropic:
export ANTHROPIC_API_KEY="sk-ant-your-anthropic-key-here"
# No need to set ANTHROPIC_BASE_URL -- it defaults to api.anthropic.com
Note: direct Anthropic access is region-restricted. If you are outside a supported region (e.g., China, some parts of Asia and the Middle East), you must use a gateway or relay. TeamoRouter handles this transparently.
Step 3: Your First Claude Code Session
Now for the exciting part. Open a terminal, navigate to a project directory (or create one), and launch Claude Code:
# Create a playground project
mkdir my-first-claude-project
cd my-first-claude-project
# Initialize git (Claude Code works best with version control)
git init
# Launch Claude Code
claude
Claude Code starts in interactive mode with a prompt. You will see something like:
Claude Code v1.0.x
Type /help for commands.
>
Now try your first prompt. A good starting prompt for beginners is something simple and observable:
"Create a simple Python script called hello.py that prints 'Hello from Claude Code!' and a countdown from 5 to 1, then run it."
Claude Code will:
- Read your project directory to understand its state (empty in this case).
- Create
hello.pywith the requested code. - Run
python hello.pyand show you the output. - Ask if you want to keep the changes.
You will see Claude Code's thinking and actions printed in your terminal. It shows you every file it plans to create or modify and every command it plans to run. You approve or reject each action.
Understanding the Permission Model
Claude Code operates with a permission system that puts you in control:
- Read operations (listing files, reading code) are typically allowed automatically.
- Write operations (creating/modifying files) require your approval by default.
- Command execution (running scripts, git commands) requires your approval.
- Network access (API calls, package installs) requires your approval.
You can configure these permissions in ~/.claude/settings.json. For beginners, keep the defaults -- they protect you from accidental changes while you learn.
Step 4: Essential Claude Code Commands
Claude Code uses slash commands for built-in operations. Here are the ones every beginner should know:
Core Commands
| Command | What It Does |
|---|---|
/help |
Show available commands and usage |
/clear |
Start a fresh conversation (clears context) |
/compact |
Compress conversation history to save tokens |
/review |
Review the current session's changes |
/undo |
Revert the last change |
/doctor |
Check Claude Code's health and configuration |
Git Integration Commands
| Command | What It Does |
|---|---|
/commit |
Stage changes and create a commit with a generated message |
/pr |
Create a pull request from current changes |
/diff |
Show the diff of all changes in the session |
Configuration Commands
| Command | What It Does |
|---|---|
/config |
Open the configuration file |
/status |
Show current session status, model, and token usage |
/cost |
Show token usage and estimated cost for the session |
Prompting Commands
| Command | What It Does |
|---|---|
/add-dir |
Add a directory for Claude Code to index |
/init |
Generate a CLAUDE.md file describing your project |
The most important beginner command is /help -- use it whenever you are unsure.
Tips for Writing Effective Prompts
Getting good results from Claude Code is a skill that improves with practice. Here are principles that work well for beginners:
1. Be Specific About What You Want
Bad: "Fix the bug."
Good: "The login function in auth.py throws a ValueError when the email field is empty. Add input validation that returns a clear error message instead."
2. Provide Context
Tell Claude Code which files are relevant and what the expected behavior should be. If you have a CLAUDE.md file in your project (generated with /init), Claude Code reads it automatically for project-wide context.
3. Start Small and Iterate
Break large tasks into smaller steps. Instead of "Build a complete e-commerce backend," start with "Create the database schema for a users table with email, password hash, and created_at fields."
4. Ask for Explanations
If you are learning, add "explain what you are doing" to your prompts. Claude Code will narrate its decisions, which is one of the best ways to learn as a beginner.
5. Use the Plan-Execute-Review Cycle
- Plan: Ask Claude Code to outline its approach before writing code.
- Review: Read the plan and ask for adjustments.
- Execute: Tell Claude Code to implement the approved plan.
- Test: Have Claude Code run the tests or demonstrate the result.
Example: A Complete Beginner Workflow
# 1. Start Claude Code
claude
# 2. Ask for a plan
> I want to build a simple REST API with Express.js that has
two endpoints: GET /health and POST /echo. First, outline
your plan before writing any code.
# 3. After reviewing the plan
> Looks good. Implement it, add error handling, and create a
simple test script that calls both endpoints with curl.
# 4. After implementation
> Run the test script and fix any issues.
This iterative approach gives you full visibility and control while leveraging Claude Code's coding abilities.
Common Beginner Issues and How to Fix Them
"claude: command not found"
Your npm global bin directory is not in your PATH. Fix:
# Find where npm installs global packages
npm config get prefix
# Add it to your PATH (adjust path based on output above)
echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
"Authentication error" or "Invalid API key"
- Double-check your API key for typos (extra spaces are a common culprit).
- Verify the key is active in your provider dashboard.
- If using TeamoRouter, confirm you have set both
ANTHROPIC_API_KEYandANTHROPIC_BASE_URL. - Run
echo $ANTHROPIC_API_KEYto verify the environment variable is set.
"Connection refused" or timeout
- If using a direct Anthropic key: check your network and whether your region is supported.
- If using TeamoRouter: verify the base URL is correct (
https://api.teamorouter.com/anthropic). Try the TeamoRouter Client which includes built-in connectivity diagnostics. - If behind a corporate proxy or VPN, you may need to configure proxy settings.
Session consumes too many tokens
- Use
/compactregularly to compress long conversations. - Break large tasks into separate sessions.
- Check that prompt caching is working (TeamoRouter dashboard shows cache hit rates).
- Set a monthly budget in your API provider dashboard.
Claude Code makes unintended changes
- Keep the default permission settings (ask before write, ask before execute).
- Review every change before approving.
- Use git (
git initbefore starting) so you can always revert. - The
/undocommand reverts the most recent change.
Advanced: Setting Up a CLAUDE.md File
Once you are comfortable with basic usage, create a CLAUDE.md file in your project root. This file tells Claude Code about your project's conventions, architecture, and preferences. It is read automatically at the start of every session.
Generate one with:
claude
> /init
Or create it manually:
# Project Overview
This is a React + Express e-commerce app.
# Coding Conventions
- Use TypeScript, not JavaScript
- Prefer functional components with hooks
- Use Prettier for formatting (config in .prettierrc)
- Write tests with Vitest
# Architecture
- /client: React frontend (Vite)
- /server: Express API
- /shared: Types and utilities used by both
A good CLAUDE.md dramatically improves Claude Code's output quality because it eliminates the need to explain your project conventions in every prompt.
Next Steps After Your First Session
Once you have completed your first Claude Code session, here is a natural progression:
-
Work through a real project task. Pick something small from your actual work -- fix a bug, add a validation rule, or write a unit test. Real tasks teach faster than toy examples.
-
Set up MCP servers. Connect Claude Code to your database, issue tracker, or documentation through the Model Context Protocol. Start with the filesystem and web-search MCP servers, which are the easiest to configure.
-
Try different models. Claude Code supports multiple Claude models (Sonnet, Opus, Haiku). Experiment with different models for different tasks: Sonnet for everyday coding, Opus for complex architecture decisions, Haiku for quick boilerplate generation.
-
Integrate with your editor. Claude Code works standalone, but many developers run it alongside VS Code or JetBrains. The terminal-based workflow complements editor-based AI tools rather than replacing them.
-
Explore the API gateway. If you started with a direct Anthropic key, consider switching to TeamoRouter for unified access, prompt caching, and global availability. If you are already using TeamoRouter, try adding a second tool (like Codex or Cursor) -- your same API key works across all of them.
For a broader perspective on which Claude product fits your workflow best, see our Claude CLI vs Claude Code vs Claude Web comparison. If you are based in China, check How to Use Claude in China 2026.
FAQ
Do I need to know how to code to use Claude Code?
Basic coding knowledge helps significantly but is not strictly required. Claude Code can generate complete applications from natural language descriptions. However, to review its output, understand error messages, and make informed decisions about code quality, some programming familiarity is strongly recommended. Complete beginners should start with a few weeks of basic coding tutorials before using agentic tools.
Is Claude Code free?
Claude Code itself is free and open source. However, you pay for the API calls it makes to Claude models. Costs depend on your usage: a typical coding session costs $0.50 to $5.00 with prompt caching enabled. Without caching (e.g., through a low-quality relay), costs can be 5-10x higher. Using a gateway like TeamoRouter that guarantees prompt caching (>99% hit rate) keeps costs at the low end. See TeamoRouter's AI API gateway for pricing details.
What is the difference between Claude Code and Claude Pro?
Claude Pro ($20/month) gives you access to Claude through Anthropic's web and mobile apps with a fixed monthly message limit. Claude Code is a separate terminal-based tool that uses API billing (pay-per-token). Claude Code is more powerful for software development because it has filesystem access, can run commands, and integrates with git. Many developers use both: Claude Pro for quick questions and research, Claude Code for hands-on coding tasks.
Can I use Claude Code on Windows?
Yes. Claude Code works on Windows 10 and 11 through Windows Terminal, PowerShell, or Git Bash. The npm installation is the same across platforms. Some shell-specific features (like certain git integrations) work best in Git Bash or WSL (Windows Subsystem for Linux), which we recommend for Windows users.
What model does Claude Code use by default?
As of 2026, Claude Code defaults to Claude Sonnet 4, which offers the best balance of capability, speed, and cost for coding tasks. You can switch models with the /model command or by setting the ANTHROPIC_MODEL environment variable. Claude Opus 4 is available for complex architecture and reasoning tasks at a higher per-token cost.
Can multiple people on my team use one API key?
Technically yes, but it is not recommended for anything beyond a 2-3 person team. Sharing a single key means shared rate limits, no per-person usage visibility, and security concerns. TeamoRouter's enterprise plan supports multi-user keys with per-member budgets and usage tracking. For professional teams, set up individual keys or an enterprise gateway account.
What happens if Claude Code gets stuck or makes a mistake?
Claude Code is an agent, not an oracle -- it can and does make mistakes. Always work in a git repository so you can revert changes. Use /undo for the most recent change. For larger mistakes, git checkout . reverts all changes. The permission system (ask before write, ask before execute) is your safety net -- do not disable it until you are very comfortable with the tool.