Claude Code Tutorial: Zero to First Working Session in 10 Minutes (2026)

Everything you need to start using Claude Code in 2026 — install, authenticate, CLAUDE.md setup, real workflow examples, and how to extend with AnyCap for media and web access.

by AnyCap

Claude Code terminal — clean getting started screen with green glow, beginner-friendly

Claude Code is Anthropic's terminal-native AI coding agent. You run it in your shell, point it at a codebase, and it reads files, writes code, runs tests, and fixes errors — all autonomously. This guide walks you from zero to your first working Claude Code session in under 10 minutes, then shows you how to extend it with media generation, web search, and cloud storage via AnyCap.


What Is Claude Code?

Claude Code (also called claude CLI) is a command-line agent built on Claude 3.7 Sonnet / Claude 4. Unlike chat interfaces, it operates directly in your file system:

  • Reads and writes files without copy-pasting
  • Runs shell commands (tests, builds, linters) and interprets the output
  • Browses your codebase across multiple files and directories
  • Fixes its own errors by reading stderr and adjusting code
  • Calls MCP tools for capabilities beyond the base model

It is not an IDE plugin — it is a standalone agent you invoke from any terminal.


Prerequisites

  • macOS, Linux, or Windows (WSL2)
  • Node.js 18+ (node --version to check)
  • An Anthropic API key (get one here)

Step 1: Install Claude Code

npm install -g @anthropic-ai/claude-code

Verify:

claude --version
# claude-code 1.x.x

Step 2: Authenticate

export ANTHROPIC_API_KEY="sk-ant-..."

Or add it to your shell profile (.bashrc / .zshrc):

echo 'export ANTHROPIC_API_KEY="sk-ant-..."' >> ~/.zshrc
source ~/.zshrc

Step 3: Run Your First Session

Navigate to any project directory and start an interactive session:

cd ~/my-project
claude

You'll see the Claude Code prompt:

Claude Code v1.x.x  |  /help for commands  |  Ctrl+C to exit

> 

Try a simple task:

> Explain what this codebase does in 3 sentences, then list the 3 biggest technical debt items.

Claude reads your files and replies. No copy-pasting, no file uploads.


Step 4: Run a One-Shot Task (Non-Interactive)

For scripting and automation, skip the REPL and pass the task directly:

claude -p "Write unit tests for all functions in src/utils.ts using Vitest. Save them to src/utils.test.ts."

Claude runs, writes the file, and exits. You can chain this in CI pipelines, Makefiles, or shell scripts.


Core Commands

Command What It Does
claude Start interactive REPL session
claude -p "task" One-shot task, non-interactive
claude -p "task" --output file.md One-shot + save output to file
/help Show all slash commands
/clear Clear conversation context
/compact Summarize context to save tokens
/init Create CLAUDE.md project configuration
Ctrl+C Cancel current operation
Ctrl+D Exit session

Setting Up CLAUDE.md (Project Configuration)

Create a CLAUDE.md file in your project root to give Claude permanent context about your project:

claude /init

Or write it manually:

# Project: My SaaS App

## Stack
- Next.js 15, TypeScript, Tailwind CSS
- PostgreSQL + Prisma ORM
- Auth via Clerk

## Code Style
- Functional components only (no class components)
- Use named exports, not default exports
- All async functions must have try/catch
- Prefer `const` over `let`

## Testing
- Vitest for unit tests
- Playwright for E2E
- Run tests with `npm test`

## Important Files
- `src/lib/db.ts` — database client (do not modify the singleton)
- `src/types/index.ts` — shared types (always update when adding new entities)

Claude reads CLAUDE.md at the start of every session. This eliminates the need to re-explain your stack every time.


Real Workflow Examples

Refactor a file

> Refactor src/components/UserCard.tsx to use the new design system tokens
  from src/design-system/tokens.ts. Replace all hardcoded colors and spacing
  values. Run the TypeScript compiler after and fix any type errors.

Add a feature end-to-end

> Add a "dark mode" toggle to the app.
  - Add a ThemeContext in src/contexts/ThemeContext.tsx
  - Wrap the app in _app.tsx
  - Add the toggle button to Navbar.tsx
  - Persist the preference in localStorage
  - Update globals.css to support both themes

