Skip to content

Essential Claude Code Commands

Claude Code is driven from the prompt with slash commands. This guide groups 35 of the most useful ones by purpose, so you can find the right command quickly.

Commands evolve between releases. Type / in a session to see the list available in your version, and check the official commands reference for arguments and aliases.

Control the session

Command What it does
/context Visualize what is using your context window, with optimization suggestions
/clear Start a new conversation with empty context
/compact [instructions] Summarize the conversation to free context while keeping the essentials
/resume [session] Reopen a previous session by ID or name, or pick one from a list
/branch [name] Branch the conversation at this point to try another direction without losing the original
/rewind Roll the conversation and/or code back to a previous point (aliases: /checkpoint, /undo)
/fork [prompt] Copy the conversation into a new background session and keep working here

Configure the project

Command What it does
/init Generate a starter CLAUDE.md for the project
/memory Edit CLAUDE.md files and manage auto memory
/cd Move the session to another working directory, keeping the conversation
/permissions Manage allow, ask and deny rules for tools
/add-dir Give Claude access to an additional directory for this session
/terminal-setup Install a Shift+Enter newline keybinding in supported terminals and editors
/mcp Manage MCP server connections and authentication

Utilities

Command What it does
/usage Show session cost, plan limits and activity stats
/status Open the Status tab: version, model, account and connectivity
/debug [description] Enable debug logging and troubleshoot from the session log
/doctor Run a setup checkup on installation, settings and CLAUDE.md, and propose fixes
/feedback [report] Send product feedback or report a bug

Tune Claude

Command What it does
/voice Dictate prompts instead of typing (requires a Claude.ai account)
/model [model] Switch the model
/effort [level] Set how much reasoning effort Claude spends
/color [color] Tint the prompt bar for the current session
/config Open settings: theme, model, output style and more
/keybindings Open your keyboard shortcuts file

Code better

Command What it does
/plan [description] Enter plan mode to design the work before any edit
/diff Review the changes in your working tree, including Claude’s edits
/code-review Review the current diff, a PR, a branch or a path for correctness bugs
/security-review Analyze your branch changes for vulnerabilities such as injection and auth issues

Work in parallel

Command What it does
/tasks View and manage background work, including finished subagents
/btw [question] Ask a side question without adding it to the conversation
/batch Split a large change into independent units handled by parallel background agents
/background [prompt] Detach the session to run as a background agent and free the terminal
/agents Create or manage subagents (stored in .claude/agents/)
/remote-control Make the session available from claude.ai to follow it remotely (alias: /rc)

A suggested workflow

  1. Run /init once, then refine the generated CLAUDE.md (see Project Structure).
  2. Start a task with /plan so Claude proposes an approach before editing.
  3. Watch /context during long tasks and run /compact before the window fills. Use /clear between unrelated tasks.
  4. Use /rewind or /branch when an approach goes wrong or you want to compare alternatives.
  5. Before committing, run /diff, /code-review and /security-review.
  6. Use /permissions to pre-approve safe commands so Claude asks less often.

For a first-time setup walkthrough, see Setting Up a New Project with Claude Code.