P
Complete guide

Claude Code: Complete Guide — Installation, Commands, Use Cases

12 min read
11 sections

Imagine opening your terminal, typing a sentence in plain English, and watching Claude read 12 files in your project, refactor an entire module, run the tests, fix the errors, then commit everything — while you go grab a coffee. That's what Claude Code does. It's no longer just an AI assistant in a chat window: it's an agent that acts directly in your repository, on your machine, with a level of autonomy no other tool offers today.

Note: this guide was written using Claude Code itself. Several examples cited are real workflows running in production on prompt-guide.com.

Why Claude Code is a game-changer

Most developers use ChatGPT or Claude in a chat window next to their editor. They copy-paste code, tinker, and switch back to the chat. It's better than nothing, but it's 30% of the real value AI offers today.

Claude Code plays a different game. It doesn't suggest code: it writes, reads, tests, refactors, and commits directly in your git repo. It talks to external APIs via MCP. It can spawn multiple sub-agents in parallel. It triggers entire workflows from a single sentence.

Pro use case: refactor a module in 30 minutes

You get a request: "we need to migrate our auth system from NextAuth to Better-Auth." Across 12 files, in 2 languages, with tests to update. With Claude Code: you describe the goal, it analyzes the existing code, proposes a plan, executes the migration file by file, runs tests, fixes regressions, and produces a clean commit. What used to take 4-6 hours now takes 30-45 minutes, with quality higher than a rushed junior dev.

Personal use case: automate freelance ops

You're a freelancer. Every week you generate invoices, update revenue tracking, send reminders. With Claude Code, you describe your process once, and it writes the scripts that run on their own. You go from "2 hours every Sunday evening" to "0 minutes, it lands in my Drive."


What is Claude Code, exactly?

Claude Code is Anthropic's official command-line tool, released in 2025 and also available as a VS Code extension and a Mac/Windows desktop app. The key trait: it's an autonomous agent, not an assistant. The nuance matters.

An assistant waits for instructions and answers. An agent receives a goal and pursues it until completion, making intermediate decisions, using tools (file read/write, command execution, web requests, MCP) and adapting to results.

Key differences vs alternatives

  • vs ChatGPT / Claude.ai: Claude Code acts in your local repo, not in an isolated sandbox. It has access to your real files and can run your real commands.
  • vs Cursor / Windsurf: Cursor is an editor (VS Code fork) with built-in AI assistance. Claude Code is a CLI agent callable from any editor, including Cursor itself.
  • vs GitHub Copilot: Copilot suggests real-time code completions. Claude Code orchestrates multi-file tasks end-to-end.
  • vs Codex (OpenAI): Codex is OpenAI's equivalent with a similar approach. The main difference today is context (Claude Sonnet 4.6 and Opus 4.7 have larger context windows and stronger reasoning on complex tasks).

Install Claude Code in 2 minutes

Claude Code installs with a single command on any system. You need Node.js 18+ and an Anthropic account (the Pro plan at $20/month is enough to start; Max unlocks higher limits).

macOS and Linux

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

Then launch Claude Code from any project folder:

Terminal
cd my-project claude

On first launch, Claude Code prompts you to authenticate via your browser. Done in 30 seconds.

Windows

On Windows, Claude Code runs through WSL2 (Windows Subsystem for Linux). Install WSL2 from the Microsoft Store first, then follow the same instructions as macOS/Linux in your Ubuntu terminal.

Once Claude Code is running, take 2 minutes to configure three things that will 10× your productivity from day 1:

1

Create a CLAUDE.md file at the project root

describe in 10-20 lines the project context, code conventions, useful commands. Claude Code reads it at every session.

2

Enable "plan mode"

by default for complex tasks: Claude proposes a plan before executing, you validate, it runs.

3

Configure permissions

by default Claude asks confirmation for each shell command. For safe commands (npm install, git status, ls), pre-authorize them in .claude/settings.json.

Tip: The CLAUDE.md file is the most underrated lever. A solid 30-line CLAUDE.md beats 200 repeated prompts. Claude reads this file every session and adapts to your project.


The 5 commands you'll use every day

Claude Code uses a simple slash-command syntax. Here are the 5 essentials to memorize on day one.

1. /plan — Plan before executing

