How to use Claude Code: a practical guide
Explore with AI
To use Claude Code, install it with the native installer, run claude inside your project and sign in. Run /init to create a CLAUDE.md with your build and test commands, describe each task specifically, and press Shift+Tab to switch into plan mode for bigger changes. Add MCP servers with claude mcp add to give it your other tools.
To use Claude Code, install it, run claude in your project, give it a CLAUDE.md, and describe each task as specifically as you would to a colleague. Use plan mode for anything bigger than a small fix, interrupt it the moment it heads the wrong way, and connect your other tools with MCP so it can look things up instead of guessing.
Claude Code is Anthropic’s coding agent. It reads your files, runs commands and edits code from a session in your terminal, and asks before it does anything you haven’t allowed. The steps below follow Anthropic’s own documentation, in the order you will need them.
1. Install Claude Code and sign in
The native installer is the recommended route on macOS, Linux and WSL:
curl -fsSL https://claude.ai/install.sh | bash
On Windows PowerShell, run irm https://claude.ai/install.ps1 | iex. Homebrew (brew install --cask claude-code) and WinGet (winget install Anthropic.ClaudeCode) work too, but only the native install updates itself in the background.
Open a new terminal and check it worked:
claude --version
Then start it inside a project:
cd ~/code/my-app
claude
The first run asks you to sign in. A Claude Pro, Max, Team or Enterprise subscription works, as does a Claude Console account with API credits, or Amazon Bedrock, Google Cloud or Microsoft Foundry for teams that buy models through their cloud.
2. Ask before you change anything
Claude Code reads files as it needs them, so you don’t have to paste code into the prompt. Start with questions that make it read the project:
what does this project do, and where is the main entry point?
how does a request get from the router to the database here?
Then give it a task, and be specific. “Fix the bug” leaves it guessing. “Fix the login bug where users see a blank screen after a wrong password” tells it where to look and what done means. For larger work, list the steps in order, and say how to check the result: which test to run, which page to load.
3. Write a CLAUDE.md
Every session starts with an empty context. A CLAUDE.md file is how you give every session the same starting knowledge. Run this inside a session:
/init
/init reads the codebase and writes a CLAUDE.md with the build commands, test instructions and conventions it finds. Edit it down to what matters: the commands to build, test and lint, the rules a new engineer would get wrong, and the directories to stay out of.
Claude Code loads these files at launch:
| File | Use it for | Who sees it |
|---|---|---|
./CLAUDE.md or ./.claude/CLAUDE.md | Team instructions for the project | Everyone, committed to Git |
./CLAUDE.local.md | Your own notes for this project | Only you; add it to .gitignore |
~/.claude/CLAUDE.md | Your preferences for every project | Only you |
A CLAUDE.md can pull in other files with @path/to/file, so a long architecture document can live in docs/ and still load. Keep the file short and concrete: the docs note that the more specific and concise your instructions are, the more consistently they are followed. CLAUDE.md guides what Claude does; to block an action outright, use a hook.
4. Choose a permission mode
Claude Code asks before it edits files or runs commands. Press Shift+Tab to cycle the permission mode of the current session:
- Manual (
default): it asks before edits and commands. - Accept edits (
acceptEdits): it edits files without asking, and still asks before other actions. - Plan (
plan): it reads and plans, and changes nothing until you approve the plan.
Plan mode is the one to reach for on anything that touches more than a few files. Read the plan, correct it, then let it work. You can start a session in it directly:
claude --permission-mode plan
5. Steer it while it works
You will get better results from steering early than from fixing late. The controls worth learning first:
Escstops the current response or tool call. Claude keeps the work done so far, and you can redirect it.EscEscon an empty prompt opens the rewind menu, which restores the session to an earlier point.@autocompletes a file path, so you can point it at the exact file.!at the start of the prompt runs a shell command and adds its output to the session./clearwipes the conversation. Use it between unrelated tasks so old context stops steering new work.
To pick up where you left off, claude -c continues the most recent conversation in the directory and claude -r opens a picker of earlier sessions.
6. Run it from scripts
claude -p runs a single prompt and exits, which makes Claude Code usable in scripts and CI:
claude -p "explain what changed in the last commit"
cat build.log | claude -p "why did this build fail?"
claude -p "list the TODOs in src/" --output-format json
In print mode, --max-turns caps how many steps it takes and --allowedTools lists the tools it may use without asking, so an unattended run cannot wander.
7. Connect your other tools with MCP
Claude Code can call tools outside your repository through the Model Context Protocol. Add a remote server with one command:
claude mcp add --transport http <name> <url>
Servers are added for you in the current project by default. Add --scope project to write the server to a .mcp.json at the repository root, which you commit so the whole team gets it, or --scope user to have it in every project. Run /mcp inside a session to check each server’s status and to sign in to servers that use OAuth.
Production is the context Claude Code usually lacks. It can read the code that broke, but not the logs, traces and deploys that show how it broke. Polylane gives Claude Code that context through one MCP server that covers every provider you connect:
claude mcp add --transport http polylane https://mcp.polylane.com/mcp
Then ask it what you would otherwise open five dashboards for, such as why checkout started returning 502s this morning, and it answers from the real data.
Using Claude Code? See how to give Claude Code production context with Polylane.
Common questions.
Do I need a paid plan to use Claude Code?
You need a Claude Pro, Max, Team or Enterprise subscription, a Claude Console account with API credits, or access through a supported cloud provider. Claude Code asks you to sign in the first time you run it.
How do I undo something Claude Code changed?
Press Esc twice with an empty prompt to open the rewind menu and restore an earlier point in the session. For anything you have committed, use Git as usual.
Where should CLAUDE.md go?
Put team instructions in ./CLAUDE.md or ./.claude/CLAUDE.md and commit it. Personal preferences for every project go in ~/.claude/CLAUDE.md, and private notes for one project go in ./CLAUDE.local.md, which you add to .gitignore.
Can I use Claude Code outside the terminal?
Yes. Claude Code also runs on the web, as a desktop app, in VS Code and JetBrains IDEs, in Slack, and in CI through GitHub Actions and GitLab.
How do I run Claude Code from a script?
Use claude -p with a prompt. It runs once and exits, reads piped input, and takes --output-format json when another program reads the result.
How do I give Claude Code access to production logs?
Add an MCP server that exposes them. One HTTP server such as Polylane's covers logs, metrics, traces and deploys across every provider you connect, so Claude Code can answer questions about production without leaving the terminal.
Sources (6)
Boris Tane is the founder of Polylane. He previously founded Baselime, observability for the future of the cloud, which Cloudflare acquired. At Cloudflare he built and led the Workers observability team.
More in this series
Using coding agents: Claude Code, Cursor, Codex and more
- 1 How to use Claude Code: a practical guide
- 2 How to add MCP servers to Cursor
- 3 How to use Codex CLI: install, AGENTS.md, MCP and exec
- 4 How to use OpenCode: install, plan and build, MCP
- 5 How to add MCP servers to GitHub Copilot in VS Code
- 6 How to use the Pi coding agent
Related
- How to Use Claude Code to Debug Production Issues Debug production issues with Claude Code: get logs and traces into the session, test hypotheses against evidence, stay read-only and ship a verified fix.
- How to keep AI coding agents from breaking production Stop AI coding agents breaking production: scoped credentials, branch protection they can't bypass, required checks that block, and production-aware review.
- Vercel AI Gateway session affinity logs: reading the Sessions view Vercel AI Gateway logs got a Sessions view on 17 October 2026. Learn how session affinity groups requests, how to send a session ID and how to read cache hits.
- PlanetScale MCP Server: Setup and Production Permissions Connect the official PlanetScale MCP Server to Claude Code, Cursor and Codex. Set narrow permissions, inspect Insights and review writes before execution.
- Workers Issues: route Cloudflare errors to coding agents Cloudflare's new Workers Issues groups exceptions and 5xx errors and sends them to Claude Code, Cursor, Devin or a webhook. Setup, automations and limits.