Claude Code Command Reference
Your Terminal Copilot Cheat Sheet
What is Claude Code?
Claude Code is Anthropic's agentic coding tool that lives in your terminal. It's not just another AI assistant—it's your AI pair programmer that can read files, write code, run commands, and create commits. Think of it as having a senior engineer available 24/7 to help you build features, debug issues, and refactor code.
Getting Started
Installation & Setup
# Install Claude Code npm install -g @anthropic-ai/claude-code # Start Claude Code in your project cd /path/to/your/project claude # First time? You'll need to log in # Supports both Claude.ai and Claude Console accounts
Windows Users:
Claude Code works on Windows 10+ through WSL 1 or WSL 2 (recommended) or Git Bash (native alternative). For WSL users experiencing file system performance issues, you can run Claude Code natively on Windows instead.
Essential Keyboard Shortcuts
Platform Compatibility: Claude Code works on macOS 10.15+, Linux (Ubuntu 20.04+/Debian 10+), and Windows 10+ (via WSL 1/2 or Git Bash).
Tip: Press ? in Claude Code to see shortcuts specific to your platform.
| Shortcut | Description | Context |
|---|---|---|
Shift + Tab | Toggle permission modes | Cycles: Normal → Auto-Accept → Plan Mode |
Tab | Toggle extended thinking | Enable/disable deeper reasoning |
Esc + Esc | Edit previous message | Double-escape to modify last prompt |
Ctrl + C | Cancel current operation | Stop generation or tool execution |
Ctrl + L | Clear terminal screen | Keeps conversation history intact |
Ctrl + R | Search command history | Find and reuse previous commands |
Up/Down | Navigate command history | Recall previous inputs |
? | Show all shortcuts | Context-aware help menu |
Plan Mode: The Game-Changer
What is Plan Mode?
Plan Mode is Claude Code's killer feature that separates research and planning from execution. Press Shift + Tab twice to activate it. In this mode, Claude can only read and analyze—it cannot modify files, run commands, or make any changes until you approve the plan.
How to Use Plan Mode
Activate Plan Mode
Press Shift + Tab twice. You'll see ⏸ plan mode on at the bottom.
Describe Your Task
> "Plan the implementation of user authentication using OAuth2" > "Analyze the current database schema and plan optimizations" > "Create a plan to refactor the payment processing module"
Review the Plan
Claude researches your codebase and presents: task breakdown, files to be modified, execution order, and potential edge cases.
Exit Plan Mode & Execute
Claude calls exit_plan_mode when ready. Accept, ask follow-up questions, or provide different direction.
✓ Read-Only Tools (Allowed)
- Read - View file contents
- LS - List directory contents
- Glob - Search file patterns
- Grep - Search file contents
- WebFetch - Fetch web content
- WebSearch - Search the web
- Task - Launch research subagents
- TodoRead - Read task lists
✗ Blocked Until Approved
- Edit/MultiEdit - File modifications
- Write - File creation
- Bash - Command execution
- Any MCP tools - That modify state
Use Plan Mode for: Complex architecture, multi-file refactoring, exploring unfamiliar codebases, validating approaches.
CLI Flags for Plan Mode
# Start a new session in Plan Mode
claude --permission-mode plan
# Set Plan Mode as default in settings
# Add to .claude/settings.json:
{
"permissions": {
"defaultMode": "plan"
}
}
# Run a headless query in Plan Mode
claude -p "Plan the authentication system" --permission-mode planEssential CLI Commands
| Command | Description | Example |
|---|---|---|
claude | Start interactive session | claude |
claude --continue | Continue most recent conversation | claude --continue |
claude --resume | Show conversation picker | claude --resume |
claude -p "query" | Print mode (headless) | claude -p "Run tests" |
claude update | Update to latest version | claude update |
claude --add-dir | Add additional directories | claude --add-dir ../lib |
IDE Integration
VS Code & JetBrains Shortcuts
| Action | macOS | Windows/Linux |
|---|---|---|
| Insert file reference (@File) | Cmd+Option+K | Alt+Ctrl+K |
| Quick launch (JetBrains) | Cmd+Esc | Ctrl+Esc |
| Multiline input | Option+Enter | \ + Enter |
Interactive Slash Commands
Type / at the start of your message to access slash commands:
/config Open settings/help Show commands/model Switch AI model/login Switch accounts/clear Clear history/vim Vim-style editing/ide Connect to IDE/init Generate CLAUDE.md/terminal-setup Configure multilineCreating Custom Slash Commands
# Project-wide command (.claude/commands/) mkdir -p .claude/commands echo "Review this code for security vulnerabilities:" > .claude/commands/security.md # Personal command (~/.claude/commands/) mkdir -p ~/.claude/commands echo "Analyze code performance and suggest optimizations:" > ~/.claude/commands/optimize.md # Use your custom command > /security > /optimize
Extended Thinking Mode
Enable deeper reasoning for complex problems:
Toggle with Tab key
Press Tab to enable/disable extended thinking
Use prompts with thinking levels
> "think about the best approach" > "think hard about edge cases" > "think harder about the architecture" > "ultrathink about the security implications"
Enable permanently
// In .claude/settings.json:
{
"MAX_THINKING_TOKENS": 10000
}File References & Context
@ Reference Syntax
# Include specific files > Explain the logic in @src/utils/auth.js # Include directories > Review the tests in @tests/ # Include GitHub issues (via MCP) > Show me the data from @github:repos/owner/repo/issues # Include multiple references > Compare @src/old-api.js with @src/new-api.js
# Memory Shortcut
Type # at the start of your message. Claude will prompt for file selection and add context to CLAUDE.md (project memory).
Model Selection
# Switch models during session
/model opus # Claude Opus 4.1/4 (best reasoning)
/model sonnet # Claude Sonnet 4/4.5 (balanced)
/model haiku # Claude Haiku 4.5 (fastest)
/model opusplan # Hybrid: Opus for planning, Sonnet for execution
# Set model via CLI
claude --model opus
# Configure in settings
{
"model": "opus"
}Pro Tip: Use opusplan to get Opus reasoning for planning with Sonnet efficiency for execution. Best of both worlds!
Permission Modes
| Mode | Indicator | Behavior |
|---|---|---|
| Normal Mode | (default) | Claude asks permission for each file edit |
| Auto-Accept Mode | ⏵⏵ accept edits on | Automatically approves all file edits |
| Plan Mode | ⏸ plan mode on | Read-only: no edits until plan approved |
Toggle between modes: Press Shift + Tab to cycle through them
Best Practices From the Field
Start with Plan Mode
For any non-trivial feature, start in Plan Mode. It's easier to change a plan than to change code mid-implementation.
Use Extended Thinking for Complex Problems
Architecture decisions, performance optimizations, and security reviews benefit from "think hard" or "ultrathink" prompts.
Leverage CLAUDE.md for Project Context
Run /init to generate a CLAUDE.md file with your project overview. Claude reads this automatically at session start.
Interrupt and Course-Correct
Press Esc to interrupt at any time. Double-tap Esc + Esc to edit your previous prompt and try a different approach.
Use the Hybrid opusplan Model
Get Opus reasoning for planning with Sonnet efficiency for execution. Best of both worlds.
Integrate with Your IDE
Use /ide to connect Claude Code to VS Code or JetBrains. Share selections, view diffs in your editor, and get automatic diagnostic sharing.
Advanced Workflows
Test-Driven Development with Claude
1. Enter Plan Mode (Shift+Tab twice) 2. > "Plan comprehensive tests for the user authentication module" 3. Review and approve the test plan 4. > "Write the tests first, don't implement anything yet" 5. > "Run the tests and confirm they fail" 6. > "Now implement the authentication to make tests pass" 7. > "Commit the changes with a descriptive message"
Parallel Development with Git Worktrees
# Create worktrees for parallel Claude Code sessions git worktree add ../project-feature-a -b feature-a git worktree add ../project-bugfix -b bugfix-123 # Run Claude Code in each worktree cd ../project-feature-a && claude # In another terminal: cd ../project-bugfix && claude # Each instance works independently without conflicts
CI/CD Integration (Headless Mode)
# Use in pre-commit hooks claude -p "Review staged changes for issues" # Use in CI pipelines claude -p "Run tests and report failures" --output-format json # Automated code review cat error.log | claude -p "Analyze this error log and suggest fixes"
Pro Tips
- Multiline Input (Universal): Type
\followed by Enter works on all platforms - Multiline Input (macOS):
Option+Enterworks by default - Multiline Input (Setup): Run
/terminal-setupto configureShift+Enterfor iTerm2 and VS Code - Context Priming: For large codebases, use
@references to load relevant files before asking questions - Save Plans: Have Claude save important plans to
docs/PLAN.mdfor version control - MCP Integration: Connect Claude Code to Google Drive, Slack, Jira, and more via Model Context Protocol
- Custom Agents: Define specialized subagents for security reviews, code optimization, or documentation
Security Note
Always review plans and code changes before approval, especially in production environments. Plan Mode is your safety net—use it for any changes that could have significant impact.
Sources & Further Reading
This reference guide is based on the Official Anthropic Documentation (November 2025). All commands and features have been verified against the latest Claude Code release.