Claude Code
Reference

Slash commands and Vim mode guide for the Claude Code CLI. Every command in one searchable reference.

Slash Command Vim Binding
Quick tips: Prefix any shell command with ! to run it directly (e.g. !git status). Type @ for file path autocomplete. Custom skills appear alongside built-in commands when you type /.
01

Session Management

7 cmds
Clear conversation/clear

Wipes conversation history and frees context window space so you can start fresh without exiting.

alias: /reset

Compact conversation/compact [focus]

Compresses the conversation into a summary to reclaim context space. Optional focus argument guides what gets preserved.

Resume session/resume [session]

Picks up a previous conversation by session ID or name, or opens an interactive picker.

alias: /continue

Fork conversation/fork [name]

Creates a branching copy at the current point to explore a different direction without losing the original.

Rename session/rename [name]

Gives the session a custom name, or auto-generates one from conversation history.

Rewind/rewind

Rolls back conversation and optionally code to a previous checkpoint. Useful for undoing a wrong turn.

alias: /checkpoint

Exit CLI/exit

Closes the Claude Code session and returns you to your shell.

alias: /quit

02

Context & Usage

5 cmds
Context window/context

Displays a colored grid visualization of context window consumption so you know when to compact.

Token cost/cost

Shows token usage breakdown: input tokens, output tokens, and cache hits for the current session.

Plan usage/usage

Displays current plan limits and rate-limit status to see remaining capacity.

Usage stats/stats

Dashboard of daily usage patterns, session history, streaks, and model preferences over time.

Extra usage/extra-usage

Configures overflow usage so Claude keeps working when you hit rate limits instead of stopping.

03

Model & Output

5 cmds
Switch model/model [model]

Switches the active model mid-session (e.g. Opus to Sonnet) and lets you adjust effort level.

Fast mode/fast [on|off]

Toggles fast mode: same model, optimized for faster output at the cost of some thoroughness.

Output style/output-style

Switches between output styles. Deprecated -- use /config instead. Output style is now fixed at session start for better prompt caching.

Voice input/voice

Toggles voice input mode for dictating prompts instead of typing. Shows your dictation language on enable.

Status dialog/status

Opens a status overlay showing session info, model, context usage, and config. Works even while Claude is responding.

04

Configuration

11 cmds
Settings UI/config

Opens the interactive settings UI to configure all Claude Code options in one place.

alias: /settings

Permissions/permissions

Shows and edits which tools run automatically vs. requiring approval each time.

alias: /allowed-tools

Hooks/hooks

Manages shell commands that run automatically in response to tool events (pre/post hooks).

Memory/memory

Opens CLAUDE.md memory files for editing and manages auto-memory settings.

Init project/init

Creates a CLAUDE.md file in the project root with starter instructions tailored to your codebase.

Keybindings/keybindings

Opens keybindings config to customize keyboard shortcuts and add chord bindings.

Status line/statusline

Configures the persistent status bar showing model, context, and live info.

Theme/theme

Changes color theme between light, dark, colorblind-accessible, and ANSI palettes.

Terminal setup/terminal-setup

Configures terminal keybindings for Shift+Enter multi-line input and other shortcuts.

Sandbox/sandbox

Toggles sandboxed execution mode that restricts file system and network access.

Privacy/privacy-settings

View and update data privacy preferences (Pro and Max subscribers).

05

Tools & Integrations

7 cmds
MCP servers/mcp

Manages Model Context Protocol server connections and OAuth for external tool integrations.

Plugins/plugin

Installs, removes, and manages plugins that extend Claude Code with custom capabilities.

Reload plugins/reload-plugins

Hot-reloads all active plugins to pick up code changes without restarting the session.

Skills/skills

Lists all available skills (custom slash commands) configured for your project or globally.

Agents/agents

Manages agent configurations that define specialized sub-agents with their own tools and instructions.

IDE integration/ide

Shows IDE integration status and connects to editors like VS Code or Cursor.

Chrome/chrome

Configures Chrome integration for browser-based workflows and debugging.

06

Code & Review

5 cmds
View diff/diff

Interactive diff viewer showing all uncommitted changes and per-turn diffs.

PR review/review

Comprehensive pull request review checking code quality, correctness, security, and test coverage.

Security review/security-review

Scans pending changes specifically for security vulnerabilities and unsafe patterns.

