Craig

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
MacWindowsAction
↵ ReturnEnterSend message / submit
⎋ EscEscInterrupt / stop generation
Esc EscOpen rewind menu — go back in conversation or code
⌃CCtrl+CCancel current operation (hard stop)
⌃DCtrl+DExit Claude Code
⇧ TabShift+TabCycle modes: Normal → Auto-Accept → Plan
Navigation
MacWindowsAction
⌃RCtrl+RSearch command history
⌃TCtrl+TToggle task list
⌃OCtrl+OToggle verbose transcript
⌃GCtrl+GOpen external editor (write long prompts)
⌃VCtrl+VPaste image — screenshots, diagrams
⌃SCtrl+SStash current prompt (save for later)
⌘PAlt+POpen model picker — switch models quickly
⌘TAlt+TToggle extended thinking
Editing (Bash-style)
MacWindowsAction
⌃A / ⌃ECtrl+A / Ctrl+EStart / end of line
⌥F / ⌥BAlt+F / Alt+BWord forward / back
⌃WCtrl+WDelete previous word
\ + \ + EnterNew line without sending
Background Tasks
MacWindowsAction
⌃BCtrl+BSend 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
CommandAction
/clearReset conversation history (fresh start)
/compact [hint]Compress context to save tokens. Optional hint for what to keep.
/rewindGo back in conversation AND/OR code changes
/export [file]Export conversation to file or clipboard
/costShow session cost & token usage
/usageShow plan usage & rate limits
/contextToken consumption visualization
Configuration
CommandAction
/configOpen settings panel
/modelSwitch between Sonnet / Opus / Haiku
/permissionsView & update tool permissions
/keybindingsOpen keyboard shortcuts config file
/vimToggle vim mode for input
/terminal-setupSetup Shift+Enter for multi-line input
Development
CommandAction
/initCreate CLAUDE.md for your project — do this first!
/memoryView & edit CLAUDE.md project memory
/reviewCode review analysis
/doctorEnvironment diagnostics & health check
/agentsManage sub-agents
/mcpManage MCP servers
Advanced
CommandAction
/insightsGenerate HTML usage report New
/pr_commentsView GitHub PR feedback
/install-github-appSetup automated PR reviews
/tasksPersistent task list management
/teleportTransfer session between web ↔ local
🚀

CLI Launch Flags

Starting Sessions
FlagAction
claudeStart interactive session
claude "query"Start with an initial prompt
claude -p "query"Print mode — answer & exit (for scripting)
claude -cContinue last conversation
claude -r "name"Resume specific session by name or ID
claude -w nameStart in isolated git worktree
Model & Behavior
FlagAction
--model sonnetUse Sonnet (fast, cheap)
--model opusUse Opus (smartest)
--agent my-agentUse a specific sub-agent
--permission-mode planStart in plan mode
--max-turns NLimit conversation turns
--max-budget-usd NSet max spend limit
Context & Directories
FlagAction
--add-dir ../pathAdd extra directories to context
--chromeEnable browser integration
--verboseShow detailed logging
Permissions
FlagAction
--allowedToolsWhitelist specific tools
--disallowedToolsBlock specific tools
--tools "Bash,Edit"Restrict to only these tools
Output Formats (for -p mode)
FlagAction
--output-format textPlain text (default)
--output-format jsonStructured JSON
--output-format stream-jsonReal-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 you
02
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:review
03
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 folder
Use
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 list
Config
--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, disable
Dir
--plugin-dir ./my-plugins for local plugins
How They Differ
Custom CommandsYOU invoke them
vs
SkillsCLAUDE invokes them
vs
Sub-AgentsSeparate AI instances
vs
MCPExternal 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

HookDescription
PreToolUseRuns BEFORE Claude uses a tool — validate, block, or modify
PostToolUseRuns AFTER a tool — check results, auto-format, lint
UserPromptSubmitBefore your message is processed
StopWhen Claude finishes its response
SessionStartWhen a session begins
SessionEndWhen a session ends
PreCompactBefore context compression
NotificationWhen Claude sends a notification
💡 Auto-run prettier after every file edit, or block writes to .env files. Configure in your settings JSON.

Input Superpowers

FeatureDescription
@ mentionType @ to reference files & folders. Claude reads them into context.
! prefixType ! to run shell commands inline. E.g., ! git status
Paste imagesCtrl+V to paste screenshots, diagrams, error images directly
Pipe inputcat file.py | claude -p "explain" — feed data directly
Multi-dirclaude --add-dir ../api ../web — work across multiple projects
Worktreesclaude -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)
LevelLocation
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
CommandAction
claude config listShow all settings
claude config get keyCheck a value
claude config set key valueChange a value
claude config add key valueAdd to array
💡 Allow git commands without asking: add "Bash(git:*)" to your allowedTools in settings.
📁

File Structure Map

Project Level (.claude/)
File / DirPurpose
CLAUDE.mdProject memory — conventions, architecture, commands
settings.jsonShared project settings (committed to git)
settings.local.jsonYour 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 / DirPurpose
CLAUDE.mdGlobal memory (applies to ALL projects)
settings.jsonGlobal settings
commands/Personal global commands
skills/Personal global skills
keybindings.jsonCustom keyboard shortcuts

Rewind & Checkpoints

Key / CommandAction
Esc EscOpen rewind menu anywhere
/rewindSame but typed as a command
Rewind Options
OptionDescription
ConversationGo back in chat only. Code stays as-is.
CodeRestore files only. Conversation stays.
Full RewindRestore 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
StrategyWhy
Use /compactWhen context gets big, compress it. Saves tokens dramatically.
Use /clearBetween unrelated tasks. Don't carry irrelevant context.
Use SonnetFor routine tasks. Save Opus for complex architecture decisions.
Use @ refsInstead of pasting code — smarter context management.
Debugging Like a Pro
StrategyWhy
Paste errorsCopy-paste the full error message. Claude parses stack traces brilliantly.
Paste screenshotsCtrl+V a screenshot of the bug. Claude sees it.
Pipe logscat error.log | claude -p "what's wrong?"
/doctorIf something feels broken, run this first.
Parallel Development
StrategyHow
Worktreesclaude -w feature-auth — isolated branch + session
Multiple dirs--add-dir ../api ../web — work across repos
BackgroundCtrl+B sends a task to background so you can start another
Agent TeamsMultiple Claude instances collaborating (experimental) New
🛠️

Create Custom Commands

Setup Steps
StepAction
1. Create file.claude/commands/review.md
2. Write promptThe markdown content IS the prompt Claude will use
3. Use itType /project:review in Claude Code
Optional YAML Frontmatter
KeyPurpose
argument-hintPlaceholder text for argument input
descriptionShows in /help listing
allowed-toolsRestrict what tools the command can use
modelForce 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
WhatHow
Start projectcd project && claude
Continue where I left offclaude -c
Quick question, no sessionclaude -p "how do I..."
Review my changesgit diff | claude -p "review"
Explain errorcat error.log | claude -p "explain"
Check costType /cost anytime
Undo mistakeEsc Esc → rewind
Power Moves
WhatHow
Parallel sessionsclaude -w feature-a + claude -w feature-b
Custom reviewer agentCreate .claude/agents/reviewer.md
Auto-format on editPostToolUse hook → run prettier
Budget limitclaude -p --max-budget-usd 2 "query"
Scripted automationclaude -p --output-format json "query" | jq