简繁EN
← ToolsTools · Guide

A Claude Code Command Cheat Sheet

Slash commands, shortcuts, input prefixes and launch flags, grouped by when you need them, plus a few habits for beginners.

Last updated
Reading3 min read
Tags#Claude Code

Claude Code is Anthropic’s AI assistant for the terminal. I can’t write code, yet I built this site with it. Here are the commands I use, grouped by situation.

Slash commands

Type / in the prompt to open the command list.

Everyday

Command What it does
/help Show help and every available command
/clear Start a new conversation (use it between tasks); the old one is kept and /resume brings it back
/compact Compress the conversation history to save context
/resume Resume an earlier conversation
/rewind Go back to an earlier step, including undoing code edits
/exit Quit Claude Code

Settings and models

Command What it does
/model Switch model (Fable / Opus / Sonnet / Haiku)
/fast Toggle fast mode
/config Open settings (theme, default model and more)
/permissions Choose which actions no longer need your approval
/statusline Customize the status line
/terminal-setup Set up the new-line shortcut for your terminal
/login Sign in; /logout signs out

Projects and memory

Command What it does
/init Generate a CLAUDE.md guide for the current project
/memory Edit memory files so Claude remembers your preferences
/add-dir Give Claude access to another folder
/context See how much context is in use

Usage and diagnostics

Command What it does
/usage Session cost, plan usage and activity stats (/cost and /stats also work)
/status Account, model and version details
/doctor Check the installation for problems
/feedback Send feedback or report a bug to Anthropic
/bug Report a bug or share the conversation
/export Export the conversation

Advanced

Command What it does
/mcp Manage MCP servers (connections to outside tools)
/hooks View your configured hooks (hooks live in settings.json)
/plugin Install and manage plugins
/tasks See background tasks
/artifacts List the web Artifacts you have published
/ide Connect to an editor such as VS Code

Built-in skills

Command What it does
/code-review Review code changes for bugs
/simplify Tidy up and simplify code
/security-review Check for security issues
/loop 5m task Repeat a task on an interval
/fewer-permission-prompts Cut down on permission prompts automatically

Keyboard shortcuts

Keys What it does
Esc Interrupt what Claude is doing
Esc Esc Press twice to open the rewind menu (same as /rewind) and roll back the conversation or code
Shift + Tab Cycle modes: normal → auto-accept edits → plan mode (→ auto mode, once it’s enabled for you)
↑ ↓ Browse what you typed before
Ctrl + R Search what you typed before
\ + Enter New line in the prompt
Ctrl + J New line in the prompt, works in any terminal
Ctrl + G Write a long prompt in an external editor
Ctrl + B Send a running task to the background
Ctrl + C Cancel input; press twice to quit
Ctrl + V Paste an image, such as a screenshot (Ctrl on a Mac too, not ⌘)

Input prefixes

Prefix What it does Example
@ Reference a file or folder @plan.pdf summarize this
! Run a shell command directly ! ls
/ Run a slash command /clear

Launching from the terminal

Before you’re inside Claude Code, run these in the terminal:

claude                  # start an interactive session
claude "question"       # start with a first question
claude -c               # continue the last conversation
claude -r               # pick an earlier conversation to resume
claude -p "question"    # answer once and exit, handy in scripts
claude --model opus     # start with a specific model
claude update           # update to the latest version
claude mcp              # configure MCP servers from the command line

Habits for beginners

  1. Run /clear before a new task so the old conversation doesn’t interfere.
  2. For bigger tasks, press Shift + Tab into plan mode. Claude proposes a plan and waits for your approval.
  3. If Claude heads the wrong way, press Esc, and undo unwanted edits with /rewind.
  4. When a long conversation makes Claude forgetful, run /compact.
  5. Run /init once at the start of a project so Claude gets up to speed quickly every time.

Commands change between versions. For the definitive list, type /help on your own machine, or check the list that pops up when you type /. This page was checked against Claude Code 2.1.304 (2026-10-21).