From zero to your first project. Install Claude Code on any system, sign in, master the essential commands, plan mode, and CLAUDE.md.
Agent that lives in the terminal
Win · macOS · Linux · WSL
Approve edits, @ and #, Esc
/clear /compact /context /cost
Shift+Tab · opusplan
/init · permanent context
allow/deny · modes · sandbox
Plans · /cost · models
O Claude Code is Anthropic’s coding agent that runs in your terminal. It’s not autocomplete or chat: it reads your project, plans, edits files, runs commands and tests, use git and browses the web — always asking for your approval. You speak Portuguese; it executes.
Unlike pasting code from a chat, Claude Code works inside the actual repository — understands the full context via CLAUDE.md, respects your stack and runs on any system. It's the foundation for everything in the upcoming tracks.
| Where | Best for | Detail |
|---|---|---|
| Terminal (CLI) | Speed + control | macOS, Windows, Linux. The main way |
| VS Code / JetBrains | View diffs in the IDE | Official extension, same engine as the CLI |
| Web / Desktop | Delegate and run in parallel | claude.ai/code and desktop app (Mac/Windows) |
The agent’s cycle: reads → plans → edits → runs/tests → shows the diff → you approve. Understanding this loop is what separates those who “play around” from those who produce.
Installation via npm. Prerequisites: Node.js 18+ and, on Windows, Git Bash. Sign-in is through subscription (Pro/Max via browser) or through API key by Anthropic.
An outdated Node version causes silent failures. On Windows, Claude Code won’t run without Git Bash—it’s the #1 mistake beginners make. Following the right order avoids 90% of installation problems.
# 1. Instale o Git (inclui o Git Bash) → git-scm.com/download/win # 2. Instale o Node.js LTS → nodejs.org # 3. Confira: node -v npm -v # 4. Instale o Claude Code: npm install -g @anthropic-ai/claude-code # 5. Rode: claude
If you get a Git Bash error: setx CLAUDE_CODE_GIT_BASH_PATH "C:\Program Files\Git\bin\bash.exe" and reopen the terminal.
brew install node npm install -g @anthropic-ai/claude-code claude
sudo apt update && sudo apt install -y nodejs npm npm install -g @anthropic-ai/claude-code claude
# Dentro do claude, rode: /login # abre o navegador → conta Pro/Max (recomendado) # OU, via API key (pague por uso): setx ANTHROPIC_API_KEY "sk-ant-..." # Windows export ANTHROPIC_API_KEY="sk-ant-..." # macOS/Linux
💡 Tip: have a Claude Pro or Max subscription? Use /login with OAuth — no API key needed, and usage is included in your plan.
You run claude inside the project folder and type your request in natural language. It proposes edits like diffs that you approve or reject. @ references files and # saves something to memory.
The fear that “it’ll mess up my code” goes away when you understand the approval loop: nothing changes without you seeing the diff. Esc stops immediately if it takes the wrong direction.
cd meu-projeto claude # abre o modo interativo claude "corrija o bug do login" # pedido direto claude -p "resuma o README" # print mode: responde e sai (scripts)
@src/app.py— references a file# sempre use pnpm— saves to memoryEsc— interrupts the agentShift+Tab— switches the permission modeCommands that start with / control the session (not the project). Type / and see the list. The most commonly used manage the context — the scarcest resource in a session.
/clear e /compact are what keep the session fast and inexpensive. Without them, the context fills up, Claude slows down, and "forgets" the beginning. (Track 3 explores this in more depth.)
| Command | What it does |
|---|---|
| /help | Lists all commands |
| /clear | Clears the context — start a fresh task |
| /compact | Summarizes the conversation to free up context without losing the thread |
| /context | Shows how much of the context is being used |
| /cost | Current session spending/usage |
| /model | Switch the model (Opus / Sonnet / opusplan) |
| /resume | Resumes a previous session |
| /init | Generates the project’s CLAUDE.md (module 1.6) |
| /agents | Creates and manages subagents (track 6) |
Pressing Shift+Tab you switch between session modes. In plan mode (plan mode), Claude investigates and proposes a plan — but doesn't edit anything until you approve.
For large or risky tasks, letting it “start editing” is a recipe for rework. Planning first aligns the path. The preset opusplan uses Opus (more powerful) to plan and Sonnet (cheaper/faster) to execute — quality where it matters, savings elsewhere.
Ask for approval before every edit/command
Applies edits without asking (acceptEdits)
Only investigates and proposes — doesn’t edit
/model opusplan # Opus planeja, Sonnet executa
O CLAUDE.md is a file at the project root with the permanent context: how to run, conventions, rules, what not to do. The command /init generates one for you by analyzing the repo. The folder .claude/ stores settings, commands, agents, and skills.
Without CLAUDE.md, Claude starts from scratch each session and repeats the same mistakes. With it, Claude follows your stack and style from the first prompt. It’s the 5-minute investment that improves all the following sessions.
~/.claude/CLAUDE.md — your own rules, apply in all the projects
./CLAUDE.md — project rules (goes into git, the whole team uses it)
./CLAUDE.local.md — yours only, not version-controlled
# Projeto X - Stack: Next.js + TypeScript + pnpm - Rodar: `pnpm dev` · Testar: `pnpm test` - Convenção: componentes em PascalCase, sem default export - NUNCA commitar direto na main
Shortcut: type # sua regra in the session to attach something to CLAUDE.md right away.
By default, Claude asks for permission before editing files or running commands. You define lists of allow / deny e o mode permission. The command /permissions manages everything.
Permissions are your seat belt. Allow safe commands (e.g., npm test) reduces clicks; but never use bypass on machines with sensitive data or in production.
| Mode | Behavior | Risk |
|---|---|---|
| default | Ask before every sensitive action | Low |
| acceptEdits | Accepts automatic file edits | Intermediate |
| plan | Just plan; don't change anything | None |
| bypassPermissions | Doesn’t ask for anything (--dangerously-skip-permissions) | High ⚠️ |
/permissions # abre o gerenciador
# em .claude/settings.json:
# "permissions": { "allow": ["Bash(npm test)"], "deny": ["Bash(rm -rf *)"] }
⚠️ Don’t: run --dangerously-skip-permissions on your personal machine just to “go faster.” Use this only in disposable containers/VMs.
You use Claude Code through subscription (Pro/Max — included usage) or through API (paid per token). /cost shows the session's spending. The choice of model has the biggest impact on cost and speed.
Using Opus for everything is expensive and unnecessary. Sonnet handles day-to-day work; Opus is for what’s difficult; opusplan combines the two. Along with /compact e /clear, you control the cost.
| Model | Use for |
|---|---|
| Opus | Hard tasks, architecture, tricky debugging |
| Sonnet | Everyday use — fast and capable, best value |
| Haiku | Simple, inexpensive tasks at high volume |
| opus[1m] | 1-million-token context (huge repos) |
/cost # gasto da sessão /model sonnet # troca pro Sonnet claude --model "opus[1m]" # abre com contexto de 1M
💡 Money-saving tip: start the task with /clear, use opusplan and run /compact when the /context exceed ~70%.