For any task touching more than 2 files, start with /plan. Claude analyzes the existing code, proposes an implementation strategy, and waits for your OK. You correct course before it codes, not after. Typical gain: 50% time saved on refactors.

2. /clear — Clean the context

When switching tasks, clear the context. Otherwise Claude keeps reasoning with the previous task's files, polluting answers. Reflex: a /clear between every job.

3. /compact — Summarize a long session

On sessions longer than 1 hour, context gets saturated. /compact asks Claude to summarize the session so far, frees 80% of the context, and continues with a clean mental state.

4. /review — Automatic code review

Before pushing a PR, run /review on your diff. Claude reads it like a senior, identifies potential bugs, dubious patterns, missing tests. Faster than a linter, more useful than a checklist.

5. /commit — Clean commits, clear messages

After a series of edits, /commit writes a commit message that follows your repo's conventions (read from CLAUDE.md or git log). Never another "wip" or "fix stuff."


Skills, MCP, and plan mode: the concepts that change everything

Beyond the basic commands, Claude Code exposes three mechanisms that radically differentiate it from the alternatives. Mastering these three concepts means moving from "user" to "employer" of AI.

Skills: reusable workflows

A Skill is a named workflow that Claude triggers automatically when context warrants. You write the procedure once in a SKILL.md file, and every time your message matches the trigger described, Claude applies the workflow without you having to remind it.

Example: a "publish-article" Skill that, every time you write "publish this article," runs the chain: lint markdown → SEO check → meta tag generation → DB insert → cache invalidation → tweet announcement. One hour writing the Skill = dozens of hours saved later.

MCP (Model Context Protocol): connecting Claude to your tools

MCP is a standard protocol, created by Anthropic in late 2024, that lets Claude (and other AIs) talk directly to external tools: Notion, Slack, GitHub, your database, your CRM, your analytics dashboard, etc. Instead of copy-pasting data, Claude reads and writes it live via a standardized API.

For Claude Code, MCP transforms usage. Rather than asking "can you explain how our users table is structured," you install a PostgreSQL MCP server and Claude reads the schema directly. Rather than copying issue comments from GitHub, you enable the GitHub MCP and Claude consults the issue. Copy-paste disappears.

Plan mode: safety when playing with fire

For sensitive tasks (critical refactor, data migration, deployment), enable plan mode. Claude executes nothing: it describes what it would do, file by file, command by command. You validate or reject. It's an indispensable safety net when working on production.


5 concrete use cases to start this week

Theory is fine, but real progress comes from use cases. Here are 5 workflows you can deploy in the next 7 days, in increasing complexity.

Case 1: generate missing documentation

You inherit a project without a README. Launch Claude Code at the root and ask: "Read the source code and write a complete README: what the project does, how to install it, how to run tests, the architecture in 1 paragraph." In 5 minutes, you have honest docs, drawn from real code.

Case 2: refactor a monster file

You have an 800-line file no one dares touch. Ask: "Break this file into coherent modules, move each function to the right module, update all imports, run tests at each step." Claude proposes a plan, you validate, it executes. A task that takes a human a day takes 30 minutes.

Case 3: add tests to legacy code

"For each public function in this module, write a unit test covering the happy path, an edge-case test, and an error test. Use Jest." Claude reads the code, writes tests, runs them, fixes its own mistakes until everything passes. Coverage from 0 to 80% in minutes.

Case 4: multi-file migration

"Migrate every fetch() call to axios in this repo. Adapt error handling accordingly. Run tests at the end." On 50 files, that's hell manually. With Claude Code, it's a single command.

Case 5: agent watching your CI tests

Set up a script that, on every push, runs Claude Code with: "Fetch the last CI run logs, identify failed tests, propose a fix for each, open a PR with the diff." You get a fix PR within 5 minutes of every CI failure.


Claude Code vs Cursor vs Codex vs Aider: when to use what

The AI coding assistant market has gotten dense in 2025-2026. Here's how to choose by use case.

Choose Claude Code if…

  • You want an agent that executes complex multi-file tasks end-to-end
  • You work in CLI or via an editor you don't want to switch from
  • You need to orchestrate parallel sub-tasks (multi-agent)
  • You want top-quality reasoning on complex tasks (Opus 4.7)

Choose Cursor if…

  • You prefer a dedicated editor (VS Code fork) with built-in AI autocomplete
  • You want very fast Tab-Tab while coding
  • You're willing to leave your current editor

