Beginner

How to Use Claude Code: Getting Started Guide (2026)

Published June 30, 2026

Claude Code is one of the most powerful AI coding tools available. It runs in your terminal, reads your actual codebase, and can autonomously implement features, fix bugs, and write tests. This guide walks you through setting it up and using it effectively from your first session.

TLDR

Install Claude Code via npm, authenticate with your Anthropic account, navigate to your project directory, and describe what you want to build or fix. Claude Code reads your files and handles the rest.

How to do it

1

Install Claude Code

Open your terminal and run: npm install -g @anthropic-ai/claude-code. This installs the Claude Code CLI globally. You need Node.js 18 or later. After installation, run "claude" to verify it is installed correctly.

2

Authenticate with your Anthropic account

Run "claude" in your terminal and follow the authentication prompt. You will need an Anthropic account with API access. Claude Code uses your API key to make requests. Usage is billed to your Anthropic account.

3

Navigate to your project

Use "cd" to navigate to your project directory in the terminal. Claude Code will read from this directory. The better organized your project is, the easier it is for Claude Code to understand the structure.

4

Start a session with a clear task

Run "claude" to start a session, then describe your task clearly. Good task descriptions specify what to build, where it fits in the existing code, and any constraints. Example: "Add a password reset feature to the existing auth module in /src/auth. Use the existing email sending utility."

5

Review changes before confirming

Claude Code will show you what it plans to do and ask for confirmation before making changes. Read these plans carefully. You can reject, modify, or approve each action. This keeps you in control even though Claude Code is working autonomously.

6

Use slash commands for specific tasks

Claude Code supports slash commands for common actions. Type "/help" to see all available commands. Useful ones include "/clear" to start a fresh context, "/cost" to see API usage for the session, and "/compact" to summarize the conversation when context gets long.

Example prompt

Adding a password reset feature to an existing Express/Node.js application

Read the existing user authentication code in /src/auth/. Add a "forgot password" flow that: (1) accepts an email address, (2) validates it exists in the database, (3) sends a reset link using the existing sendEmail utility, and (4) handles the reset token validation. Follow the same patterns and error handling style already used in this codebase.

When to use it

Large feature implementations

When a feature requires changes across multiple files, Claude Code is faster than explaining each step in a chat interface. Describe the outcome you want and let it plan the implementation.

Debugging across files

When a bug has a non-obvious root cause across multiple modules, Claude Code can trace through the codebase to find where the problem originates.

Writing test suites

Ask Claude Code to write comprehensive tests for a module. It reads the source code, understands the logic, and writes tests that match your existing testing patterns and framework.

Common mistakes

01

Vague task descriptions

Claude Code works best with specific goals. "Make the app better" gives it no direction. "Refactor the /src/api/users.ts file to use async/await instead of callbacks, maintaining the same external interface" gives it everything it needs.

02

Not reviewing proposed changes

Claude Code will tell you what it plans to do before doing it. Always read this. It occasionally misunderstands scope or makes unnecessary changes. Catching this before confirmation is faster than reverting.

03

Running on large codebases without context

On very large projects, give Claude Code a starting point: which directory, which module, which file. Letting it explore an entire monorepo without direction can be slow and expensive.

Frequently asked questions

How much does Claude Code cost?+

Claude Code uses Anthropic API credits. Costs vary significantly by task complexity and how much of your codebase it reads. Simple tasks cost a few cents; complex multi-file tasks can cost more. Run "/cost" during a session to see current usage.

Can Claude Code push code to GitHub?+

Claude Code can run any terminal command you allow, including git commands. It can stage, commit, and push changes. Always review the git diff before confirming a push.

Does Claude Code work on Windows?+

Claude Code works on macOS and Linux natively. Windows support is available via WSL (Windows Subsystem for Linux).

Can I use Claude Code on a private codebase?+

Yes. Claude Code reads files from your local machine. Your code is sent to Anthropic's API for processing. Check Anthropic's data policy if you have strict confidentiality requirements.

Bottom line

Claude Code changes what is possible in a single coding session. The learning curve is the terminal interface, but once you are comfortable with it, the ability to describe a task and have AI handle the implementation across your actual codebase is a significant productivity multiplier.

Related concepts

More from Learn

Back to Learn