Retour aux articles
10 MIN READ

Claude Code Slash Commands: Complete Reference Guide

By Learnia Team

Claude Code Slash Commands: Complete Reference Guide

This article is written in English. Our training modules are available in French.

Slash commands are the fastest way to control Claude Code. Instead of typing out full instructions, use a single command to trigger complex operations. This reference covers every built-in command, from essential daily tools to advanced configuration options.


How Slash Commands Work

Slash commands start with

/
and execute immediately. Type them anywhere in your prompt:

> /review
> Can you /compact the conversation and then continue?

Command Anatomy

/command [arguments]
  • command: The action to perform
  • arguments: Optional parameters (some commands require them)

Getting Help

> /help

Lists all available commands with descriptions.


Essential Commands

These are the commands you'll use daily:

/init — Initialize Project

Creates a

CLAUDE.md
file for your project.

> /init

Claude Code scans your project and generates a tailored memory file with:

  • Project overview
  • Tech stack detection
  • Suggested conventions
  • Directory structure

Best practice: Run this first in any new project.

Learn more: CLAUDE.md: Your Project's AI Memory File Explained

/review — Code Review

Requests a code review of recent changes.

> /review

Claude analyzes:

  • Uncommitted changes (
    git diff
    )
  • Code quality issues
  • Potential bugs
  • Style inconsistencies

With specific focus:

> /review focus on security vulnerabilities
> /review check the API error handling

/compact — Compress Conversation

Compacts conversation history to free up context.

> /compact

When your conversation gets long, Claude's context window fills up. Compacting:

  • Summarizes older messages
  • Preserves important context
  • Frees tokens for new work

With focus instructions:

> /compact focus on the authentication work

Claude keeps authentication-related context while compressing other parts.

/cost — Token Usage

Shows token usage for the current session.

> /cost

Output:

Session Usage:
- Input tokens:  45,230
- Output tokens: 12,450
- Total cost:    $0.47

Context window: 67% used

/clear — Clear Conversation

Clears conversation history and starts fresh.

> /clear

Warning: This cannot be undone. Use

/compact
instead if you want to preserve some context.

/exit — Exit Claude Code

Exits the interactive session.

> /exit

Or use

Ctrl+C
twice.


Session & Navigation Commands

/resume — Resume Previous Session

Resume a previous conversation by ID or name.

> /resume
> /resume abc123
> /resume "feature-work"

Without arguments, opens a session picker.

/rename — Rename Session

Give the current session a memorable name.

> /rename authentication-refactor

Later, resume with:

> /resume authentication-refactor

/add-dir — Add Working Directory

Add additional directories to Claude's context.

> /add-dir ../shared-library
> /add-dir /path/to/other/project

Useful when working across multiple repositories.

/context — Visualize Context Usage

Shows a visual representation of context window usage.

> /context

Output: A colored grid showing what's consuming your context—files, conversation history, system prompts, etc.


Configuration Commands

/config — Open Settings

Opens the interactive settings interface.

> /config

Configure:

  • Model selection
  • Permission modes
  • Theme
  • Keyboard shortcuts

/model — Change AI Model

Switch between Claude models.

> /model
> /model sonnet
> /model opus
> /model haiku
ModelBest For
sonnet
Balanced speed and capability (default)
opus
Complex reasoning, large refactors
haiku
Fast responses, simple tasks

/permissions — Manage Permissions

View or update permission settings.

> /permissions

Interactive menu to configure:

  • Allowed tools
  • Denied tools
  • Permission mode

See Claude Code Permissions: Deny, Allow & Ask Modes for details.

/theme — Change Color Theme

Switch between color themes.

> /theme
> /theme dark
> /theme light

/output-style — Set Output Style

Configure how Claude formats responses.

> /output-style
> /output-style concise
> /output-style detailed

Memory & Project Commands

/memory — Edit Memory Files

Open the memory file editor.

> /memory

Interactive menu to:

  • View current CLAUDE.md
  • Edit project memory
  • Edit user memory

/todos — List TODO Items

Shows current TODO items from the session.

> /todos

Claude tracks tasks mentioned during the conversation.

/pr-comments — View PR Comments

View pull request comments (when integrated with GitHub).

> /pr-comments

Requires GitHub MCP integration.


Integration Commands

/mcp — Manage MCP Servers

Manage Model Context Protocol connections.

> /mcp

Interactive menu to:

  • View connected servers
  • Check connection status
  • Authenticate with OAuth servers
  • Clear authentication

Common MCP operations:

# In terminal, before starting Claude Code:
claude mcp add --transport http github https://api.githubcopilot.com/mcp/
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
claude mcp list

Learn more: Model Context Protocol (MCP) for Claude Code: Complete Guide

/ide — Manage IDE Integrations

View and manage IDE integrations.

> /ide

Shows status of:

  • VS Code extension
  • JetBrains plugin
  • Other IDE integrations

/install-github-app — Setup GitHub Actions

Install Claude GitHub App for CI/CD automation.

> /install-github-app

Guides you through:

  1. Installing the GitHub app
  2. Setting up repository secrets
  3. Creating workflow files

See Claude Code GitHub Actions: AI-Powered CI/CD Automation.


Agent & Automation Commands

/agents — Manage Sub-Agents

Manage custom AI sub-agents.

> /agents

Interactive menu to:

  • View all available agents
  • Create new agents
  • Edit existing agents
  • Delete agents

Built-in agents:

  • Explore: Fast, read-only codebase exploration
  • Plan: Planning and architecture design
  • general-purpose: Default balanced agent

Learn more: Claude Code Sub-Agents: Orchestrating Complex Tasks

