Claude Code Cheat Sheet
Everything you need in one place. Built for educators, makers, and tinkerers who want to get the absolute most out of Claude Code. Grab a tip, build something great.
Keyboard Shortcuts
Essential
| Mac | Windows | Action |
|---|---|---|
| ↵ Return | Enter | Send message / submit |
| ⎋ Esc | Esc | Interrupt / stop generation |
| ⎋ ⎋ | Esc Esc | Open rewind menu — go back in conversation or code |
| ⌃C | Ctrl+C | Cancel current operation (hard stop) |
| ⌃D | Ctrl+D | Exit Claude Code |
| ⇧ Tab | Shift+Tab | Cycle modes: Normal → Auto-Accept → Plan |
Navigation
| Mac | Windows | Action |
|---|---|---|
| ⌃R | Ctrl+R | Search command history |
| ⌃T | Ctrl+T | Toggle task list |
| ⌃O | Ctrl+O | Toggle verbose transcript |
| ⌃G | Ctrl+G | Open external editor (write long prompts) |
| ⌃V | Ctrl+V | Paste image — screenshots, diagrams |
| ⌃S | Ctrl+S | Stash current prompt (save for later) |
| ⌘P | Alt+P | Open model picker — switch models quickly |
| ⌘T | Alt+T | Toggle extended thinking |
Editing (Bash-style)
| Mac | Windows | Action |
|---|---|---|
| ⌃A / ⌃E | Ctrl+A / Ctrl+E | Start / end of line |
| ⌥F / ⌥B | Alt+F / Alt+B | Word forward / back |
| ⌃W | Ctrl+W | Delete previous word |
| \ + ↵ | \ + Enter | New line without sending |
Background Tasks
| Mac | Windows | Action |
|---|---|---|
| ⌃B | Ctrl+B | Send running task to background |
Run
/terminal-setup to enable ⇧ ↵ for multi-line input in iTerm2 & VS Code. Run /keybindings to customize all shortcuts.
Slash Commands
Session Control
| Command | Action |
|---|---|
/clear | Reset conversation history (fresh start) |
/compact [hint] | Compress context to save tokens. Optional hint for what to keep. |
/rewind | Go back in conversation AND/OR code changes |
/export [file] | Export conversation to file or clipboard |
/cost | Show session cost & token usage |
/usage | Show plan usage & rate limits |
/context | Token consumption visualization |
Configuration
| Command | Action |
|---|---|
/config | Open settings panel |
/model | Switch between Sonnet / Opus / Haiku |
/permissions | View & update tool permissions |
/keybindings | Open keyboard shortcuts config file |
/vim | Toggle vim mode for input |
/terminal-setup | Setup Shift+Enter for multi-line input |
Development
| Command | Action |
|---|---|
/init | Create CLAUDE.md for your project — do this first! |
/memory | View & edit CLAUDE.md project memory |
/review | Code review analysis |
/doctor | Environment diagnostics & health check |
/agents | Manage sub-agents |
/mcp | Manage MCP servers |
Advanced
| Command | Action |
|---|---|
/insights | Generate HTML usage report New |
/pr_comments | View GitHub PR feedback |
/install-github-app | Setup automated PR reviews |
/tasks | Persistent task list management |
/teleport | Transfer session between web ↔ local |
CLI Launch Flags
Starting Sessions
| Flag | Action |
|---|---|
claude | Start interactive session |
claude "query" | Start with an initial prompt |
claude -p "query" | Print mode — answer & exit (for scripting) |
claude -c | Continue last conversation |
claude -r "name" | Resume specific session by name or ID |
claude -w name | Start in isolated git worktree |
Model & Behavior
| Flag | Action |
|---|---|
--model sonnet | Use Sonnet (fast, cheap) |
--model opus | Use Opus (smartest) |
--agent my-agent | Use a specific sub-agent |
--permission-mode plan | Start in plan mode |
--max-turns N | Limit conversation turns |
--max-budget-usd N | Set max spend limit |
Context & Directories
| Flag | Action |
|---|---|
--add-dir ../path | Add extra directories to context |
--chrome | Enable browser integration |
--verbose | Show detailed logging |
Permissions
| Flag | Action |
|---|---|
--allowedTools | Whitelist specific tools |
--disallowedTools | Block specific tools |
--tools "Bash,Edit" | Restrict to only these tools |
Output Formats (for -p mode)
| Flag | Action |
|---|---|
--output-format text | Plain text (default) |
--output-format json | Structured JSON |
--output-format stream-json | Real-time streaming JSON |
Pipe data in!
git diff | claude -p "review this" or cat error.log | claude -p "explain"
The Big 5 — Claude Code Extension System
01
CLAUDE.md — Project Memory
What
A markdown file Claude reads every session. Your project's "brain dump" — coding style, architecture, common commands, conventions.
Where
.claude/CLAUDE.md (project) or ~/.claude/CLAUDE.md (global)Create
Run
/init in your project — Claude generates it for you02
Custom Slash Commands
What
Your own /commands. Markdown files with prompts that YOU invoke. Like prompt templates.
Where
.claude/commands/ (project) or ~/.claude/commands/ (global)Use
Filename = command name.
review.md → type /project:review03
Skills — Auto-Invoked Knowledge
What
Like commands, but Claude decides when to use them automatically. You DON'T invoke them — Claude detects when they're relevant.
Where
.claude/skills/ with a SKILL.md inside each skill folderUse
Just work on your project — Claude picks up relevant skills from context
04
Sub-Agents — Specialized Helpers
What
Separate Claude instances with their own context & role. Like team members: reviewer, debugger, architect, etc.
Where
.claude/agents/ (markdown files with YAML metadata)Invoke
/agents to manage, or just say "Use the reviewer agent"CLI
--agent my-agent or --agents '{json}'05
MCP Servers — External Tool Connections
What
Connect Claude to external tools: GitHub, Notion, databases, APIs, browsers, etc.
Setup
claude mcp add <name> <command>List
claude mcp listConfig
--mcp-config ./mcp.json at launch+
Plugins — Community Extensions
What
Bundles of commands, skills, hooks & more from the community
Browse
/plugin to browse, install, enable, disableDir
--plugin-dir ./my-plugins for local pluginsHow They Differ
Custom Commands→YOU invoke them
vs
Skills→CLAUDE invokes them
vs
Sub-Agents→Separate AI instances
vs
MCP→External tool connections
Permission Modes
Normal
Claude asks permission for every tool use — read, write, bash, etc.
Auto-Accept
Claude runs tools WITHOUT asking. Faster but less control. Good for trusted tasks.
Plan Mode
Claude ONLY reads & plans. Won't write or run anything. Review first, then switch to Normal to execute.
Best workflow: Start in Plan Mode to explore & understand the problem. Review Claude's plan. Switch to Normal/Auto-Accept to implement.
Cycle through modes with Shift+Tab → Normal → Auto-Accept → Plan → Normal…
Hooks — Event Automation
| Hook | Description |
|---|---|
PreToolUse | Runs BEFORE Claude uses a tool — validate, block, or modify |
PostToolUse | Runs AFTER a tool — check results, auto-format, lint |
UserPromptSubmit | Before your message is processed |
Stop | When Claude finishes its response |
SessionStart | When a session begins |
SessionEnd | When a session ends |
PreCompact | Before context compression |
Notification | When Claude sends a notification |
Auto-run
prettier after every file edit, or block writes to .env files. Configure in your settings JSON.
Input Superpowers
| Feature | Description |
|---|---|
@ mention | Type @ to reference files & folders. Claude reads them into context. |
! prefix | Type ! to run shell commands inline. E.g., ! git status |
| Paste images | Ctrl+V to paste screenshots, diagrams, error images directly |
| Pipe input | cat file.py | claude -p "explain" — feed data directly |
| Multi-dir | claude --add-dir ../api ../web — work across multiple projects |
| Worktrees | claude -w feature — isolated git branch + Claude session |
Pro tip: Use
@ references instead of copy-pasting file contents. It's smarter with context and uses fewer tokens.
Configuration
Settings Priority (highest → lowest)
| Level | Location |
|---|---|
| Enterprise | /etc/claude-code/managed-settings.json |
| Project Local | .claude/settings.local.json (your personal project settings) |
| Project Shared | .claude/settings.json (committed to git, shared with team) |
| User Global | ~/.claude/settings.json (your defaults) |
Config CLI
| Command | Action |
|---|---|
claude config list | Show all settings |
claude config get key | Check a value |
claude config set key value | Change a value |
claude config add key value | Add to array |
Allow git commands without asking: add
"Bash(git:*)" to your allowedTools in settings.
File Structure Map
Project Level (.claude/)
| File / Dir | Purpose |
|---|---|
CLAUDE.md | Project memory — conventions, architecture, commands |
settings.json | Shared project settings (committed to git) |
settings.local.json | Your personal settings (gitignored) |
commands/ | Project slash commands (*.md files) |
skills/ | Project skills (folders with SKILL.md) |
agents/ | Project sub-agents (*.md files) |
Global Level (~/.claude/)
| File / Dir | Purpose |
|---|---|
CLAUDE.md | Global memory (applies to ALL projects) |
settings.json | Global settings |
commands/ | Personal global commands |
skills/ | Personal global skills |
keybindings.json | Custom keyboard shortcuts |
Rewind & Checkpoints
| Key / Command | Action |
|---|---|
| Esc Esc | Open rewind menu anywhere |
/rewind | Same but typed as a command |
Rewind Options
| Option | Description |
|---|---|
| Conversation | Go back in chat only. Code stays as-is. |
| Code | Restore files only. Conversation stays. |
| Full Rewind | Restore both conversation AND code to a point. |
Bash side-effects (database changes, API calls, deleted files via
rm) can't be rewound. Checkpoints only track file edits by Claude. Use Git for permanent safety.
Pro Workflow
Starting a New Project
cd project && claude → /init → Edit CLAUDE.md → Code!
The Plan → Execute Pattern
Shift+Tab → Plan Mode → Describe what you want → Review Claude's plan → Shift+Tab → Normal/Auto → Execute
Saving Money
| Strategy | Why |
|---|---|
Use /compact | When context gets big, compress it. Saves tokens dramatically. |
Use /clear | Between unrelated tasks. Don't carry irrelevant context. |
| Use Sonnet | For routine tasks. Save Opus for complex architecture decisions. |
Use @ refs | Instead of pasting code — smarter context management. |
Debugging Like a Pro
| Strategy | Why |
|---|---|
| Paste errors | Copy-paste the full error message. Claude parses stack traces brilliantly. |
| Paste screenshots | Ctrl+V a screenshot of the bug. Claude sees it. |
| Pipe logs | cat error.log | claude -p "what's wrong?" |
/doctor | If something feels broken, run this first. |
Parallel Development
| Strategy | How |
|---|---|
| Worktrees | claude -w feature-auth — isolated branch + session |
| Multiple dirs | --add-dir ../api ../web — work across repos |
| Background | Ctrl+B sends a task to background so you can start another |
| Agent Teams | Multiple Claude instances collaborating (experimental) New |
Create Custom Commands
Setup Steps
| Step | Action |
|---|---|
| 1. Create file | .claude/commands/review.md |
| 2. Write prompt | The markdown content IS the prompt Claude will use |
| 3. Use it | Type /project:review in Claude Code |
Optional YAML Frontmatter
| Key | Purpose |
|---|---|
argument-hint | Placeholder text for argument input |
description | Shows in /help listing |
allowed-tools | Restrict what tools the command can use |
model | Force a specific model for this command |
Variable: $ARGUMENTS
Use $ARGUMENTS in your markdown — it gets replaced with whatever you type after the command.
/project:review src/auth.ts → $ARGUMENTS = "src/auth.ts"
Quick Reference — Most Used Combos
Daily Essentials
| What | How |
|---|---|
| Start project | cd project && claude |
| Continue where I left off | claude -c |
| Quick question, no session | claude -p "how do I..." |
| Review my changes | git diff | claude -p "review" |
| Explain error | cat error.log | claude -p "explain" |
| Check cost | Type /cost anytime |
| Undo mistake | Esc Esc → rewind |
Power Moves
| What | How |
|---|---|
| Parallel sessions | claude -w feature-a + claude -w feature-b |
| Custom reviewer agent | Create .claude/agents/reviewer.md |
| Auto-format on edit | PostToolUse hook → run prettier |
| Budget limit | claude -p --max-budget-usd 2 "query" |
| Scripted automation | claude -p --output-format json "query" | jq |