Beginner · Developer

Getting Started with Claude Code

Anthropic’s AI coding agent lives in your terminal. Not a chat window, not an autocomplete — a full agent that reads your codebase, writes code, runs commands, and makes commits. Here’s how to actually use it.
Sarah Chen April 2026 12 min read

Claude Code is different from other AI coding tools. Cursor and Copilot live inside your editor, suggesting lines as you type. Claude Code lives in your terminal, like a colleague sitting next to you who can read your entire project, write files, run tests, search the web, and execute shell commands — all while you describe what you want in plain English.

This guide gets you from zero to productive. No fluff, no theory — just what you need to know to start using it effectively today.

Installing Claude Code

Claude Code requires Node.js 18+ and an Anthropic API key (or a Max subscription). Install it globally:

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

Then navigate to any project directory and launch it:

cd your-project
claude

That’s it. Claude Code starts, scans your project structure, and presents a prompt. You’re ready to go.

First launch: Claude Code will ask you to authenticate. If you have an Anthropic API key, it’ll prompt for it. If you have a Claude Max subscription, you can use that instead. The tool remembers your credentials for future sessions.

Your First Conversation

The best way to learn Claude Code is to give it a real task. Don’t start with “hello” — start with something you actually need done.

Good first prompts

Explain the structure of this project. What does each directory do?

Find all TODO comments in the codebase and summarize them

Add input validation to the signup form in src/auth/register.ts

The tests in tests/api/ are failing. Diagnose and fix.

Claude Code will read the relevant files, understand the context, propose changes, and — with your permission — make them. You approve each action: file reads happen automatically, but writes and shell commands ask for confirmation.

The Permission System

Claude Code uses a layered permission model. Understanding it saves you from clicking “approve” a hundred times.

Pro tip: Press Shift+Tab to cycle through permission modes. “Auto-accept edits” mode lets Claude Code write files without asking each time — useful when you trust it on a well-scoped task. You can always switch back.

The CLAUDE.md File

This is the most important file most people don’t know about. Create a CLAUDE.md in your project root with instructions that persist across sessions:

# CLAUDE.md

## Project context
This is a Next.js 14 app with TypeScript, Prisma ORM, and Tailwind CSS.
The API routes are in app/api/. Auth uses NextAuth v5.

## Conventions
- Use server components by default, client components only when needed
- All database queries go through the service layer in src/services/
- Tests use Vitest, run with `npm test`
- Never modify the migration files directly

## Current work
- We're migrating from Pages Router to App Router
- The /dashboard route is the active focus

Claude Code reads this file automatically at the start of every session. It’s your way of giving Claude persistent context about your project without repeating yourself. Think of it as the onboarding doc you’d write for a new team member.

Essential Slash Commands

Type / in the prompt to see all commands. The ones you’ll use most:

/help Show all available commands and keyboard shortcuts /clear Clear the conversation and start fresh (keeps CLAUDE.md context) /compact Compress the conversation to save context space /cost Show how much the current session has cost in API tokens /commit Create a git commit with an auto-generated message /review Review your current changes (like a code review)

Keyboard Shortcuts That Matter

Enter Send your message Shift+Enter New line (for multi-line prompts) Shift+Tab Cycle permission modes Ctrl+C Cancel current generation Escape Interrupt and give new instructions Up arrow Recall previous messages

How to Prompt Effectively

Claude Code understands your codebase, so you don’t need to explain your project from scratch. But how you phrase requests dramatically affects results.

Be specific about the outcome

Vague

Make the API better

Specific

Add rate limiting to the /api/search endpoint. Use a sliding window of 60 requests per minute per API key. Return 429 with a Retry-After header when exceeded.

Give context when it’s not obvious

Good context

The login page is showing a blank screen on mobile Safari. Desktop works fine. The component is in src/app/login/page.tsx. I think it might be related to the CSS grid layout but I'm not sure.

You don’t need to describe your project structure (Claude Code can read it), but you should share information it can’t see: error messages, browser-specific behavior, what you’ve already tried, and what you suspect.

Use iterative refinement

Don’t try to get everything right in one prompt. Start with the main task, review the result, then refine:

  1. Add a dark mode toggle to the settings page
  2. (reviews the implementation)
  3. Good, but persist the preference in localStorage and apply it on page load before render to prevent flash
  4. Now add a system preference detection fallback for first-time users

Each follow-up builds on the context of what Claude Code just did. This iterative approach produces better results than a single massive prompt.

Real-World Workflows

Bug fixing

Paste the error message or describe the symptom. Claude Code will search your codebase for relevant code, identify the root cause, and propose a fix.

Users are reporting that the checkout total shows $0 when they have
items in cart. Here's the error from the console:

TypeError: Cannot read property 'price' of undefined
at calculateTotal (src/utils/cart.ts:42)

Claude Code will read cart.ts, trace the data flow, find why price is undefined, and fix it.

Feature implementation

Describe what you want. Be clear about the scope — a feature that touches one file is easier to get right than one that touches twenty.

Add a "forgot password" flow:
1. A "Forgot password?" link on the login page
2. A form that accepts email and sends a reset link
3. A reset page where users enter a new password
4. Use the existing email service in src/services/email.ts
5. Tokens should expire after 1 hour

Code review

The /review command reviews your uncommitted changes. Or be more specific:

Review the changes in src/api/ for security issues.
Focus on: input validation, SQL injection, auth bypass, and rate limiting.

Refactoring

Refactor src/utils/helpers.ts — it's 800 lines of unrelated functions.
Split it into focused modules: string-utils.ts, date-utils.ts,
validation.ts, and formatting.ts. Update all imports across the codebase.

Claude Code handles multi-file refactors well because it can read and modify all the affected files in one session.

Understanding unfamiliar code

I just joined this project. Walk me through how a request flows from
the API endpoint in src/app/api/orders/route.ts to the database.
What middleware does it pass through? How is auth handled?

What Claude Code Is Great At

What to Watch Out For

Advanced: Hooks

Hooks let you run custom commands automatically in response to Claude Code’s actions. They’re defined in your settings and trigger before or after specific events.

Example: automatically run your linter after every file edit:

// In .claude/settings.json
{
  "hooks": {
    "afterEdit": {
      "command": "npx eslint --fix ${file}",
      "description": "Auto-lint after edits"
    }
  }
}

Hooks are powerful for enforcing project standards without relying on Claude Code to remember them.

Claude Code vs. Other AI Coding Tools

The landscape is competitive. Here’s how they compare:

They’re not mutually exclusive. Many developers use Copilot for inline autocomplete and Claude Code for larger tasks — like having both a spellchecker and a writing partner.

The Short Version

  1. Install: npm install -g @anthropic-ai/claude-code
  2. Launch in your project: cd your-project && claude
  3. Create a CLAUDE.md with project context and conventions
  4. Start with a real task, not “hello”
  5. Be specific about what you want
  6. Iterate: first pass, review, refine
  7. Use /compact when context gets long
  8. Trust but verify — review changes like any PR

Claude Code is most powerful when you treat it like a capable but junior colleague: give it clear instructions, review its work, and build trust incrementally. The more context you provide (through CLAUDE.md and specific prompts), the better the results.

The cursor is blinking. What do you want to build?