Choose Codex (OpenAI) if…

  • You're already deeply invested in the OpenAI ecosystem (Custom GPTs, ChatGPT Pro plan)
  • You want to test both labs' approaches (Anthropic and OpenAI)

Choose Aider if…

  • You want an open-source tool with full control over the model used
  • You want to switch between Claude, GPT, open-weight models (Llama, Qwen)
  • You work in an environment where you can't send code to commercial APIs

Tip: these tools are not exclusive. The most effective combo in 2026 remains Cursor for fast in-editor edits + Claude Code for agentic background tasks. The best developers combine both.


Going further: parallel agents and advanced workflows

Once basics are covered, real productivity gains come from parallel agents. Claude Code can spawn multiple concurrent sub-agents, each on an independent sub-task, with final orchestration.

The "4 agents for one deliverable" pattern

Typical example: you need to produce an 8-page investment memo on a startup. Break it into 4 independent sub-tasks: (1) market research, (2) financial analysis, (3) competitive benchmark, (4) team due diligence. Spawn 4 parallel agents, each with its own context. While they work, you prepare the Word template. When they finish, you merge. 4-6 hours of sequential work becomes 30-45 minutes as a conductor.

Hooks and automations

Claude Code exposes hooks that fire at precise moments: before a commit, after a command run, on test failure. You can wire automatic actions: Slack notifications, Notion updates, dashboard pushes. This turns Claude Code from a one-off tool into an invisible team member.


Limits and alternatives

Claude Code isn't a magic wand. Here are the limits to know to avoid disappointment.

Where Claude Code falls short

  • Highly visual tasks: for UI design or pixel-perfect CSS, the lack of visual feedback hurts. Cursor with live preview is better.
  • Very large monorepos (>500K lines): context remains limited. Prefer breaking by sub-project.
  • Ultra-confidential proprietary code: if you legally cannot send anything to Anthropic, look at self-hosted Aider or enterprise solutions (Bedrock).

Real cost

The Anthropic Pro plan ($20/month) covers most individual usage. On intensive projects (40h/week of Claude Code), the Max plan ($100-200/month tiers) becomes necessary to avoid rate-limits. Compare to a junior dev's $4000/month — the ratio is largely favorable.


Going further

Claude Code is just one brick of the agentic ecosystem. To understand the complementary tools:

  • Cursor — the AI-native editor many pair with Claude Code for fast in-editor edits
  • Codex (OpenAI) — the direct OpenAI alternative, to compare in your tooling choice
  • MCP (Model Context Protocol) — the protocol to plug Claude Code into your external tools (Notion, GitHub, your DB)
  • Claude Skills — packaging recurring workflows so they trigger automatically
  • Computer Use — the related capability that lets Claude pilot your screen

Frequently Asked Questions

Is Claude Code free?

The tool itself is free (open-source on the CLI side), but it consumes your Anthropic credits. The Pro plan at $20/month suffices for regular solo use. For intensive daily use, aim for the Max plan.

Can I use Claude Code without touching Claude.ai?

Yes. Claude Code uses your Anthropic API key or your Pro/Max account, but doesn't require using the claude.ai web interface. You can do 100% of your work in CLI or VS Code.

Does Claude Code read my entire hard drive?

No. Claude Code only sees files in the folder where you launched it, and only when needed. You validate every shell command by default. For sensitive folders, you can exclude paths via .claudeignore.

What's the difference between Claude Code and the Claude Desktop app?

The desktop app (Cowork) targets non-developers: it acts on your Office files, Drive, etc. Claude Code targets developers: git, terminal, code refactor. Both can coexist on the same machine.

Do I need to know how to code to use Claude Code?

Not strictly. More and more non-developers use it to automate personal scripts (file management, scraping, report generation). But terminal and git proficiency remain useful to unlock 100% of the potential.

Can Claude Code run in the background, unsupervised?

Yes, via batch modes and scheduled agents. You can configure a script that launches Claude Code every night to process a task queue. Always keep guardrails: cost limits, restricted scope, human validation for critical actions (deployment, deletion).

Is my data used to train Claude?

No. Anthropic contractually commits not to use Pro/Max plan and API data to train its models. It's one of the major differences vs some competitors.

Get new guides every week

Join our newsletter and never miss new content.

Also explore