AI agents · OpenClaw · self-hosting · automation

Quick Answer

How to Use Claude Code: Beginner Guide (2026)

Published: • Updated:

How to Use Claude Code: Beginner Guide (2026)

Claude Code is a terminal-based AI coding assistant from Anthropic. Install with npm install -g @anthropic/claude-code, authenticate with your API key, and run claude in any project directory to start coding with AI.

Quick Answer

Claude Code runs in your terminal, not as an IDE extension. It’s agentic — meaning it can read files, run commands, and make changes across your codebase. Here’s the 5-minute quickstart:

  1. Install: npm install -g @anthropic/claude-code
  2. Authenticate: claude auth (needs Anthropic API key or Max subscription)
  3. Navigate to project: cd your-project
  4. Start: claude
  5. Ask anything: “Fix the bug in auth.ts” or “Add dark mode support”

Step-by-Step Installation

Prerequisites

  • Node.js 18+ installed
  • Anthropic API key or Claude Max subscription ($200/mo)
  • Terminal access (Mac/Linux/Windows WSL)

Install Claude Code

npm install -g @anthropic/claude-code

Authenticate

claude auth

This opens your browser to sign in. Enter your API key or use your Max subscription.

Verify Installation

claude --version

Your First Session

Start Claude Code

cd /path/to/your/project
claude

You’ll see a prompt like:

Claude Code v1.2.0
Type your request or /help for commands
>

Try These First Commands

Explore the codebase:

What does this codebase do? Give me a high-level overview.

Fix a bug:

There's a bug where users can't log out. Find and fix it.

Add a feature:

Add a dark mode toggle to the settings page.

Refactor:

Refactor the auth module to use async/await instead of callbacks.

Essential Commands

CommandWhat it does
/helpShow all commands
/clearClear conversation history
/compactCompress context to save tokens
/costShow current session cost
/planEnter Plan Mode (think before acting)
/edit <file>Open a file for editing
/run <cmd>Run a shell command
Ctrl+CCancel current operation
exitEnd session

Setting Up CLAUDE.md

CLAUDE.md is a special file that gives Claude project context. Create it in your project root:

# Project: MyApp

## Overview
A React + TypeScript SaaS application for task management.

## Tech Stack
- Frontend: React 18, TypeScript, Tailwind CSS
- Backend: Node.js, Express, PostgreSQL
- Auth: Clerk

## Code Style
- Use functional components with hooks
- Prefer named exports
- Follow existing patterns in the codebase

## Important Context
- Never modify files in /vendor/
- Always run tests after making changes
- API routes live in /src/api/

## Common Commands
- `npm run dev` — Start dev server
- `npm test` — Run tests
- `npm run build` — Production build

Claude reads this automatically when you start a session.

Global Settings (~/.claude/settings.md)

For preferences across all projects:

# Global Claude Code Settings

## Preferences
- Be direct, skip pleasantries
- Show diffs before applying changes
- Run tests automatically after changes

## Code Style
- Follow language-specific best practices
- Prefer readability over cleverness
- Add comments for complex logic only

Plan Mode (Think Before Acting)

For complex tasks, use Plan Mode:

/plan

Then describe your task:

I need to migrate our database from SQLite to PostgreSQL.

Claude will create a step-by-step plan BEFORE making any changes. Review and approve each step.

Cost Management

Claude Code uses your API tokens. Monitor costs:

/cost

Typical costs (March 2026):

  • Simple questions: $0.01-0.05
  • Feature additions: $0.10-0.50
  • Complex refactors: $0.50-2.00
  • Full-day heavy use: $5-20

Save money:

  • Use /compact to compress context
  • Start fresh sessions for unrelated tasks
  • Use Sonnet 4 instead of Opus for simpler work

Real Workflow Example

Here’s how a pro uses Claude Code:

# Morning: Start fresh
cd ~/projects/myapp
claude

# 1. Check what needs doing
> What are the TODO comments in this codebase?

# 2. Work on a feature
> Implement the /plan export feature from TODO in api/exports.ts

# 3. Review changes
> Show me the diff of changes you made

# 4. Test
> Run the tests and fix any failures

# 5. Wrap up
> Write a commit message for these changes
exit

git add .
git commit -m "<paste Claude's message>"

Common Mistakes to Avoid

  1. Not using CLAUDE.md — Claude works better with context
  2. Giant single requests — Break complex tasks into steps
  3. Not reviewing diffs — Always check what Claude changed
  4. Ignoring /plan — Use it for anything non-trivial
  5. Never running /cost — Easy to overspend

FAQ

How much does Claude Code cost?

It’s usage-based via Claude API. Expect $50-200/month for active development. The Max subscription ($200/mo) includes Claude Code access with generous limits.

Is Claude Code better than Cursor?

Different tools. Claude Code is terminal-based and better for complex reasoning. Cursor is IDE-based with better visual experience. Many devs use both.

Can I use Claude Code offline?

No, it requires an internet connection to communicate with Claude’s API.

What’s the difference between Claude Code and Claude in the browser?

Claude Code is agentic — it can read your files, run commands, and make changes. Browser Claude only sees what you paste.


Last verified: March 13, 2026