Claude Code Cheat Sheet

A quick reference for working with Claude Code and prompt engineering. Verified on Claude Code 2.1.289.

💡 Your system is detected automatically — Mac- and Windows-specific commands are filtered to it. Switch above if you need the other.


⌨️ Hotkeys

Key Action
Ctrl+C Interrupt the current generation
Ctrl+D Exit Claude Code (EOF)
Ctrl+L Clear the screen (history kept)
Ctrl+O Open the multi-line editor
Ctrl+R Search prompt history
Ctrl+G Fuzzy-find files in the project (like fzf)
Ctrl+B Pick from changed git files
Ctrl+F Search the current conversation
Shift+Tab Toggle mode: Plan → Normal → Auto-accept
\+Enter / Ctrl+J New line without sending
Esc+Esc Cancel current input
/ at line start Open slash-command autocomplete
! at line start Run a bash command from the prompt
@filename Add a file/folder to context

🖥️ CLI: launch and flags

claude                          # Interactive mode
claude "request"                # Launch with an initial request
claude -p 'request'             # Pipe mode: response to stdout and exit
claude -c                       # Resume the last session
claude -r <id>                  # Resume session by ID
claude update                   # Update Claude Code

# Useful flags
--model <model>                 # Specify model at launch
--permission-mode plan          # Launch in read-only mode
--worktree / -w                 # Isolated git worktree
--autocompact <auto|tokens>      # Auto-compaction mode; -n = --name
--add-dir <path>                # Add a folder to context
--output-format json|text|stream-json
--max-budget-usd <N>            # Session budget in dollars
--bare                          # Minimal mode: no hooks, LSP, plugin sync, or auto-memory

# Pipe mode — handy for scripts:
cat error.log | claude -p 'explain the error'

📋 Session management

/clear                  # Full context wipe
/compact [topic]        # Compress context, keep the essentials
/context                # Show context fill
/resume                 # List recent sessions to resume
/rename <name>          # Rename the session (handy for /resume)
/branch                 # Create a session branch
/cost                   # Current session cost ($, tokens)
/diff                   # All file changes this session
/copy                   # Copy the last response
/export                 # Export the conversation to Markdown

Decision tree /clear vs /compact:

Situation Command
Context is full (>80%) or the task changed /compact
Context <70% and the task is the same Continue

💡 CLAUDE.md (and the @AGENTS.md it imports) is auto-reloaded after /compact and auto-compact — instructions aren't lost.


⚙️ Settings

/config                         # Open settings.json in the editor
/model <model>                  # Switch model in the session
/fast                           # Fast mode: same model, faster output
/effort low|medium|high         # Analysis depth
/permissions                    # View and configure permissions
/vim                            # Enable vim editing mode
/theme                          # Change color theme