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.
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.
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.
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.
You can talk to it in any language and it will respond in kind. Perfect for code review, documenting functions, or learning new frameworks.
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.
| Tool | Main model | Working mode | Base price |
|---|---|---|---|
| Claude Code | Claude Opus 4.7 / Sonnet 4.6 | Terminal + autonomous agent | $20/mo (Pro) |
| Cursor | GPT, Claude (multi-model) | Editor (VS Code fork) | $20/mo |
| GitHub Copilot | GPT-5 / Claude | Autocomplete 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.
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.
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.
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
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.
$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.
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.
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.
| Command | What it does | When to use it |
|---|---|---|
/help | Lists all available commands | When you don't remember something |
/clear | Clears the current conversation history | When starting a new task with no prior context |
/compact | Summarizes the conversation to free up context | When you have many turns and it's getting slow |
/init | Creates a CLAUDE.md file documenting your project | The first time you open a new repo |
/model | Switches between Opus, Sonnet, or Haiku | Simple tasks → Haiku, complex tasks → Opus |
/cost | Shows how much you've spent in the session | If you use the API by tokens |
Shift + Tab | Activates Plan mode (plan before executing) | Before large or destructive changes |
These are the three most useful patterns when you start using Claude Code on real projects:
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 (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 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 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.
/init and let Claude read everything and generate a CLAUDE.md with the architecture, commands, and key points.
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:
| Plan | Price | For whom |
|---|---|---|
| Claude Pro | $20/mo | Daily individual use |
| Claude Max | $100/mo | Heavy use, several hours a day |
| API (pay per use) | ~$3-15 per million tokens | Teams or sporadic use |
| GLM via cc-switch | Variable (CNY) | Users without an international card |
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.
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.
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.
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.
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.
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.
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.
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.
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