What is Claude Code?
Claude Code is an agentic coding tool from Anthropic that operates directly in your terminal. Unlike autocomplete tools that suggest the next line, Claude Code reads your entire codebase, plans multi-step changes, writes code across files, runs tests, and commits to git — all from natural language instructions.
It has accumulated over 100,000 GitHub stars since its general availability release and is used daily by tens of thousands of developers at companies including ServiceNow (29,000+ developers) and Allianz.
The tool is available on multiple surfaces: a terminal CLI, a VS Code extension, a JetBrains plugin, a dedicated desktop app with visual diff review, a web version at claude.ai/code, and a Slack integration.
How It Works: The Agentic Loop
Claude Code follows a continuous explore → plan → execute → verify loop:
flowchart LR
A[Explore Codebase] --> B[Plan Changes]
B --> C[Execute: Edit / Bash / Git]
C --> D[Verify: Tests / Lint / Diff]
D -->|Passes| E[Commit & PR]
D -->|Fails| A
At each step, Claude can read files, search with glob patterns, run shell commands, and edit source files. It requests permission before modifying your system by default, and you can configure progressively less oversight as trust builds.
Key Specifications
| Capability | Detail |
|---|---|
| Context window | Up to 1 million tokens |
| Supported models | Opus 4.7, Sonnet 4.6, Haiku 4.5 |
| Platforms | macOS, Linux, Windows |
| Interfaces | CLI, VS Code, JetBrains, Desktop app, Web, Slack |
| Sub-agents | Parallel context isolation for multi-task execution |
| MCP support | Connect databases, APIs, GitHub, Slack, and more |
| Git integration | Auto-commit, PR creation, branch management |
Installation
Prerequisites
- Node.js 18+ (for npm-based install) or a compatible system.
- An Anthropic account with an active subscription (Pro, Max, Team, or Enterprise) or API access.
macOS / Linux (Recommended)
Anthropic now recommends the native installer — the npm package is deprecated:
curl -fsSL https://claude.ai/install.sh | bash
macOS via Homebrew
brew install --cask claude-code
Windows
# PowerShell (recommended)
irm https://claude.ai/install.ps1 | iex
# WinGet
winget install Anthropic.ClaudeCode
npm (Deprecated, Migration Available)
npm install -g @anthropic-ai/claude-code
If you previously installed via npm, migrate to the native version:
claude install
Verify Installation
claude --version
First Run
Navigate to any project directory and start a session:
cd your-project
claude
On first launch, Claude Code guides you through browser-based authentication. After that, you are ready to work.
Core Slash Commands
Once inside an interactive session, these slash commands are essential:
| Command | Purpose |
|---|---|
/help |
Show help and available commands |
/clear |
Clear conversation history, free context |
/compact |
Compress context, keep a summary in memory |
/cost |
Show token usage and session cost |
/doctor |
Diagnose installation health and version status |
/init |
Generate a CLAUDE.md file for project context |
/model |
Switch between Opus / Sonnet / Haiku |
/plan |
Enter plan mode — think before coding |
/mcp |
Manage MCP server connections |
/agents |
List and manage sub-agents |
/skills |
List installed skills |
/permissions |
View and modify tool permissions |
/review |
Code review the current git diff |
/rewind |
Open rewind menu to restore checkpoints |
/login |
Re-authenticate or switch accounts |
/rename |
Name the current session for later resumption |
/bug |
Submit feedback to Anthropic |
CLI Flags
Use flags for non-interactive or scripted workflows:
# Quick query, plain text output
claude -p "Explain the structure of this project"
# Structured output for scripting
claude -p "List all API endpoints" --output-format json
# Streaming JSON for real-time processing
claude -p "Analyze this log" --output-format stream-json
# Specify a model
claude --model claude-sonnet-4-6
# Continue last session
claude --continue
# Resume from a list of sessions
claude --resume
# Skip permission prompts (use with caution)
claude --dangerously-skip-permissions
# Auto mode — classifier handles approval
claude --permission-mode auto -p "fix all lint errors"
CLAUDE.md: The Project Memory System
The CLAUDE.md file is one of the most impactful features. Claude reads it at the start of every session to understand your project conventions, build commands, and preferences.
Run /init to generate a starter file based on your codebase, then refine it:
# Code style
- Use ES modules (import/export), not CommonJS
- TypeScript strict mode enabled
- Destructure imports when possible
# Workflow
- Run `npm run typecheck` after any type changes
- Prefer `npm test -- --run` for single-file tests
- Commit messages follow Conventional Commits
CLAUDE.md File Locations
Claude Code checks multiple locations, applied hierarchically:
| Location | Scope | Git |
|---|---|---|
~/.claude/CLAUDE.md |
All projects (personal) | No |
./CLAUDE.md |
Current project (team) | Yes |
./CLAUDE.local.md |
Current project (personal) | No (add to .gitignore) |
| Parent directories | Monorepo support | As appropriate |
What to Include vs. Exclude
| ✅ Include | ❌ Exclude |
|---|---|
| Build/test/lint commands Claude cannot guess | Standard language conventions |
| Code style rules that differ from defaults | File-by-file codebase descriptions |
| Repository etiquette (branch naming, PR rules) | Long tutorials or explanations |
| Architectural decisions specific to your project | Information that changes frequently |
| Required environment variables | Self-evident practices |
Keep it concise. If there are too many rules, Claude will ignore them. A good test: remove any line where Claude already does the right thing without it.
Plan Mode
Plan mode forces Claude to think before acting. It enters a read-only state — no file writes, no command execution — and focuses on analysis:
plan: I want to add Google OAuth. What files need to change?
plan: What's the session flow? Create a detailed implementation plan.
The recommended four-phase workflow:
- Explore — Enter plan mode. Read relevant files, understand existing patterns.
- Plan — Ask Claude to create a step-by-step implementation plan. Press
Ctrl+Gto open it in your editor for direct editing. - Implement — Switch out of plan mode. Let Claude code, verifying against the plan.
- Commit — Ask Claude to commit with a descriptive message and open a PR.
Activate plan mode with Shift+Tab twice, Alt+M, or the /plan command.
MCP Integration
The Model Context Protocol (MCP) is Anthropic’s open standard for connecting AI models to external tools and data sources. With MCP, Claude Code can query databases, post to Slack, create GitHub issues, read Jira tickets, and interact with any service that exposes an MCP server.
Configure MCP servers via CLI or in .claude/settings.json:
# Add an MCP server
claude mcp add github --transport http
# List connected servers
claude mcp list
Project-level MCP servers are configured in .mcp.json at your project root, allowing the team to share integrations checked into version control.
Popular MCP Servers
| Server | Use Case |
|---|---|
| GitHub | Read issues, create PRs, review code |
| Postgres | Query databases, run migrations |
| Slack | Post messages, read channels |
| Filesystem | Advanced file operations |
| Puppeteer/Playwright | Browser automation, screenshots |
Extending Claude Code
Beyond MCP, Claude Code offers several extension mechanisms:
Hooks
Hooks run scripts automatically at specific points in the workflow — for example, auto-formatting after every file edit:
Write a hook that runs Prettier after every file edit.
Claude can write hooks for you. Run /hooks to see what is configured.
Skills
Skills are reusable instruction files stored in .claude/skills/. They give Claude domain knowledge on demand:
Create .claude/skills/api-conventions/SKILL.md:
---
name: api-conventions
description: REST API design conventions
---
# API Conventions
- Use kebab-case for URL paths
- Use camelCase for JSON properties
- Always include pagination for list endpoints
- Version APIs in the URL path (/v1/, /v2/)
Skills load automatically when the topic is relevant, or you can invoke them with /skill-name.
Sub-agents
Sub-agents run in isolated context windows with their own tool permissions. They are useful for investigation tasks that would otherwise fill your main context:
Use a subagent to investigate how our authentication system handles token refresh.
Define custom sub-agents in .claude/agents/:
---
name: security-reviewer
description: Reviews code for security vulnerabilities
tools: Read, Grep, Glob, Bash
model: opus
---
You are a senior security engineer. Review code for:
- Injection vulnerabilities (SQL, XSS, command injection)
- Authentication and authorization flaws
- Secrets or credentials in code
Plugins
Run /plugin to browse the community and official plugin marketplace. Plugins bundle skills, hooks, sub-agents, and MCP servers into a single installable unit.
Multi-Agent and Parallel Workflows
Claude Code scales horizontally. Beyond a single session, you can run multiple Claudes in parallel:
Git Worktrees
Use git worktrees to run isolated Claude sessions on separate branches simultaneously:
git worktree add ../feature-branch feature-branch
cd ../feature-branch && claude
Each worktree has its own filesystem and git history — sessions never collide.
Agent Teams
Agent teams provide automated coordination of multiple Claude sessions with shared tasks and messaging. A lead agent decomposes work, dispatches sub-tasks to specialized agents, and integrates the results.
Desktop App Sessions
The Claude Code desktop app manages multiple local sessions visually, each in its own worktree, with split-pane diff review.
Claude Code on the Web
The browser-based version runs tasks on Anthropic-managed cloud infrastructure in isolated sandboxes. Connect GitHub repositories, delegate multiple tasks in parallel, and track progress in real-time.
Security and Permissions
Claude Code runs locally and communicates directly with model APIs — no backend server or remote code index. It asks for permission before modifying files or running commands.
Three permission modes:
| Mode | Behavior |
|---|---|
| Default (Ask) | Claude prompts before every file write, Bash command, or MCP tool call |
| Auto | A classifier model reviews actions. Blocks scope escalation and risky commands; lets routine work proceed silently |
| Allowlists | Permit specific commands like npm run lint or git commit. Deny dangerous patterns like sudo or rm -rf |
Configure in .claude/settings.json:
{
"permissions": {
"allow": ["Read", "Write(src/)", "Bash(git *)", "Bash(npm *)"],
"deny": ["Read(.env)", "Bash(rm *)", "Bash(sudo *)"]
}
}
IDE Integration
Claude Code works alongside your editor without requiring you to change your workflow:
VS Code
Install the extension from the marketplace. It provides inline diffs, plan review, and conversation history.
code --install-extension anthropic.claude-code
JetBrains IDEs
Available for IntelliJ IDEA, PyCharm, WebStorm, and the rest of the JetBrains ecosystem. Search “Claude Code” in the plugin marketplace.
Vim / Neovim
" In .vimrc
command! Claude claude --file %
Desktop App
The standalone desktop app for macOS and Windows provides visual project management, parallel sessions, integrated terminal, and visual diff review.
Pricing
Claude Code is available through several plans:
| Plan | Price | What You Get |
|---|---|---|
| Pro | $20/month | Claude Code access, limited usage |
| Max | $100-200/month | Higher usage limits, priority access |
| Team | Custom | Shared billing, admin controls |
| Enterprise | Custom | SSO, security reviews, SLA |
When used with a Claude Console (API) account, Claude Code consumes tokens at standard API rates:
| Model | Input Price (per 1M tokens) |
|---|---|
| Haiku 4.5 | $0.25 |
| Sonnet 4.6 | $3.00 |
| Opus 4.7 | $15.00 |
First-time users typically receive free credits to evaluate the tool.
Best Practices
Be Specific
# Good — provides constraints and context
claude "Create a Python function that accepts a list of integers and returns the sum of even numbers, using only built-in modules"
# Poor — vague, invites misinterpretation
claude "do some math"
Provide Verification Criteria
Claude performs dramatically better when it can check its own work. Include tests, expected outputs, or screenshots:
claude "Write a validateEmail function. Test cases: [email protected] → true, invalid → false, [email protected] → false. Run tests after implementing."
Use Sub-agents for Investigation
Research tasks consume context. Delegate them to sub-agents to keep your main conversation clean:
Use a subagent to investigate how we handle database migrations. Report back with a summary.
Manage Context Aggressively
The context window is the most constrained resource. Run /clear between unrelated tasks. Use /compact to condense long conversations. Avoid marathon sessions — prefer focused 5-10 turn interactions.
Leverage Auto Mode
For routine tasks like lint fixes or test repairs, auto mode eliminates approval fatigue:
claude --permission-mode auto -p "fix all lint errors in src/"
Use the Explore-Plan-Code Loop
Never jump straight to implementation on complex tasks. Use plan mode to understand the codebase first, create a plan, then execute. This prevents solving the wrong problem.
Common Mistakes
| Mistake | Fix |
|---|---|
| Kitchen sink session — switching between unrelated tasks in one session | /clear between tasks |
| Correcting repeatedly — same issue corrected 3+ times in one session | /clear, write a better initial prompt |
| Over-specified CLAUDE.md — too many rules, none followed | Ruthlessly prune. Keep only what Claude gets wrong without it |
| Trust-then-verify gap — plausible-looking code that fails on edge cases | Always provide tests or verification criteria |
| Infinite exploration — unfocused research that fills context | Scope narrowly or use sub-agents |
Resources
- Claude Code Official Docs — Installation, configuration, and feature reference
- Claude Code Best Practices — Official guide from Anthropic’s engineering teams
- Anthropic Console — API key management and billing
- MCP Specification — Model Context Protocol documentation and server registry
- Claude Code on GitHub — Official repository, 100K+ stars
Comments