Updated · May 2026

How to use Claude Code: the complete guide for developers

Learn how to use Claude Code step by step, from installation to advanced tricks with MCP, subagents, and hooks. The exact commands you need to start coding with AI in less than 10 minutes — no shortcuts, no fluff.

✓ Verified commands ✓ 2026 up to date ✓ For Mac, Windows, and Linux

What is Claude Code and why should you use it?

Claude Code is the official command-line tool (CLI) created by Anthropic, the same company behind the Claude model. Unlike traditional editors, Claude Code lives directly in your terminal: you talk to it in natural language and it reads your files, writes code, runs tests, and resolves errors for you.

If you're wondering how to use Claude Code without getting lost in scattered documentation, this guide is for you. Here you'll learn the real workflow that professional developers use in 2026, with no detours and no marketing.

Conversational programming

Forget copy-pasting between ChatGPT and your editor. With Claude Code you ask for what you want and it modifies the files directly, keeping the context of your whole project.

Full system access

Claude Code can read, edit, and create files, run commands in your terminal, and execute your tests. All with your explicit permission at every step.

Multilingual responses

You can talk to it in any language and it will respond in kind. Perfect for code review, documenting functions, or learning new frameworks.

Claude Code vs Cursor vs GitHub Copilot: which one to choose?

Before learning how to use Claude Code, it helps to understand why it has become the favorite of many developers in 2026. The key difference is in the model and the working mode.

ToolMain modelWorking modeBase price
Claude CodeClaude Opus 4.7 / Sonnet 4.6Terminal + autonomous agent$20/mo (Pro)
CursorGPT, Claude (multi-model)Editor (VS Code fork)$20/mo
GitHub CopilotGPT-5 / ClaudeAutocomplete in editor$10/mo

In short: if you want autocomplete while you type, Copilot is enough. If you want a full editor with built-in AI, try Cursor. But if you want the AI to do the work for you while you review, Claude Code is the most powerful option.

How to install Claude Code step by step

Installing Claude Code takes less than five minutes. You only need Node.js on your computer. If you don't have it, download it first from nodejs.org and install the LTS version with default settings.

1. Verify you have Node.js

Open your terminal (Terminal on Mac, PowerShell on Windows) and run:

node -v
npm -v

If you see version numbers, you're ready. If it says "command not found", install Node.js before continuing.

2. Install Claude Code globally

This is the command that installs it so you can use it from any folder:

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

On Mac or Linux, if a permissions error appears, prepend sudo:

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

3. Start Claude Code in your project

Navigate to your project folder and run:

cd my-project
claude

The first time it will ask you to sign in. You have two options to authenticate and start using Claude Code for real.

4. Choose how to authenticate

Option A: Claude Pro subscription

$20/mo with generous usage. Recommended if you'll use Claude Code daily. You'll need an international card and, depending on your country, a VPN.

Option B: Anthropic API key

Pay per use (tokens). Useful if you just want to try it. Create your key at console.anthropic.com and export the variable ANTHROPIC_API_KEY.

In Latin America and Spain, the Pro subscription is the simplest option. If you have payment issues, you can also use compatible providers like Z.AI (GLM) with the cc-switch tool.

Basic commands to use Claude Code every day

Once inside Claude Code, most things are done by writing in natural language. But there are a handful of special commands (the slash commands) that you should memorize from day one.

CommandWhat it doesWhen to use it
/helpLists all available commandsWhen you don't remember something
/clearClears the current conversation historyWhen starting a new task with no prior context
/compactSummarizes the conversation to free up contextWhen you have many turns and it's getting slow
/initCreates a CLAUDE.md file documenting your projectThe first time you open a new repo
/modelSwitches between Opus, Sonnet, or HaikuSimple tasks → Haiku, complex tasks → Opus
/costShows how much you've spent in the sessionIf you use the API by tokens
Shift + TabActivates Plan mode (plan before executing)Before large or destructive changes

Three patterns you'll use constantly

These are the three most useful patterns when you start using Claude Code on real projects:

  1. Ask it to read before writing. For example: "Read the files in the src/ folder and tell me what this project does." That way it understands the context before modifying anything.
  2. Use Plan mode for large changes. Press Shift+Tab twice, explain what you want, and review its plan before approving execution.
  3. Keep tasks small. It's better to ask "add email validation to the registration form" than "build the entire registration page". Quality > volume.