/hooks — Manage Hooks

Configure hooks for automated actions.

> /hooks

View and manage:

  • PreToolUse hooks
  • PostToolUse hooks
  • SessionStart hooks
  • Custom hook configurations

See Claude Code Hooks: Automate Your Development Workflow.

/plugin — Manage Plugins

Manage Claude Code plugins.

> /plugin
> /plugin install my-plugin@marketplace
> /plugin list

See Claude Code Plugins: Create & Distribute Extensions.

/bashes — List Background Tasks

View running background tasks.

> /bashes

Shows:

  • Active background processes
  • Task IDs
  • Status

Utility Commands

/doctor — Health Check

Run diagnostics on your Claude Code installation.

> /doctor

Checks:

  • Installation integrity
  • Authentication status
  • Network connectivity
  • Configuration validity

/bug — Report Bug

Report a bug to Anthropic.

> /bug

Submits:

  • Conversation context
  • Error details
  • System information

/export — Export Conversation

Export the current conversation to a file or clipboard.

> /export
> /export conversation.md
> /export --clipboard

/status — View Status

Open the status panel showing system information.

> /status

Shows:

  • Version
  • Current model
  • Account
  • Connectivity

/release-notes — View Release Notes

View release notes for the current version.

> /release-notes

/stats — Usage Statistics

View usage statistics and streaks.

> /stats

Shows:

  • Daily usage patterns
  • Session history
  • Model preferences
  • Usage streaks

Account Commands

/login — Switch Accounts

Log in or switch Anthropic accounts.

> /login

Opens browser for authentication.

/logout — Sign Out

Sign out from your Anthropic account.

> /logout

/usage — View Plan Limits

View subscription usage limits (for subscription plans).

> /usage

Shows:

  • Current plan
  • Usage limits
  • Rate limit status

/privacy-settings — Privacy Configuration

View and update privacy settings.

> /privacy-settings

Advanced Commands

/plan — Enter Plan Mode

Switch to read-only planning mode.

> /plan

In plan mode, Claude:

  • Analyzes but doesn't modify
  • Creates detailed plans
  • Suggests approaches

Exit with

/plan
again or start a regular prompt.

/vim — Enable Vim Mode

Toggle Vim-style editing mode.

> /vim

Enables:

  • Insert/command mode switching
  • Vim keybindings for input

/rewind — Rewind Conversation

Rewind the conversation and/or code changes.

> /rewind

Interactive tool to:

  • Undo recent messages
  • Revert code changes
  • Restore previous state

/sandbox — Enable Sandbox Mode

Enable sandboxed execution for safer automation.

> /sandbox

Sandboxed mode:

  • Isolates filesystem access
  • Restricts network
  • Safer for autonomous execution

/security-review — Security Audit

Complete a security review of pending changes.

> /security-review

Analyzes current branch for:

  • Security vulnerabilities
  • Exposed secrets
  • Unsafe patterns

/terminal-setup — Configure Terminal

Install keyboard shortcuts for better terminal integration.

> /terminal-setup

Sets up Shift+Enter for newlines in:

  • VS Code terminal
  • Alacritty
  • Zed
  • Warp

/statusline — Configure Status Line

Set up Claude Code's status line in your terminal.

> /statusline

/teleport — Resume Remote Session

Resume a remote session from claude.ai.

> /teleport
> /teleport session-id

For claude.ai subscribers with remote sessions.

/remote-env — Configure Remote Environment

Configure remote session environment.

> /remote-env

For claude.ai subscribers.


Command Quick Reference

CommandPurpose
/init
Initialize project with CLAUDE.md
/review
Code review current changes
/compact
Compress conversation history
/cost
Show token usage
/clear
Clear conversation
/exit
Exit Claude Code
/resume
Resume previous session
/rename
Rename current session
/add-dir
Add working directory
/context
Visualize context usage
/config
Open settings
/model
Change AI model
/permissions
Manage permissions
/theme
Change theme
/memory
Edit memory files
/todos
List TODO items
/mcp
Manage MCP servers
/agents
Manage sub-agents
/hooks
Manage hooks
/plugin
Manage plugins
/doctor
Health check
/bug
Report bug
/export
Export conversation
/status
View status
/login
Switch accounts
/logout
Sign out
/plan
Enter plan mode
/rewind
Rewind conversation
/sandbox
Enable sandbox mode
/security-review
Security audit

Custom Slash Commands

Beyond built-in commands, you can create your own:

# .claude/commands/deploy.md
---
description: Deploy to staging environment
allowed-tools: Bash(git:*), Bash(npm:*)
---

Deploy the current branch to staging.

Usage:

/deploy

See Custom Slash Commands in Claude Code: Build Your Own.


Key Takeaways

  1. Start with essentials:

    /init
    ,
    /review
    ,
    /compact
    , and
    /cost
    are your daily drivers.

  2. Use

    /help
    when unsure: Lists all commands with descriptions.

  3. Customize with

    /config
    : Tailor Claude Code to your workflow.

  4. Integrate with

    /mcp
    : Connect external tools and data sources.

  5. Create custom commands: Build reusable prompts for your team's workflows.


Ready to Master Structured AI Outputs?

Now that you know how to command Claude Code, it's time to learn how to get consistent, structured responses.

In our Module 2 — Structured Outputs, you'll learn:

  • Techniques for reliable JSON and formatted responses
  • Schema definition and validation
  • Output formatting best practices
  • Hands-on exercises with real examples

Explore Module 2: Structured Outputs

GO DEEPER

Module 2 — Structured Outputs

Learn to get reliable, formatted responses like JSON and tables.