Foundations
Complete Command Cheatsheet
Every slash command, keyboard shortcut, CLI flag, and hook event in Claude Code. The three commands that alone save 30% on costs are buried in here.
On this page (17 sections)
Most people use about 10% of Claude Code.
They type prompts and hit Enter. That's it. They don't know /compact exists. They don't know you can switch models mid-conversation. They definitely don't know that pressing Escape cancels a running operation without losing any context.
This is everything, in one place.
Slash Commands
Type these directly into the Claude Code prompt.
Session Management
| Command | What it does |
|---|---|
/help | Show all available commands and options |
/clear | Clear conversation history and start fresh |
/compact | Compress context to free up token space (keeps understanding) |
/cost | Show session token usage, cost, and per-model breakdown |
/status | Show current session info (model, permissions, context usage) |
/usage | Show API usage stats for your account |
/quit or /exit | End the session cleanly |
/export | Export conversation as JSON or Markdown |
/rewind | Undo the last turn in conversation |
Configuration
| Command | What it does |
|---|---|
/model | Switch the active model (opus, sonnet, haiku) |
/model opus | Switch to Opus 4.6 (most capable) |
/model sonnet | Switch to Sonnet 4.6 (fast and capable, default) |
/model haiku | Switch to Haiku 4.5 (fastest, cheapest) |
/init | Generate a CLAUDE.md file for your project |
/config | View and edit Claude Code configuration |
/permissions | View and manage tool permissions |
/doctor | Run diagnostics (checks install, auth, MCP health) |
/memory | View or manage Claude's memory about you |
Workflow
| Command | What it does |
|---|---|
/review | Review recent changes for issues |
/plan | Enter plan mode (Claude proposes before doing) |
/agents | List and manage active sub-agents |
/mcp | View connected MCP servers and tools |
/context | Show what's loaded in the context window |
Custom Skills
Any .md file in ~/.claude/skills/ or your project's .claude/skills/ becomes a slash command:
/my-skill # Runs the skill defined in my-skill.md
/commit # If you have a commit skill
/review-pr 123 # Skills can take argumentsKeyboard Shortcuts
The Essentials
| Shortcut | What it does |
|---|---|
| Enter | Send your message |
| Escape | Cancel current operation (safe: keeps context) |
| Escape, Escape | Quick cancel (double-tap for immediate stop) |
| Ctrl+C | Hard cancel / exit if pressed twice |
| Ctrl+L | Clear the screen (keeps conversation) |
| Up arrow | Cycle through previous prompts |
Power User Shortcuts
| Shortcut | What it does |
|---|---|
| Shift+Tab | Toggle plan mode on/off |
| Tab | Accept autocomplete suggestion |
| Ctrl+R | Search through prompt history |
! | Prefix to run a shell command directly (e.g., ! git status) |
\ | Multi-line input mode (type across multiple lines before sending) |
@ | Reference a file or context (e.g., @src/api.ts explain this) |
CLI Flags
These go on the claude command when you start a session.
Starting Sessions
claude # Start interactive session in current directory
claude "prompt here" # Start with an initial prompt
claude -p "prompt" # Pipe mode (non-interactive, for scripts/CI)
claude -c "continue" # Continue the most recent session
claude --resume # Resume last conversation (pick up where you left off)Model & Behavior
claude --model opus # Start with Opus 4.6
claude --model sonnet # Start with Sonnet 4.6 (default)
claude --model haiku # Start with Haiku 4.5
claude --verbose # Show tool calls and internal reasoning
claude --bare # Minimal output (for scripted calls)Context & Files
claude -r "system prompt" # Add a system prompt / reasoning instruction
claude @file.ts # Load a file into context at startThe --resume flag is criminally underrated. Closed your terminal by accident? claude --resume picks up exactly where you left off. No lost context.
Hook Events
Hooks are shell commands that fire automatically during Claude Code's lifecycle. You configure them in settings.json:
| Event | When it fires |
|---|---|
PreToolUse | Before any tool call (Read, Write, Bash, etc.) |
PostToolUse | After a tool call completes |
SessionStart | When a new session begins |
SessionEnd | When a session ends |
Example: auto-format code after every Write:
{
"hooks": {
"PostToolUse": [{
"matcher": "Write",
"command": "prettier --write $FILE_PATH"
}]
}
}Learn more in the Hooks guide.
The Commands People Sleep On
/compact is a lifesaver. Long session getting sluggish? Context window filling up? /compact compresses your conversation while preserving the important context. Use it before Claude starts forgetting things, not after. I run it every 30-40 minutes during long sessions.
/model for cost control. Start complex tasks with Opus, then switch to Haiku for simple follow-ups. "Fix the typo I just introduced" doesn't need the most expensive model. You can switch mid-conversation without losing context.
/cost for awareness. Check it every 30 minutes during long sessions. Shows per-model and cache-hit breakdown so you know exactly where your tokens are going. Most people are surprised by the breakdown.
/rewind is your undo button. Sent Claude Code in the wrong direction? /rewind takes you back one turn. Way more useful than /clear, which nukes everything.
Escape is not Ctrl+C. Escape gracefully stops the current operation. Claude Code keeps your conversation and any partial work. Ctrl+C is the hard kill. Use it only when things are truly stuck. The difference matters.
! for quick shell commands. Need to check git status without leaving the Claude Code session? Just type ! git status. The output lands right in your conversation, and Claude Code can reference it.
Headless & CI Mode
Run Claude Code in automated pipelines:
# Pipe mode for CI/CD
claude -p "run tests and report failures" | tee test-output.txt
# Headless with specific model
claude -p --model haiku "lint all TypeScript files"
# Chain with other tools
git diff | claude -p "review this diff for bugs"Quick Reference Card
── Session ─────────────────────────────────────
/help /clear /compact /cost /status /usage
/quit /export /rewind
── Config ──────────────────────────────────────
/init /model /config /permissions /doctor
/memory /context
── Workflow ────────────────────────────────────
/review /plan /agents /mcp
── Keyboard ────────────────────────────────────
Escape (cancel) Shift+Tab (plan) Tab (complete)
Up (history) Ctrl+R (search) ! (shell)
\ (multi-line) @ (file ref)
── CLI ─────────────────────────────────────────
-p (pipe) -c (continue) --resume --verbose
--model --bare -r (reasoning)Print this. Tape it to your monitor. You'll reference it more than you think.
New guides, when they ship
One email, roughly weekly. CLAUDE.md templates, workflows I actually use, and the cut-for-length stuff that does not make the public guides. One-click unsubscribe.
Or follow on Substack