How to use Claude Code at advanced level: MCP, subagents, and hooks

Once you master the basics, there are three advanced features that multiply the value of Claude Code. Few tutorials explain them well, so here is the practical summary.

MCP: connect Claude Code to your tools

MCP (Model Context Protocol) is the system that lets Claude Code talk to external services: your database, GitHub, Linear, Notion, Slack, even browsers. You install an MCP server once and from that moment Claude can read Linear issues, query your Postgres, or post comments on a GitHub PR without you opening a single tab.

To add an MCP, edit your config file or use the command:

claude mcp add <name> <command>

Subagents: specialists for specific tasks

Subagents are secondary agents that Claude Code launches in parallel for specific tasks: code review, running tests, searching files, security audits. Each subagent has its own context and its own set of tools, which lets you keep the main context clean.

For example, if you ask Claude Code to "review the entire backend folder and find vulnerabilities", it will launch a specialized subagent that returns a summary, without saturating your conversation with thousands of lines of code.

Hooks: automate actions when something happens

Hooks are scripts that run automatically on key events: before a commit, after editing a file, when a tool call is made. It's the cleanest way to make Claude Code respect your team's conventions: format code with Prettier, run tests when modifying a test file, or send a Slack notification when a long task finishes.

To configure hooks, edit the .claude/settings.json file in your project.

5 real cases where Claude Code saves you hours

  1. Migrating a JavaScript component to TypeScript. You give it the file, say "convert this to TypeScript with strict types", and review the diff before accepting.
  2. Writing tests for existing code. You point at the function and ask "write unit tests covering the edge cases". In seconds you have a complete suite.
  3. Refactoring an entire REST API. You activate Plan mode, request the change, review the plan, and let it execute all files in parallel.
  4. Documenting a legacy project. Use /init and let Claude read everything and generate a CLAUDE.md with the architecture, commands, and key points.
  5. Resolving a production bug at 3 AM. Paste the stack trace, ask it to find the root cause, and let it open the PR with the fix while you sleep an extra hour.

Claude Code pricing in 2026

Claude Code is free as software, but you need to pay for the AI model that powers it. These are the real options if you want to use Claude Code seriously:

PlanPriceFor whom
Claude Pro$20/moDaily individual use
Claude Max$100/moHeavy use, several hours a day
API (pay per use)~$3-15 per million tokensTeams or sporadic use
GLM via cc-switchVariable (CNY)Users without an international card

Frequently asked questions about how to use Claude Code

Can I use Claude Code in any language?

Yes. Claude understands and responds naturally in dozens of languages. Just talk to it in your language and it will respond in kind. For best results with code, write variable and function names in English (the standard convention) but the comments and explanations can be in any language.

Does Claude Code work on Windows?

Yes. Claude Code works on Windows, Mac, and Linux. On Windows, the ideal is to use it from WSL2 or PowerShell. The installation is the same: npm install -g @anthropic-ai/claude-code.

How much does Claude Code cost per month?

The Claude Pro plan costs $20/mo and is enough for most developers. If you use it many hours a day, the Max plan ($100/mo) is better. If you just want to try it, you can pay per use with the API.

Is it safe to give it access to my files?

Claude Code asks for explicit permission before each action that modifies anything. You can configure permissions per project in the .claude/settings.json file and limit which folders it can touch. For sensitive data, use Plan mode to review everything before executing.

How do I activate Plan mode in Claude Code?

Press Shift + Tab twice. You'll see an indicator at the bottom. In this mode, Claude plans the changes and shows you the plan before touching any file. It's essential for large refactorings.

What's the difference between Claude Opus 4.7 and Sonnet 4.6?

Opus 4.7 is the most powerful model and reasons better on complex problems, but is slower and more expensive. Sonnet 4.6 is faster and cheaper, ideal for everyday work. Switch between them with the /model command.

Can I use Claude Code without knowing how to program?

Technically yes, but it's not recommended. Claude Code is a tool to accelerate developers, not replace them. You need to understand what it does to review the code it generates.

Is there a free version of Claude Code?

The software is free, but the AI model is not. You can try it with free Anthropic API credits when you sign up. For continuous use you need a Pro subscription or API credits.

Start using Claude Code today

Now you know the basics. Open your terminal, install Claude Code, and try a real command on a small project. The learning curve is a matter of minutes, not days.

Back to install instructions