Claude Code Quick Reference: Commands & Shortcuts
The essential Claude Code cheatsheet. Print-friendly quick reference cards for slash commands, keyboard shortcuts, CLI flags, and common workflows.
Updated October 21, 2026: Refreshed for Claude Code 2.1.305: current shortcuts, slash commands and aliases (
/review→/code-review,/cost→/usage), CLI commands (claude auth,claude purge), permission-mode flags, permission-rule syntax, AGENTS.md, and the Opus 5.5 / Sonnet 5.5 / Haiku 5.5 / Fable 5.1 lineup.
Keep this page bookmarked. Everything you need to use Claude Code efficiently, organized for quick lookup. For the complete list of commands, flags, settings, and environment variables, see the Claude Code CLI Reference.
Keyboard Shortcuts
Essential Shortcuts
| Shortcut | Action |
|---|---|
Escape | Interrupt Claude (stops the current response or tool call) |
Ctrl+C | Interrupt, or clear input; press again on an empty prompt to exit |
Ctrl+L | Redraw the screen (keeps the conversation) |
Up/Down | Navigate command history |
Tab | Accept an autocomplete suggestion |
Shift+Enter | Multi-line input (\ + Enter or Ctrl+J work in any terminal) |
Shift+Tab | Cycle permission modes (Manual → acceptEdits → plan → auto) |
Esc Esc | Clear the draft, or open the rewind menu on an empty prompt |
Ctrl+R | Reverse-search command history |
macOS Specific
| Shortcut | Action |
|---|---|
Opt+P | Switch model |
Opt+T | Toggle extended thinking (no effect on Opus 5.5, Sonnet 5.5, Haiku 5.5, or Fable, which always think) |
Opt+O | Toggle fast mode |
Most Option shortcuts, including Opt+P, need Option set as Meta in your terminal. Cmd+K is not a Claude Code “clear conversation” key; use /clear.
Windows/Linux Specific
| Shortcut | Action |
|---|---|
Alt+P | Switch model |
Alt+T | Toggle extended thinking |
Alt+O | Toggle fast mode |
Ctrl+K deletes to the end of the line; it does not clear the conversation.
Slash Commands
Built-in Commands
| Command | Description |
|---|---|
/help | Show all available commands |
/clear | Start a new conversation with empty context (aliases: /reset, /new) |
/compact | Summarize the conversation to free context |
/context | Show what is filling the context window |
/init | Initialize CLAUDE.md for project |
/model | Switch model (saved as your default for new sessions) |
/effort | Set effort (low–xhigh, max, auto); /effort ultracode toggles ultracode |
/memory | Edit CLAUDE.md files and manage auto memory |
/usage | Session cost, plan limits, and stats (/cost and /stats are aliases) |
/doctor | Run a setup checkup and fix problems (alias: /checkup) |
/config | Open Settings (alias: /settings) |
/permissions | Manage allow, ask, and deny rules |
/bug | Report a bug or share your conversation (alias: /share) |
File Commands
| Command | Description |
|---|---|
@<path> | Mention a file or directory in your prompt (there is no /add command) |
/add-dir <path> | Add a working directory for this session |
Review & Version Control
| Command | Description |
|---|---|
/code-review | Review the current diff, or a PR number, branch, or path (--fix, --comment, ultra) |
/review | Alias of /code-review (since v2.1.223) |
/security-review | Check your branch’s changes for security vulnerabilities |
/diff | Review working-tree changes, including Claude’s edits |
/pr-comments was removed in v2.1.91; ask Claude to read the pull request comments instead.
CLI Flags
Starting Claude Code
# Basic
claude # Start interactive session
claude "prompt" # Start a session with an initial prompt
claude -c # Continue the most recent conversation here
claude -r # Resume a session by ID or name, or open the picker
claude -n "auth-refactor" # Name the session
# Model Selection (aliases on the Anthropic API)
claude --model opus # Opus 5.5 (the default model)
claude --model sonnet # Sonnet 5.5
claude --model haiku # Haiku 5.5
claude --model fable # Fable 5.1 (never the default)
claude --effort high # low | medium | high | xhigh | max
# Output Control
claude -p "prompt" # Print mode (no interactive)
claude -p "prompt" --output-format json # JSON output (text | json | stream-json)
claude --verbose # Verbose turn-by-turn output
claude --debug # Debug logging (or --debug-file <path>)
# Permissions
claude --permission-mode plan # manual | acceptEdits | plan | auto | dontAsk | bypassPermissions
claude --restricted # No command-running tools or WebFetch; ignores user/project/local settings
claude --dangerously-skip-permissions # Skip all permission prompts (isolated containers only)
Interactive terminal sessions start in auto mode when nothing sets a permission mode (v2.1.283+); claude -p runs start in Manual mode (v2.1.302+).
MCP Management
# List and manage MCP servers
claude mcp list # List servers and their health
claude mcp add --transport http <name> <url> # Add a remote HTTP server
claude mcp add <name> -- <command> [args...] # Add a local stdio server
claude mcp get <name> # Inspect one server
claude mcp remove <name> # Remove MCP server
claude mcp reset-project-choices # Reset approvals for .mcp.json servers
# Scoped MCP (default scope: local)
claude mcp add --scope project <name> -- <command>
claude mcp add --scope user <name> -- <command>
Configuration
# Settings (`claude config` was removed in v2.0)
/config # In a session: open Settings
/config model=sonnet # In a session: set one key directly
# Files: ~/.claude/settings.json (user), .claude/settings.json (project),
# .claude/settings.local.json (local, kept out of git)
# Login/Auth
claude auth login # Authenticate (--console for API billing)
claude auth status # Show auth status
claude auth logout # Log out
claude setup-token # Long-lived OAuth token for CI and scripts
# Maintenance
claude update # Update Claude Code
claude doctor # Installation and settings diagnostics
claude purge [path] # Delete a project's local state (--dry-run, --all)
Common File Patterns
@ References
# In prompts or CLAUDE.md
See @README.md for project overview.
Check @src/lib/auth.ts for auth utilities.
Reference @package.json for dependencies.
CLAUDE.md Templates
# Minimal CLAUDE.md
## Project
[Brief description]
## Commands
- npm run dev
- npm test
## Standards
- TypeScript strict mode
- Tests required for features
# Full CLAUDE.md
## Overview
[Project description]
## Tech Stack
- [Framework]
- [Language]
- [Database]
## Directory Structure
src/
├── [folder]/ # [purpose]
└── [folder]/ # [purpose]
## Commands
- [command] - [description]
## Autonomous Operations
- [allowed actions]
## Requires Confirmation
- [restricted actions]
Permission Patterns
settings.json
{
"permissions": {
"allow": [
"Read",
"Write",
"Edit",
"Bash(npm *)",
"Bash(git *)"
],
"deny": [
"Read(.env*)",
"Edit(.env*)",
"Bash(rm -rf *)"
]
}
}
Pattern Syntax
| Pattern | Matches |
|---|---|
Read | All read operations |
Edit(src/**) | Edits in src/ and subdirs (path rules use Edit; Write(path) rules are never checked) |
Bash(npm *) | All npm commands (Bash(npm:*) is the equivalent older form) |
Bash(git diff *) | git diff with any args |
Read(.env*) | Any .env file |
WebFetch(domain:example.com) | Fetches to example.com |
Rules are evaluated deny → ask → allow, and deny rules apply in every permission mode, including bypassPermissions.
Model Comparison
| Model | Best For | Speed |
|---|---|---|
| Fable 5.1 | Hardest problems, long autonomous tasks | Slower |
| Opus 5.5 | Default for most work, complex reasoning | Fast; /fast for up to 2.5x |
| Sonnet 5.5 | Everyday coding at lower cost | Fast |
| Haiku 5.5 | Quick tasks, exploration, subagents | Fastest |
When to Use Each
- Fable 5.1: Root-cause investigations, architecture decisions, work larger than a single sitting (select it with
/model fable; it is never the default and can bill to usage credits) - Opus 5.5: The default on Pro, Max, Team, Enterprise, and the Anthropic API, and Anthropic’s suggested starting point; toggle
/fastwhen latency matters - Sonnet 5.5: Day-to-day development, feature implementation
- Haiku 5.5: Quick questions, file exploration, simple edits
On the Anthropic API, opus, sonnet, haiku, and fable resolve to these models from Claude Code v2.1.280, v2.1.284, v2.1.293, and v2.1.257. Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Claude Platform on AWS still map some aliases to older models. Opus 5.5, Sonnet 5.5, and Haiku 5.5 default to medium effort; Fable 5.1 defaults to high.
Memory System
Memory Files
| Location | Scope | Use Case |
|---|---|---|
~/.claude/CLAUDE.md | Global | Personal preferences |
./CLAUDE.md | Project | Team standards |
./.claude/CLAUDE.md | Project | Team standards (hidden) |
./CLAUDE.local.md | Personal | Individual overrides |
./AGENTS.md | Project | Read instead when there is no CLAUDE.md (v2.1.277+) |
~/.claude/projects/<project>/memory/ | Per project | Auto memory Claude writes itself |
Load Order
Files are combined, not overridden; later = more specific:
1. ~/.claude/CLAUDE.md (user)
2. ./CLAUDE.md or ./.claude/CLAUDE.md (project)
3. ./CLAUDE.local.md (local, read last)
Common Workflows
Start New Feature
claude
> Implement [feature description]
> Follow TDD - write tests first
Debug Issue
claude
> Debug: [error message]
> Check logs at [path]
Code Review
claude
> /code-review
> Focus on: security, performance, maintainability
Refactor
claude
> Refactor [component] to [pattern]
> Maintain backward compatibility
Troubleshooting Quick Fixes
| Problem | Solution |
|---|---|
| CLAUDE.md ignored | Check file location (./CLAUDE.md or ./.claude/CLAUDE.md); /context lists the memory files that loaded |
| MCP not loading | /mcp or claude mcp get <name>; claude mcp reset-project-choices |
| Permission denied | Add a rule with /permissions or in the settings.json allow list |
| High token usage | Check /context, then /compact or /clear |
| Wrong model | /model, or Option+P (Mac) / Alt+P (Win/Linux) |
| Config not applied | Run claude doctor for settings errors, then restart Claude Code |
Environment Variables
# API Configuration
ANTHROPIC_API_KEY=sk-...
# Proxy (if needed)
HTTP_PROXY=http://...
HTTPS_PROXY=https://...
# Model and tools
ANTHROPIC_MODEL=opus # Model for new sessions
CLAUDE_CODE_EFFORT_LEVEL=high # low | medium | high | xhigh | max | auto
CLAUDE_CODE_ENABLE_TODO_TOOLS=1 # Task/TodoWrite tools on newer models (off by default)
# Debug
DEBUG=1 # Same as --debug
Print-Friendly Summary
CLAUDE CODE QUICK REFERENCE
===========================
SHORTCUTS
---------
Escape Interrupt Claude
Ctrl+C Interrupt / clear / exit
Shift+Tab Cycle permission modes
Opt/Alt+P Switch model
COMMANDS
--------
/help Show commands
/clear New conversation
/init Create CLAUDE.md
/doctor Diagnose issues
CLI
---
claude Start session
claude -p "prompt" Single prompt, then exit
claude -c Continue session
claude --model X Use model X
FILES
-----
./CLAUDE.md Project config
~/.claude/CLAUDE.md Global config
CLAUDE.local.md Personal overrides
.claude/settings.json Permissions
MCP
---
claude mcp list Show servers
claude mcp add Add server
claude mcp remove Remove server
Bookmark this page and keep it handy. You’ll reference it more than you think.
Sources: Claude Code Documentation, CLI reference, Commands, Interactive mode, Model configuration, Claude Code GitHub