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
PITFALLPATH issue: run `npm config get prefix` to find the global bin folder, then add it to your shell profile (e.g. export PATH="$PATH:$(npm config get prefix)/bin").

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
TIPPrefer API key for CI/CD automation. Set ANTHROPIC_API_KEY in your environment and Claude Code skips the browser auth flow entirely.

~/.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.

FILE PATH
~/.claude/CLAUDE.md
STARTER TEMPLATE
# 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
TIPThis is permanent memory. Anything you want Claude to always know or always do goes here — not in the chat.

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.

FILE PATH
./CLAUDE.md
EXAMPLE
# 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
NOTEYou can also place CLAUDE.md files in subdirectories — Claude loads them when working in those folders.

~/.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.

~/.claude/settings.json
{
  "permissions": {
    "allow": [
      "Bash(git *)",
      "Bash(npm run *)",
      "Bash(npx *)"
    ],
    "deny": [
      "Bash(rm -rf *)",
      "Bash(curl * | bash *)"
    ]
  }
}
PITFALLAvoid allow: ["Bash(*)"]. It grants Claude unrestricted shell access. Prefer explicit patterns for the commands you actually use.

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.

PATTERN
# 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."
NOTERate limits: Claude Code uses credits. Long back-and-forths burn context fast. /clear resets the window and is free.

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.

EXAMPLE OUTPUT
 claude-sonnet-4-6 │ ↑1.2k ↓340 │ $0.023 │ ✦ Bash
TIPA good statusline makes rate limits visible — you can see exactly when you're burning tokens fast and decide to /clear.
Open Configurator →
§

SLASH COMMANDS

TYPE / IN CLAUDE CODE
/helpShow all available commands and shortcuts.
/clearReset conversation context. Use between unrelated tasks to prevent stale responses.
/compactCompress conversation to save tokens. Keeps a summary instead of full history.
/modelSwitch between Opus, Sonnet, and Haiku mid-session.
/mcpInspect connected MCP servers and their status.
/doctorDiagnose installation issues — PATH, auth, node version.
/configOpen interactive settings editor.
/reviewAsk Claude to review a diff or set of changes.
/initGenerate a CLAUDE.md for the current project from existing code.
TYPE @ TO REFERENCE FILES
@filename@report.csv
Reference a specific file
@folder/@src/utils/
Reference an entire directory
Tab key
Autocomplete paths after @
TIPYou can type / at any point mid-conversation — not just at the start.
§

PROMPTING TECHNIQUES

TECHNIQUE
WHEN TO USE
EXAMPLE
Be Specific
Always — vague prompts produce vague code.
"Clean this CSV: remove rows where column B is empty, dedupe on email."
Give Examples
When output format matters.
"Format the output like this: [show 1–2 examples of what you want]."
Chain Steps
Complex multi-part tasks.
"First analyze the data, then summarize findings, then create action items."
Set Constraints
Quality control.
"Max 200 lines. Only use built-in Node modules. No external dependencies."
Assign a Role
When you need domain expertise.
"Act as a senior security engineer reviewing this auth implementation."
Plan Before Code
Before any non-trivial change.
"Explain your approach and list the files you'll touch. Don't write code yet."
Use /clear Often
Between unrelated tasks.
Old context bleeds into new responses. /clear resets the window for free.
PRO PATTERN

CHECKPOINT + ITERATE

01Ask Claude to make a plan first.
02Review the plan before execution.
03Let it create checkpoints.
04Rewind (Esc twice) if something goes wrong.
05Iterate with specific feedback.
§

DOS & DON'TS

DO
Start in Plan ModeShift+Tab twice. Let Claude map the steps, then switch to auto-accept for execution.
Write a clear goal upfrontThe better your brief, the fewer revisions needed. Vague in = vague out.
Use /clear between tasksOld context bleeds into new responses and wastes tokens. Reset when switching topics.
Create a CLAUDE.md per projectThe more context Claude has upfront, the less you repeat yourself across sessions.
Build Skills for recurring tasksIf you do it more than twice, make it a Skill. Your future self will thank you.
Share CLAUDE.md with your teamMultiple people contributing to it weekly makes it dramatically better.
DON'T
Don't jump straight to executionSkipping the plan is the #1 mistake. You waste time fixing avoidable errors.
Don't use it like ChatGPTClaude Code works across your file system. Stop copy-pasting code into a chat window.
Don't be vague"Fix the bug" is not a prompt. Include file names, error messages, and expected behavior.
Don't work in isolationShare your CLAUDE.md with your team. There's no one correct way — everyone evolves it differently.
Don't treat your setup as finishedContinually improve your setup. The workflow improves fast. Yours should too.
Don't use allow: ["Bash(*)"]Unrestricted shell access is a security risk. Prefer explicit permission patterns.
§

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.

DEVELOPER TOOLS
GitHubPRs, issues, repos
GitLabCI/CD, MRs
SentryError monitoring
LinearIssue tracking
PRODUCTIVITY
NotionDocs, databases
SlackChannels, DMs
JiraTickets, boards
DriveGoogle Docs/Sheets
DATA & RESEARCH
PostgreSQLDirect DB access
PerplexityLive web research
BraveWeb search
FilesystemLocal file access
COMMUNICATION
GmailRead & send email
DiscordServers & channels
BufferSocial scheduling
TypefullyTwitter/X drafts
QUICK ADD COMMAND
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

ACTION
KEYS
Cancel / Stop generation
Works mid-stream
Esc
Rewind to last checkpoint
Esc twice quickly
Esc Esc
Enter Plan Mode
Toggle auto-accept off
Shift+Tab
Paste image into prompt
Cmd+V does not work on Mac
Ctrl+V
Run shell command directly
e.g. !git status
! then command
Autocomplete file path
After typing @ for file refs
Tab after @
Previous prompt
Navigate prompt history
↑ arrow
Multiline input
Add a newline without submitting
Shift+Enter
PLAN MODE TIP

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.

PITFALLOn macOS, Ctrl+V (not Cmd+V) pastes images. This catches everyone at least once.
§

FILE ARCHITECTURE

global
project
skill
dir
CLICK A FILE TO LEARN MORE
~/ GLOBAL~/.claude/./ PROJECT.claude/loads firstproject overrides~/.claude.jsonCLAUDE.mdsettings.jsonkeybindings.jsonstatusline.shmemory/projects/<name>.md<skill>.mdCLAUDE.mdsettings.jsonagents/<name>.md
[ CLICK ANY FILE TO INSPECT ]
§

AGENT SCOPE

SCALE REFERENCE — universe to atom
GALAXY= Your Computer
STAR= One Chat
🪐
PLANET= Project Helper
🌍
MOON= Any-Project Help
ATOM= One Action
SYSTEM: CLAUDE_CODE
AGENTS: 5 LOADED
~/.claude/ ← GLOBAL
PROJECT → .claude/
~/.claude/ — global
.claude/agents/ — project
CLAUDE CODE
session
GLOBAL — all sessions
PROJECT — this repo only
► CLICK AN AGENT
[ CLICK AN AGENT TO INSPECT ]