GETTING STARTED
Install the CLI globally. Requires Node.js 18+. After install, the claude command should be on your PATH. If it isn't, your shell's PATH likely doesn't include npm's global bin directory.
npm install -g @anthropic-ai/claude-code
claude --version
Run claude from any directory. On first launch it opens a browser to authenticate. You can use a claude.ai subscription (Pro/Teams) or an ANTHROPIC_API_KEY environment variable for direct API access. API key usage is billed separately from subscriptions.
claude
~/.claude/CLAUDE.md is your permanent memory. It loads before every conversation, in every project. Use it for personal preferences: language, style, commit conventions, things Claude should never do. Think of it as your system prompt that follows you everywhere.
~/.claude/CLAUDE.md
# Global Rules ## Style - Always use TypeScript - Prefer functional style over classes - Keep responses concise ## Git - Use conventional commits (feat:, fix:, docs:) - Never commit .env or secrets ## Behavior - Ask before running destructive commands - Explain trade-offs when multiple approaches exist
A ./CLAUDE.md in your project root layers on top of your global rules. It's the right place for project-specific context: stack, conventions, architecture notes, and commands. Commit it — every teammate who opens Claude Code in this repo inherits the same context automatically.
./CLAUDE.md
# Project: my-app ## Stack - Next.js 15, TypeScript, Tailwind - Postgres via Drizzle ORM - Tests: Vitest + React Testing Library ## Commands - `npm run dev` — dev server - `npm run test` — run all tests - `npm run build` — production build ## Conventions - Components in src/components/ - DB queries in src/db/ - No default exports
~/.claude/settings.json (global) and .claude/settings.json (project) control which tool calls Claude can make without asking. Project settings merge on top of global — they don't replace them. Use glob patterns to allow specific commands and deny dangerous ones.
{
"permissions": {
"allow": [
"Bash(git *)",
"Bash(npm run *)",
"Bash(npx *)"
],
"deny": [
"Bash(rm -rf *)",
"Bash(curl * | bash *)"
]
}
}The most effective pattern: first ask Claude to explore relevant files, then ask it to plan the approach (without coding yet), then execute. Use /clear between unrelated tasks to prevent stale context from polluting responses.
Be specific. Instead of "fix the bug", say "the login form throws a 401 when email has uppercase letters — here's the error…". Vague prompts produce vague code.
# Step 1 — orient Claude "Read src/auth/ and explain how sessions work." # Step 2 — plan without executing "Plan how to fix the 401 bug. Don't write code yet." # Step 3 — execute "Implement the plan."
Claude Code can show a live statusline in your terminal — model name, token count, cost, and active tool. It's off by default. Use the configurator below to build your statusline string, then drop it into your ~/.claude/settings.json.
claude-sonnet-4-6 │ ↑1.2k ↓340 │ $0.023 │ ✦ Bash
SLASH COMMANDS
PROMPTING TECHNIQUES
CHECKPOINT + ITERATE
DOS & DON'TS
MCP SERVERS
WHAT IS MCP?Model Context Protocol — an open standard that connects Claude to your tools. Think of it as USB-C for AI: one protocol, hundreds of integrations. Claude works inside your existing stack instead of alongside it.
claude mcp add --transport http notion https://mcp.notion.site/mcp
Replace notion with any server name and update the URL. Run claude mcp list to see all connected servers.
KEYBOARD SHORTCUTS
Shift+Tab toggles auto-accept. In plan mode, Claude shows its intent and waits for approval before touching files. Switch back with Shift+Tab again once you're happy with the plan.