Claude Code commands cheat sheet
The Claude Code commands, shortcuts and config files you use every day, copied from Anthropic's documentation as of October 2026. Command names are exact; type / in a session to see what your version offers.
Claude Code is Anthropic's coding agent for the terminal. It ships new commands often, so this sheet of Claude Code commands, flags and shortcuts sticks to what Anthropic's documentation lists as of October 2026 and quotes names exactly. Anthropic notes that not every command appears for every user: availability depends on platform, plan and environment. Type / in a session to see your own list.
Start, resume and script
| Command | What it does |
|---|---|
claude | Start an interactive session |
claude "query" | Start a session with a first prompt |
claude -p "query" | Answer once, print, exit (print mode) |
cat file | claude -p "query" | Process piped content |
claude -c | Continue the most recent conversation in this directory |
claude -r "<session>" "query" | Resume a session by ID or name |
claude update | Update to the latest version |
claude doctor | Installation and settings diagnostics without starting a session |
claude mcp | Configure MCP servers |
Flags worth knowing
| Flag | Effect |
|---|---|
--model | Model for this session, by alias (sonnet, opus, haiku, fable) or full name |
--permission-mode | Start in default, acceptEdits, plan, auto, dontAsk or bypassPermissions |
--effort | Effort level: low, medium, high, xhigh, max or ultracode, depending on the model |
--add-dir | Give Claude access to another working directory |
--allowedTools | Tools that run without a permission prompt |
--append-system-prompt | Add text to the end of the default system prompt |
--system-prompt | Replace the whole system prompt |
--output-format | Print-mode output: text, json or stream-json |
--max-turns | Cap agentic turns in print mode |
--dangerously-skip-permissions | Same as --permission-mode bypassPermissions. Anthropic's docs reserve it for isolated containers and VMs |
Slash commands
A command is recognized only at the start of a message; text after it becomes its arguments. <arg> is required, [arg] optional.
| Command | What it does |
|---|---|
/init | Generate a starter CLAUDE.md for the project |
/memory | Edit CLAUDE.md files and manage auto memory |
/clear [name] | New conversation with empty context |
/compact [instructions] | Summarize the conversation to free context |
/context | Show context usage as a grid |
/model [model] | Switch model and save it as default |
/effort | Set the effort level |
/plan [description] | Enter plan mode |
/permissions | Manage allow, ask and deny rules |
/hooks | View hook configurations |
/mcp | Manage MCP connections and OAuth |
/skills | List available skills |
/agents | Print a reminder on how to create and manage subagents |
/resume [session] | Resume a conversation or open the picker |
/rewind | Roll code and conversation back to a checkpoint (aliases /checkpoint, /undo) |
/diff | Review changes in the working tree |
/code-review | Review the current diff for bugs (alias /review) |
/security-review | Check branch changes for vulnerabilities |
/btw [question] | Side question that stays out of the conversation |
/usage | Session cost, plan limits, stats (aliases /cost, /stats) |
/config | Open settings |
/doctor | Setup checkup that can fix issues |
/export [filename] | Export the conversation as text |
/help | Show help and commands |
/exit | Exit (alias /quit) |
Ready-made prompts for coding sessions are in Claude Code prompts.
Keyboard shortcuts and input prefixes
| Key | Action |
|---|---|
Esc | Stop Claude mid-turn; work so far is kept |
Esc + Esc | Clear the draft, or open rewind when input is empty |
Shift+Tab | Cycle permission modes |
Ctrl+C | Interrupt, or clear input; press again to exit |
Ctrl+R | Search command history |
Ctrl+O | Toggle the transcript viewer |
Ctrl+B | Send running tasks to the background |
Ctrl+T | Show or hide Claude's task checklist |
Ctrl+G | Edit the prompt in your text editor |
Option+P / Alt+P | Switch model |
\ + Enter or Ctrl+J | New line in the prompt |
! at start | Shell mode: run a command and add its output |
@ | File path autocomplete |
? on empty input | Shortcut help panel |
Permission modes
| Mode | Runs without asking | Use for |
|---|---|---|
default (Manual) | Reads only | Sensitive work |
acceptEdits | Reads, file edits, common filesystem commands | Iterating on code you review |
plan | Reads, plus classifier-approved commands where auto mode is available | Exploring before changing |
auto | Everything, with a background classifier check | Long tasks |
dontAsk | Pre-approved tools; anything else is denied | CI and scripts |
bypassPermissions | Everything | Isolated containers and VMs only |
Deny rules block in every mode. Rules use patterns such as Bash(npm run *) or Read(./.env) and live under permissions in settings.json, or are managed with /permissions.
CLAUDE.md
CLAUDE.md holds instructions Claude reads at the start of every session. Anthropic treats it as context that Claude follows. To block an action outright, use a hook.
| Scope | Location |
|---|---|
| User, all projects | ~/.claude/CLAUDE.md |
| Project, shared via git | ./CLAUDE.md or ./.claude/CLAUDE.md |
| Local, personal | ./CLAUDE.local.md (add to .gitignore) |
| Path-scoped rules | .claude/rules/*.md |
- Import other files with
@path/to/file, up to four hops deep. - Anthropic suggests keeping each CLAUDE.md under 200 lines.
- Claude Code can also read a repository's
AGENTS.md.
# Project: [name] ## Commands - Build: [build command] - Test: [test command, and how to run one test] - Lint: [lint command] ## Conventions - [language version, style rule, naming rule] - [where new files go] ## Never - [action Claude must not take, and why]
CLAUDE.md is the project-level cousin of a system prompt; the system prompts guide compares them, and context engineering covers what belongs in each.
Hooks, skills and MCP
Hooks
Shell commands that run on events, set under hooks in a settings file and listed with /hooks. A hook that exits with code 2 blocks the action.
| Event | Fires |
|---|---|
SessionStart | Session begins or resumes |
UserPromptSubmit | Before Claude processes a prompt |
PreToolUse | Before a tool call; can block it |
PostToolUse | After a tool call succeeds |
Notification | Claude Code sends a notification |
Stop | Claude finishes responding |
Skills
A skill is a SKILL.md file in ~/.claude/skills/<name>/ (personal) or .claude/skills/<name>/ (project). It becomes /name, and Claude can also load it when relevant. Custom commands in .claude/commands/ still work and have been merged into skills. Key front-matter fields: description, disable-model-invocation, allowed-tools. More in Claude Skills explained and the Claude Skills library.
MCP
| Command | What it does |
|---|---|
claude mcp add --transport http <name> <url> | Add a remote server |
claude mcp add <name> -- <command> | Add a local stdio server |
claude mcp list | List servers |
claude mcp get <name> | Check one server's status |
--scope project | Share via .mcp.json in the repo (default scope is local) |
If you are weighing Claude Code against other coding agents, see Claude Code vs Cursor and Claude Code vs Codex.
FAQ
How do I see every Claude Code command?
Type / in a session, or run /help. Anthropic's commands reference lists all of them, marking which are bundled skills.
How do I switch permission modes?
Press Shift+Tab in the CLI, or start with --permission-mode.
Where does CLAUDE.md go?
Project instructions go in ./CLAUDE.md or ./.claude/CLAUDE.md; personal ones for all projects go in ~/.claude/CLAUDE.md. /init writes a starter file.
Do custom slash commands still work?
Yes. Files in .claude/commands/ keep working, and a skill at .claude/skills/<name>/SKILL.md creates the same /name command.
Sources
- CLI reference — Claude Code Docs, accessed October 2026
- Commands — Claude Code Docs, accessed October 2026
- Interactive mode — Claude Code Docs, accessed October 2026
- Choose a permission mode — Claude Code Docs, accessed October 2026
- Configure permissions — Claude Code Docs, accessed October 2026
- How Claude remembers your project — Claude Code Docs, accessed October 2026
- Automate actions with hooks — Claude Code Docs, accessed October 2026
- Extend Claude with skills — Claude Code Docs, accessed October 2026
- Connect Claude Code to tools via MCP — Claude Code Docs, accessed October 2026