Claude Code is Anthropic's official CLI for Claude — a terminal-based coding agent that reads your project, makes multi-file edits, runs commands, and manages git.
Install via the official script, not npm. The old @anthropic-ai/claude-code npm package is
no longer the recommended install path.
# macOS / Linux / WSL
curl -fsSL https://claude.ai/install.sh | bash
# macOS (Homebrew)
brew install --cask claude-code
# Windows (PowerShell)
irm https://claude.ai/install.ps1 | iex
# Windows (WinGet)
winget install Anthropic.ClaudeCodecurl | bash executes whatever the server returns, right now, as your user.
Prefer Homebrew / WinGet on untrusted networks. If you use the script, inspect
it first: curl -fsSL https://claude.ai/install.sh | less.
cd your-project
claudeAsk: /init — Claude scans your codebase and generates a starter CLAUDE.md. Review and prune before committing.
See the official install docs for the latest canonical instructions.
The most important file for Claude Code. Place at your project root. It tells Claude about your project structure, conventions, and commands.
# My Project
## Commands
pnpm dev # Start dev server
pnpm test # Run tests
pnpm lint # Lint code
## Code Style
- TypeScript strict, no `any`
- Named exports, no barrel files
- Server Components by default
## Architecture
src/app/ # Next.js App Router
src/lib/ # Utilities
src/db/ # Database layerKeep it under 200 lines. Every line competes for attention. See CLAUDE.md Best Practices for details.
Project-level permissions and hooks:
{
"permissions": {
"allow": ["Bash(pnpm *)"],
"deny": ["Bash(rm -rf *)"]
}
}Drop a CLAUDE.md inside any subdirectory (e.g. src/api/CLAUDE.md) and Claude Code loads it automatically when working in that subtree. Combine a root CLAUDE.md with subdirectory ones for a layered memory hierarchy — the root defines project-wide rules, the subdirectory adds local context.
Personal overrides live in CLAUDE.local.md (gitignored). User-level memory lives in ~/.claude/CLAUDE.md and applies across every project.
Claude Code supports MCP servers for extended capabilities:
// .mcp.json
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/project"]
},
"playwright": {
"command": "npx",
"args": ["-y", "@playwright/mcp@latest"]
}
}
}Note: several 2024-era reference servers (Postgres, Slack, Sentry, GitHub, Puppeteer, SQLite, Redis, Google Drive, Brave Search) have been moved to modelcontextprotocol/servers-archived. Use community-maintained forks or the first-party replacements (Vercel MCP, GitHub Copilot MCP, etc.) instead.
/init to auto-generate a CLAUDE.md from your codebasepnpm test -- path/to/file to run single test files (faster feedback).claude/settings.json to auto-format code after edits@file syntax in CLAUDE.md imports content from other filesClaude Code has grown well past the CLAUDE.md + settings.json + MCP triad. Features to know:
.claude/skills/*/SKILL.md. Invoke with /skill-name in chat.PreToolUse, PostToolUse, SessionStart, etc. Configured in .claude/settings.json.npm install @anthropic-ai/claude-agent-sdk (TS) or pip install claude-agent-sdk (Python). Ideal for CI/CD and production automation./commands from .claude/commands/*.md.Claude Code runs as: Terminal CLI, VS Code extension, JetBrains plugin, Desktop app (macOS / Windows), and Web app at claude.ai/code. Workflows translate between all five.
Search for a command to run...