PR comments/pr-comments [PR]

Fetches and displays all comments from a GitHub pull request in the terminal.

Plan mode/plan

Enters plan mode: Claude explores the codebase and designs an approach for your approval before writing code.

07

Sharing & Account

11 cmds
Copy response/copy

Copies Claude's last response to clipboard, with an interactive picker for multiple code blocks.

Export conversation/export [file]

Exports the full conversation as plain text to clipboard or a specified file.

Remote control/remote-control

Makes your terminal session controllable from claude.ai to switch to the web interface mid-conversation.

alias: /rc

Remote environment/remote-env

Configures the default remote environment for teleporting sessions to cloud dev machines.

Teleport session/teleport

Resumes the current session on a remote cloud environment. Available for claude.ai subscribers.

Desktop app/desktop

Transfers your CLI session to the Claude Code desktop app on macOS or Windows.

alias: /app

Login/login

Signs in to your Anthropic account to authenticate Claude Code.

Logout/logout

Signs out and clears stored credentials from this machine.

Upgrade plan/upgrade

Opens the Anthropic upgrade page to switch to a higher plan tier.

Share passes/passes

Share a free week of Claude Code with friends through a referral link.

08

Miscellaneous

13 cmds
Help/help

Overview of available commands, usage tips, and documentation links.

Diagnostics/doctor

Runs a diagnostic check verifying settings, permissions, and connectivity are healthy.

Debug mode/debug

Toggles debug logging on mid-session for troubleshooting. Debug logs are not written by default.

TODOs/todos

Lists and manages TODO items tracked in the current session.

Feedback/feedback

Submits a bug report or feature request directly to the Claude Code team.

alias: /bug

Release notes/release-notes

Displays the full changelog of recent Claude Code updates.

Insights/insights

Analytical report of usage patterns, productivity metrics, and session trends.

Background tasks/tasks

Lists and manages background tasks like running agents or async shell commands.

Add directory/add-dir <path>

Adds an additional working directory so Claude can access files outside the launch directory.

GitHub app/install-github-app

Sets up the Claude GitHub Actions app for CI/CD integration and automated code review.

Slack app/install-slack-app

Installs the Claude Slack app to interact with Claude from Slack channels.

Stickers/stickers

Order physical Claude Code stickers for your laptop or workspace.

Mobile app/mobile

Displays a QR code to download the Claude mobile app.

aliases: /ios /android


09

Plugins

Guide

Plugins extend Claude Code with custom slash commands, agents, MCP servers, and hooks. They're distributed as directories with a plugin.json manifest.

Install a plugin

Use /plugin to browse the plugin marketplace, or install from a local directory or Git URL. Plugins can also be loaded via --plugin-dir on the CLI.

Plugin structure

A plugin is a directory containing plugin.json (manifest with name, description, version), plus optional commands/, agents/, and hooks/ folders. Each command is a Markdown file with YAML frontmatter.

Hot reload

After editing plugin files, run /reload-plugins to pick up changes without restarting your session. Great for development.

Plugin MCP servers

Plugins can bundle their own MCP servers. If a plugin's server duplicates one you've already configured, the duplicate is automatically suppressed.

Managing plugins

View installed plugins with /plugin. Remove with the plugin menu. Use --plugin-dir (repeatable) to load plugins from custom directories.

Creating a plugin

Use the community /create-plugin command for a guided workflow, or manually create the directory structure. Plugins can include custom agents with their own tools and instructions.

10

Skills (Custom Slash Commands)

Guide

Skills are custom slash commands defined as Markdown files with YAML frontmatter. They appear alongside built-in commands when you type /.

Where to define skills

Skills live in .claude/skills/ directories. Global skills go in ~/.claude/skills/. Project skills go in .claude/skills/ at the repo root. Each skill is a folder with a SKILL.md file inside.

Skill frontmatter

YAML frontmatter defines the skill's name, description, whether it's user-invocable, allowed tools, and optional model override. The Markdown body is the prompt Claude receives when the skill is invoked.

User-invocable vs auto

Set user-invocable: true in frontmatter to make a skill appear in the / menu. Skills without this flag can still be invoked programmatically by Claude via the Skill tool.

Tool restrictions

Use allowed-tools: in frontmatter to restrict which tools a skill can access. This provides sandboxing for skills that shouldn't have full tool access.

