Claude Code is Anthropic's terminal-based AI coding agent. You type what you want in plain English, and it reads your codebase, writes code, runs commands, fixes errors, and commits changes — all from your terminal. No IDE plugins. No browser tabs. Just you and the AI in a terminal window.
Unlike Cursor (which works inside an IDE) or Codex (which works in the cloud), Claude Code runs locally in your actual development environment. It sees your files, your git history, and your terminal output. This makes it faster for many workflows because there's no context-switching between the AI and your code.
This guide covers installation, your first project, the key commands, and the workflow that makes Claude Code click.
| Tool | Best For | Where it runs | Workflow |
|---|---|---|---|
| Claude Code | Interactive agentic coding | Local terminal | You guide + it executes steps live |
| Cursor | Daily coding + inline edits | Inside IDE | Visible diffs + autocomplete |
| Codex | Async delegated tasks | Cloud sandbox | Submit task → review PR later |
How to Install Claude Code
You need Node.js 18+ and a Claude account (Pro or API).
Step 1: Install globally via npm:
npm install -g @anthropic-ai/claude-code
Step 2: Navigate to your project directory:
cd your-project
Step 3: Run Claude Code:
claude
The first time you run it, it'll ask you to authenticate with your Anthropic account. If you're using Claude Pro ($20/month), you get a generous token allowance. If you're on the API, you'll pay per token (check current rates at our rate limits guide).
Cost estimation (so you don't get surprised)
If you're on API billing, a typical 30–60 minute session on a medium repo is often $2–$10 depending on model + iteration count. Use /cost regularly, and sanity-check long sessions with the Vibe Coding Cost Calculator.
Your First 5 Minutes with Claude Code
Once Claude Code is running, you're in an interactive session. The AI has access to your entire project directory. Start simple:
Ask it to explore: Type "What is this project? Give me a high-level overview." Claude reads your key files (package.json, README, main entry points) and summarizes what it finds. This is a good way to verify it understands your project structure.
Ask it to find something: "Where is the authentication logic?" Claude searches your codebase and points you to the relevant files. It understands code structure, not just text matching.
Ask it to change something: "Add input validation to the signup form. Email must be a valid format, password minimum 8 characters." Claude identifies the form component, writes the validation logic, and shows you the diff before applying it.
The key insight: Claude Code operates on your actual files. When it makes a change, the change is real — your files are modified on disk. You can see the changes in your editor, run tests, and commit them normally.
Essential Commands
Claude Code has several slash commands that control its behavior:
| Command | What It Does | When to Use |
|---|---|---|
/init | Creates a CLAUDE.md file in your project root | Before your first serious task on a repo |
/compact | Compresses conversation history near context limits | Long sessions; before quality drops |
/cost | Shows tokens used + estimated cost | API billing, budget tracking |
/clear | Resets the conversation while keeping context | Switching between unrelated tasks |
📬 Getting value from this?
One actionable AI insight per week. Plus a free prompt pack when you subscribe.
Subscribe free →The CLAUDE.md File — Your Project's AI Context
The CLAUDE.md file is the single most important thing in your Claude Code workflow. It's a markdown file at your project root that Claude reads at the start of every session. Think of it as custom instructions for your codebase.
A good CLAUDE.md includes:
Project overview: What the project does, the tech stack, and the architecture in 3-5 sentences.
Code conventions: Your formatting preferences, naming conventions, and patterns to follow. "Use functional components with hooks. Prefer named exports. Use Tailwind for styling."
Key files: Point Claude to the most important files it should understand. "The main data models are in lib/models/. The API routes are in app/api/."
Things to avoid: "Don't modify the database migration files. Don't change anything in vendor/. Always run tests after modifying api/ files."
Without CLAUDE.md, Claude Code produces generic code that may not match your project's style. With it, the output feels like code written by someone who's been on the team for months. This is context engineering in practice.
Real Workflow: Building a Feature
Here's how I use Claude Code for a typical feature development session:
1. Start with the goal: "Add a rate limiter to the API. Use Redis. Apply to the /api/submit endpoint with a limit of 10 requests per minute per IP."
2. Let Claude plan: It reads the existing API code, checks if Redis is already configured, and proposes an approach. Review the plan before it starts coding.
3. Watch it work: Claude creates the rate limiter module, integrates it into the API route, adds environment variables for Redis connection, and writes a test.
4. Test: Claude runs the tests. If something fails, it reads the error, adjusts the code, and retries. This iteration loop is where agents shine — it handles the debugging cycle that normally takes multiple rounds of manual work.
5. Review and commit: Check the diff. Make any adjustments. Commit. Claude can write the commit message too if you ask.
For a feature like this, Claude Code typically saves 60-70% of the time compared to writing it manually. The real savings are in the boilerplate, the integration code, and the test writing — the parts that are tedious but not intellectually challenging.
Managing Token Usage
Claude Code uses tokens for every interaction. Long sessions on large codebases can get expensive on API billing. Here are the habits that keep costs reasonable:
Use /compact regularly. Don't wait until the context is full. Compact after completing each distinct task.
Be specific. "Fix the bug in the login form" is cheaper than "Look at the entire application and find any bugs." Specific requests mean less code reading.
Use /clear between unrelated tasks. If you've been working on the frontend and switch to database migrations, clear the context. The old context wastes tokens and can confuse the model.
Check /cost frequently. Set a mental budget for each session and check against it. A typical 30-minute feature session costs $2-8 on API billing.
For a detailed cost comparison between Claude Code and Cursor, see our real cost comparison after 30 days.
Claude Code vs Cursor vs Codex
Quick decision guide:
| Option | Best when... | Tradeoff |
|---|---|---|
| Claude Code | You want interactive, repo-wide changes locally | Needs careful review (it edits real files) |
| Cursor | You want AI inside your IDE + tight edit loop | Less hands-off autonomy than terminal agents |
| Codex | You want async, PR-based delegation | Less interactive; context can drift |
Claude Code: Best for developers who want full-project context and terminal-native workflows. Interactive, real-time, works on your actual files. Best for complex features, refactoring, and debugging.
Cursor: Best for developers who want AI inside their IDE. See changes in real time with inline diffs. Best for day-to-day coding with AI suggestions. Full comparison here.
Codex: Best for teams that want async, batched coding tasks. Submit a task, review the PR later. Best for well-defined tasks you want to delegate completely. Full comparison here.
Many developers use two or more. Claude Code for complex features, Cursor for daily editing, Codex for batch tasks.
Want to improve your prompts for any AI coding tool? The Prompt Optimizer helps you structure requests for clearer, more specific output.
📬 Want more like this?
One actionable AI insight per week. Plus a free prompt pack when you subscribe.
Subscribe free →Frequently Asked Questions
Does Claude Code work on Windows?
Yes, through WSL (Windows Subsystem for Linux), PowerShell, or Command Prompt. WSL provides the best experience since many development tools are Linux-native.
Can Claude Code access the internet?
Claude Code itself doesn't browse the web, but it can run commands that do — curl, npm install, git clone. It can also use MCP servers to access external services like GitHub, databases, and APIs.
How does Claude Code handle large codebases?
Claude's 200K token context window means it can load and process thousands of source files simultaneously. For very large monorepos, it selectively reads relevant files rather than loading everything. The CLAUDE.md file helps it know which parts of the codebase matter for each task.
Is my code sent to Anthropic's servers?
Yes, your code is sent to Anthropic's API for processing. Anthropic does not train on API inputs by default, but check the current terms if you're working with sensitive or proprietary code. Consider using the API with data retention disabled for maximum privacy.
Disclosure: Some links in this article are affiliate links. We only recommend tools we've personally tested and use regularly. See our full disclosure policy.