Skip to main content

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

ShortcutAction
EscapeInterrupt Claude (stops the current response or tool call)
Ctrl+CInterrupt, or clear input; press again on an empty prompt to exit
Ctrl+LRedraw the screen (keeps the conversation)
Up/DownNavigate command history
TabAccept an autocomplete suggestion
Shift+EnterMulti-line input (\ + Enter or Ctrl+J work in any terminal)
Shift+TabCycle permission modes (Manual → acceptEdits → plan → auto)
Esc EscClear the draft, or open the rewind menu on an empty prompt
Ctrl+RReverse-search command history

macOS Specific

ShortcutAction
Opt+PSwitch model
Opt+TToggle extended thinking (no effect on Opus 5.5, Sonnet 5.5, Haiku 5.5, or Fable, which always think)
Opt+OToggle 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

ShortcutAction
Alt+PSwitch model
Alt+TToggle extended thinking
Alt+OToggle fast mode

Ctrl+K deletes to the end of the line; it does not clear the conversation.


Slash Commands

Built-in Commands

CommandDescription
/helpShow all available commands
/clearStart a new conversation with empty context (aliases: /reset, /new)
/compactSummarize the conversation to free context
/contextShow what is filling the context window
/initInitialize CLAUDE.md for project
/modelSwitch model (saved as your default for new sessions)
/effortSet effort (low–xhigh, max, auto); /effort ultracode toggles ultracode
/memoryEdit CLAUDE.md files and manage auto memory
/usageSession cost, plan limits, and stats (/cost and /stats are aliases)
/doctorRun a setup checkup and fix problems (alias: /checkup)
/configOpen Settings (alias: /settings)
/permissionsManage allow, ask, and deny rules
/bugReport a bug or share your conversation (alias: /share)

File Commands

CommandDescription
@<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

CommandDescription
/code-reviewReview the current diff, or a PR number, branch, or path (--fix, --comment, ultra)
/reviewAlias of /code-review (since v2.1.223)
/security-reviewCheck your branch’s changes for security vulnerabilities
/diffReview 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

PatternMatches
ReadAll 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

ModelBest ForSpeed
Fable 5.1Hardest problems, long autonomous tasksSlower
Opus 5.5Default for most work, complex reasoningFast; /fast for up to 2.5x
Sonnet 5.5Everyday coding at lower costFast
Haiku 5.5Quick tasks, exploration, subagentsFastest

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 /fast when 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

LocationScopeUse Case
~/.claude/CLAUDE.mdGlobalPersonal preferences
./CLAUDE.mdProjectTeam standards
./.claude/CLAUDE.mdProjectTeam standards (hidden)
./CLAUDE.local.mdPersonalIndividual overrides
./AGENTS.mdProjectRead instead when there is no CLAUDE.md (v2.1.277+)
~/.claude/projects/<project>/memory/Per projectAuto 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

ProblemSolution
CLAUDE.md ignoredCheck 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 deniedAdd a rule with /permissions or in the settings.json allow list
High token usageCheck /context, then /compact or /clear
Wrong model/model, or Option+P (Mac) / Alt+P (Win/Linux)
Config not appliedRun 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

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