Model override

Add model: haiku (or sonnet, opus) in frontmatter to force a specific model when the skill runs, regardless of the session's current model.

Listing skills

Use /skills to see all available skills, or just type / and start filtering. Skills from plugins also appear here.

11

MCP Servers

Guide

MCP (Model Context Protocol) servers give Claude access to external tools, APIs, and data sources. They run as separate processes and communicate via stdio or HTTP.

Adding an MCP server

Use claude mcp add <name> -- <command> from the CLI. For example: claude mcp add github -- npx @anthropic-ai/mcp-server-github. Servers can also be added via /mcp in-session.

Configuration scopes

Add with -s user for global (all projects), -s project for repo-specific, or via org-managed connectors. Config is stored in ~/.claude/settings.json or .claude/settings.json.

OAuth servers

Some MCP servers (like Slack) use OAuth. Use --client-id and --client-secret with claude mcp add for servers that don't support Dynamic Client Registration.

Managing servers

Use claude mcp list to see configured servers, claude mcp remove <name> to delete one, or /mcp in-session for an interactive view with connection status.

Deferred tool loading

MCP tools are loaded on-demand to save context. Claude uses ToolSearch to fetch tool schemas before calling them. This means MCP servers with many tools don't bloat the context window.

Troubleshooting

If an MCP server isn't connecting, check /mcp for status. Common issues: missing Node.js/Python, wrong path, or the server needs environment variables set via -e KEY=VALUE.


12

Vim Mode -- Mode Switching

Vim

Enable via /config → Editor mode. The /vim slash command was removed in v2.1.92 -- use the config menu instead.

KeyActionFrom
EscEnter NORMAL modeINSERT
iInsert before cursorNORMAL
IInsert at beginning of lineNORMAL
aInsert after cursorNORMAL
AInsert at end of lineNORMAL
oOpen new line belowNORMAL
OOpen new line aboveNORMAL
13

Vim -- Navigation

Normal
Basic Movement
KeyAction
hMove left
jMove down
kMove up
lMove right
Word & Line
KeyAction
wNext word
eEnd of word
bPrevious word
0Beginning of line
$End of line
^First non-blank character
Document & Character Jumps
KeyAction
ggTop of input
GBottom of input
f{char}Jump to next occurrence of character
F{char}Jump to previous occurrence of character
t{char}Jump to just before next occurrence
T{char}Jump to just before previous occurrence
;Repeat last f/F/t/T
,Repeat last f/F/t/T in reverse
14

Vim -- Editing

Normal
Delete
KeyAction
xDelete character under cursor
ddDelete entire line
DDelete to end of line
dwDelete word forward
deDelete to end of word
dbDelete word backward
Change (delete + INSERT)
KeyAction
ccChange entire line
CChange to end of line
cwChange word forward
ceChange to end of word
cbChange word backward
Yank, Paste & Other
KeyAction
yy / YYank (copy) entire line
ywYank word
yeYank to end of word
ybYank word backward
pPaste after cursor
PPaste before cursor
>>Indent line
<<Dedent line
JJoin current line with next
.Repeat last change
15

Vim -- Text Objects

Vim

Use with operators: d (delete), c (change), y (yank). Example: ci" = change inside quotes.

ObjectDescription
iw / awInner / around word
iW / aWInner / around WORD (whitespace-delimited)
i" / a"Inner / around double quotes
i' / a'Inner / around single quotes
i( / a(Inner / around parentheses
i[ / a[Inner / around brackets
i{ / a{Inner / around braces
16

Vim -- Not Supported

Limits

These standard Vim features are not available in Claude Code's Vim mode:

  • Visual mode (v, V, Ctrl+V)
  • Undo / Redo (u, Ctrl+R)
  • Macros (q, @)
  • Marks (m, ')
  • Named registers
  • Search (/, ?)
  • Substitute (:s)
  • Ex commands (:w, :q)
  • Page navigation (Ctrl+D/U)
  • Count prefixes (3j, 5w)
Vim mode notes: Esc switches to NORMAL -- it does not cancel input. Most Ctrl+key shortcuts pass through regardless of mode. In NORMAL, ? opens the help menu. Use /rewind instead of u for undo -- it rolls back both conversation and code. Enable vim mode via /config → Editor mode.