Debug a failing test

> The test "UserService > createUser > should hash password" is failing.
  Read the test, read the implementation, identify the root cause, fix it,
  and run the tests again to confirm.

Generate a database migration

> Add a "subscription_tier" column to the users table.
  - Type: enum ('free', 'pro', 'enterprise'), default 'free'
  - Create the Prisma migration
  - Update all TypeScript types that reference User
  - Run prisma generate

Extending Claude Code with AnyCap

Out of the box, Claude Code handles text and code. AnyCap adds:

Capability Command
Generate images anycap image generate --prompt "..." --output file.png
Generate video anycap video generate --prompt "..." --output file.mp4
Generate music anycap music generate --prompt "..." --output track.mp3
Web search anycap search "query"
Crawl a URL anycap crawl https://example.com
Upload to Drive anycap drive upload file.png --share

Install AnyCap

curl -fsSL https://anycap.ai/install.sh | sh
anycap login

Add as MCP server (so Claude Code calls it as a tool)

Create .claude/mcp.json in your project:

{
  "mcpServers": {
    "anycap": {
      "command": "anycap",
      "args": ["mcp", "serve"],
      "env": {
        "ANYCAP_API_KEY": "your_key_here"
      }
    }
  }
}

Now Claude Code can generate assets, search the web, and upload files — all from natural language inside the session.

Example session with AnyCap

> Build the landing page for our new feature launch.
  1. Generate a hero image: abstract data visualization, dark theme, purple accents
  2. Write the HTML/CSS for the landing page using the image as the hero
  3. Upload the image to Drive and use the CDN URL in the HTML
  4. Save the final landing-page.html to /workspace/landing/

Claude Code chains four tool calls — image_generate, file write, drive_upload, file write — and delivers a complete landing page in one session.


Pricing

Claude Code charges per token consumed.

Model Input Output
Claude 3.7 Sonnet $3 / 1M tokens $15 / 1M tokens
Claude 4 Opus $15 / 1M tokens $75 / 1M tokens

A typical coding session (reading a medium codebase, making changes, running tests) uses roughly 50,000–150,000 tokens total — around $0.15–$0.45 per session on Sonnet.

Tip: Use /compact when the context gets long. It summarizes the conversation history, reducing token usage by 40–60% without losing important context.


Common Pitfalls and Fixes

Problem Fix
"API key not found" export ANTHROPIC_API_KEY="sk-ant-..." or add to .env
Agent runs in wrong directory cd project-root before running claude
Context gets stale mid-session Run /compact or /clear and re-brief
Claude edits wrong file Reference the full file path explicitly in your prompt
Infinite fix loop Add --no-auto-fix or break the task into smaller steps
Large codebase — slow reads Add exclusion patterns to CLAUDE.md: "Do not read node_modules, dist, .next"

FAQ

Q: Is Claude Code different from Claude.ai?
A: Yes. Claude.ai is a chat interface. Claude Code is a terminal agent with direct file system access, shell execution, and MCP tool support. They use the same underlying models but are completely different products.

Q: Can I use Claude Code with my own Anthropic API key?
A: Yes — and that is the recommended approach. You control costs, usage, and data privacy directly.

Q: Does Claude Code upload my code to Anthropic?
A: The contents of files Claude reads are sent to the Anthropic API as part of the conversation context. This follows Anthropic's standard API privacy policy. For sensitive codebases, review Anthropic's data handling terms and consider using their API Enterprise agreement.

Q: How is Claude Code different from Cursor?
A: Cursor is an IDE built on VS Code with AI features integrated into the editor UI. Claude Code is a terminal-native agent with no GUI. Cursor is better for development workflows where you want visual file navigation. Claude Code is better for autonomous multi-step tasks, CI pipelines, and scripted workflows.

Q: Can I run Claude Code in a CI/CD pipeline?
A: Yes. Use claude -p "task" (non-interactive mode) in your GitHub Actions, CircleCI, or Buildkite config. Set ANTHROPIC_API_KEY as a CI secret.

Q: What is the maximum context window?
A: Claude 3.7 Sonnet supports 200,000 tokens. Large codebases may exceed this — use /compact and explicit file references to stay within limits.