Remote OpenClaw Blog
Claude Code Commands: The Complete Cheat Sheet (2026)
9 min read ·
Claude Code commands come in two layers: slash commands you type inside a session, like /model, /compact, and /permissions, and CLI commands and flags you pass at launch, like claude -p or --permission-mode plan. This cheat sheet covers both layers plus keyboard shortcuts and custom commands, verified against the official commands reference as of July 2026.
Slash Commands Cheat Sheet
Slash commands control Claude Code from inside a session, and a command is only recognized at the start of your message, with everything after the name passed as arguments. Availability varies slightly by platform and plan, so the fastest ground truth is typing / and filtering. These are the commands that cover 95% of real usage, grouped by what you are doing:
| Category | Command | What it does |
|---|---|---|
| Session and context | /clear | Start a new conversation with empty context (aliases: /new, /reset) |
/compact [instructions] | Summarize the conversation to free context, optionally with focus instructions | |
/context | Visualize what is filling the context window as a colored grid | |
/resume [session] | Resume a conversation by ID or name, or open the picker | |
/rewind | Roll code and conversation back to a checkpoint (aliases: /undo, /checkpoint) | |
/branch [name] | Fork the conversation at this point and try a different direction | |
/export [filename] | Export the conversation as plain text | |
/btw <question> | Ask a side question without adding it to the conversation history | |
| Models and modes | /model [model] | Switch the model and save it as your default |
/effort [level] | Set reasoning effort: low, medium, high, xhigh, max, or ultracode | |
/plan [description] | Enter plan mode, optionally starting on a task immediately | |
/fast [on|off] | Toggle fast mode | |
/config [key=value] | Open settings, or set a key directly like /config theme=dark | |
| Project setup | /init | Generate a starter CLAUDE.md for the project |
/memory | Edit CLAUDE.md memory files and manage auto-memory | |
/permissions | Manage allow, ask, and deny rules for tools | |
/mcp | Manage MCP server connections and OAuth | |
/hooks | View configured lifecycle hooks by event | |
/plugin | Install and manage plugins | |
/sandbox | Toggle OS-level sandboxing for Bash commands | |
| Review and shipping | /diff | Open an interactive diff viewer for uncommitted changes |
/code-review [--fix] | Review the current diff for bugs and cleanups; ultra runs a cloud review | |
/review [PR] | Review a GitHub pull request by number | |
/security-review | Analyze pending changes for security vulnerabilities | |
/simplify [target] | Cleanup-only review that applies fixes | |
| Parallel work | /background | Detach the session to run as a background agent (alias: /bg) |
/tasks | View everything running in the background | |
/batch <instruction> | Decompose a large change and run units in parallel worktrees | |
/fork <directive> | Spawn a background subagent that inherits the full conversation | |
| Account and diagnostics | /login / /logout | Sign in or out of your Anthropic account |
/usage | Show session cost, plan limits, and stats (aliases: /cost, /stats) | |
/status | Show version, model, account, and connectivity | |
/doctor | Diagnose installation and settings issues; press f to auto-fix | |
/feedback | Report a bug with session context attached (alias: /bug) | |
/help | Show help and available commands |
Beyond these, the reference includes specialty commands like /teleport (pull a Claude Code on the web session into your terminal), /remote-control (drive a local session from claude.ai), /schedule (cloud routines), /statusline, /theme, and /powerup (interactive feature lessons). MCP servers can also expose prompts as commands in the form /mcp__server__prompt, covered in our Claude Code MCP guide.
CLI Commands and Flags
The claude binary itself takes commands and flags that control how a session starts, and the official CLI reference warns that claude --help does not list every flag. The core commands:
| Command | What it does |
|---|---|
claude | Start an interactive session |
claude "query" | Start interactive with an initial prompt |
claude -p "query" | Print mode: answer and exit, for scripts and CI |
cat file | claude -p "query" | Process piped content headlessly |
claude -c | Continue the most recent conversation in this directory |
claude -r "name" "query" | Resume a session by ID or name |
claude update | Update to the latest version |
claude mcp | Configure MCP servers from the shell |
claude agents | Open agent view to monitor background sessions |
claude setup-token | Generate a long-lived OAuth token for CI |
And the flags you will actually reach for:
| Flag | What it does |
|---|---|
--model | Set the session model by alias (sonnet, opus, haiku, fable) or full name |
--permission-mode | Start in default, acceptEdits, plan, auto, dontAsk, or bypassPermissions |
--dangerously-skip-permissions | Skip permission prompts entirely; see our YOLO mode guide |
--allowedTools | Pre-approve tools, e.g. "Bash(git log *)" "Read" |
--disallowedTools | Deny rules, e.g. "Bash(rm *)" or bare "Edit" to remove the tool |
--add-dir | Grant file access to additional directories |
--output-format | Print-mode output: text, json, or stream-json |
--max-turns / --max-budget-usd | Cap agentic turns or API spend in print mode |
--worktree, -w | Start in an isolated git worktree |
--bg | Start the session as a background agent and return immediately |
--resume --fork-session | Resume but branch into a new session ID |
--append-system-prompt | Add custom text to the default system prompt |
--mcp-config | Load MCP servers from a JSON file for this session |
--verbose | Show full turn-by-turn output |
--version, -v | Print the version number |
Keyboard Shortcuts
Keyboard shortcuts in Claude Code cover interruption, mode switching, history, and background tasks, per the interactive mode reference. The ones worth memorizing:
| Shortcut | What it does |
|---|---|
Esc | Interrupt Claude mid-turn; work done so far is kept |
Esc Esc | Clear the input draft, or open the rewind menu when input is empty |
Shift+Tab | Cycle permission modes: default, acceptEdits, plan, plus any enabled extras |
Ctrl+C | Interrupt, or clear input; press twice to exit |
Ctrl+D | Exit the session |
Ctrl+O | Toggle the transcript viewer with detailed tool usage |
Ctrl+R | Reverse-search command history |
Ctrl+B | Move a running Bash command or agent to the background (twice under tmux) |
Ctrl+T | Toggle Claude's task checklist |
Ctrl+L | Redraw the screen if the display garbles |
Ctrl+G | Edit your prompt in your default text editor |
! at start | Shell mode: run a command directly and add its output to context |
@ | File path autocomplete |
\ + Enter or Ctrl+J | Multiline input in any terminal |
Hold Space | Voice dictation, where enabled |
Vim-style editing is available via /config then Editor mode, with NORMAL, INSERT, and VISUAL modes, text objects, and most core motions. On macOS, Option-key shortcuts like Alt+P (switch model) require setting Option as Meta in your terminal profile first.
Custom Slash Commands
Custom slash commands are Markdown files: a file at .claude/commands/deploy.md creates a /deploy command in that project, and ~/.claude/commands/ does the same across all your projects. As of 2026 the official docs note that custom commands have been merged into skills: a skill at .claude/skills/deploy/SKILL.md creates the same /deploy and works the same way, while adding optional frontmatter and supporting files. Existing .claude/commands/ files keep working.
Arguments come in through string substitutions. $ARGUMENTS expands to everything typed after the command name, $0 and $1 grab positional arguments, and frontmatter fields like argument-hint, allowed-tools, and disable-model-invocation control autocomplete, permissions, and whether Claude can trigger the command on its own. A working example:
# .claude/skills/fix-issue/SKILL.md
---
name: fix-issue
description: Fix a GitHub issue by number
argument-hint: [issue-number]
---
Fix GitHub issue $ARGUMENTS following our coding standards.
1. Read the issue description
2. Understand the requirements
3. Implement the fix and run the tests
Invoke it with /fix-issue 123. If the file contains no $ARGUMENTS placeholder, Claude Code appends ARGUMENTS: <your input> to the content so nothing is lost. Plugins can ship commands too, namespaced as /plugin-name:command; our Claude plugins guide covers that distribution path, and Claude Code templates collects ready-made starting points.
Removed Commands and Gotchas
Several commands that still appear in older cheat sheets no longer exist, which is the main way command references rot. As of mid-2026: /vim was removed in v2.1.92 (toggle Editor mode via /config instead), /pr-comments was removed in v2.1.91 (just ask Claude to view PR comments), and /agents no longer opens an interactive builder as of v2.1.198 (ask Claude to create subagents, or edit .claude/agents/ directly). /ultrareview survives only as an alias for /code-review ultra.
Two more gotchas: not every command appears for every user, since some depend on plan and platform (/upgrade is Pro and Max only, /desktop needs macOS or Windows with a subscription), and commands are only recognized at the start of a message. When in doubt, /help and the official reference are the ground truth, and our Claude Code guide covers the surrounding workflow decisions.
Related Guides
- Claude Code Hooks: Setup, Events, and Real Examples
- Claude Code YOLO Mode: What It Is and When to Use It
- Claude Code Best Practices in 2026
- Claude Code MCP: How to Add and Manage MCP Servers
Go deeper
The operator playbooks
Production-ready PDF guides for OpenClaw and Hermes Agent — $19.99 each.
Skills for this topic
Browse all skills →Frequently Asked Questions
What are the main Claude Code commands?
The core slash commands are /clear (new conversation), /compact (free up context), /model (switch models), /plan (plan mode), /resume (reopen sessions), /permissions (tool rules), /mcp (server management), and /usage (cost and limits). From the shell, claude , claude -p , claude -c , and claude -r cover starting, scripting, continuing, and resuming.
How do I see all slash commands in Claude Code?
Type / at the start of the prompt to open the command menu, then keep typing letters to filter it. The menu shows built-in commands, bundled and custom skills, plugin commands, and MCP prompts. /help shows the same surface, and availability varies by plan and platform.
How do I create a custom slash command in Claude Code?
Create a Markdown file at .claude/commands/name.md in your project or ~/.claude/commands/name.md for all projects; the filename becomes the command. Use $ARGUMENTS in the body to receive whatever you type after the command. The newer equivalent is a skill at .claude/skills/name/SKILL.md , which adds frontmatter and supporting files.
What is the difference between slash commands and CLI flags?
Slash commands run inside an active session and change it live, like /model or /compact . CLI flags are set at launch and shape the whole session, like --permission-mode plan or --model sonnet . Many settings exist in both layers; the flag sets the starting state and the slash command changes it mid-session.

