AI logoAI BEGINNER

Claude Code Slash Commands

Complete reference for all built-in slash commands in Claude Code CLI

8 min read
claudeclaude-codeslash-commandsclicommands

Core Commands

Essential commands for managing your session

/help

Display all available commands

bash
💡 Lists all available slash commands
⚡ Shows built-in, custom, and plugin commands
🔍 Project commands labeled "(project)", user commands labeled "(user)"
🎯 Run anytime to see what commands are available
helpcoredocumentation

/clear

Clear conversation history and start fresh

bash
💡 Removes entire conversation history
⚡ Starts fresh while staying in same session
🔍 Does not exit the CLI
🎯 Use /resume to restore previous conversation
clearcoreconversation

/exit

Exit Claude Code CLI

bash
💡 Closes Claude Code CLI session
⚡ Conversation auto-saved for later
🔍 Can also use Ctrl+C or Ctrl+D
🎯 Use /resume next time to continue conversation
exitcoresession

/status

View current status and configuration

bash
💡 Opens Settings interface showing status
⚡ Check version, model, account, connectivity
🔍 Verify your current configuration
🎯 Quick way to see what's active
statuscoreconfig

Conversation Management

Manage conversation state, history, and context

/compact

Compress conversation to reduce token usage

bash
💡 Compresses conversation to save tokens
⚡ Add focus instructions to preserve specific content
🔍 Helpful when approaching context limits
🎯 Reduces costs while keeping important info
compactconversationtokens

/context

Visualize current context usage

bash
💡 Shows visual grid of context usage
⚡ Color-coded to show usage levels
🔍 Helps monitor conversation size
🎯 Know when to compact or start fresh
contextconversationtokens

/resume

Restore previous conversation

bash
💡 Restores previous conversation from last session
⚡ Continues where you left off
🔍 Works after /clear or /exit
🎯 Conversations auto-save when exiting
resumeconversationhistory

/rewind

Return conversation to earlier state

bash
💡 Returns conversation and code to earlier state
⚡ Interactive selection of rewind point
🔍 Can revert both messages and code changes
🎯 Use to undo mistakes or try different approaches
rewindconversationundo

/export

Export conversation to file or clipboard

bash
💡 Saves conversation to file or clipboard
⚡ Specify filename or let it copy to clipboard
🔍 Exports as formatted Markdown
🎯 Great for documentation or sharing
exportconversationsave

Project & Files

Project initialization and file management

/init

Initialize project with CLAUDE.md

bash
💡 Creates CLAUDE.md for project-specific instructions
⚡ Stores persistent context and guidelines
🔍 Shared with team via git
🎯 Claude reads this automatically each session
initprojectsetup

/memory

Edit CLAUDE.md memory file

bash
💡 Opens CLAUDE.md for editing
⚡ Define coding standards and project context
🔍 Claude reads this automatically
🎯 Reduces need to repeat instructions
memoryprojectcontext

/add-dir

Add supplementary working directories

bash
💡 Adds additional directories to Claude's workspace
⚡ Useful for monorepos and shared libraries
🔍 Claude can read/write files in added dirs
🎯 Expand scope beyond current working directory
add-dirprojectworkspace

Code Review & Quality

Code analysis, review, and security checks

/review

Request code review from Claude

bash
💡 Claude reviews your code for quality and issues
⚡ Checks best practices, bugs, performance
🔍 Reviews recent changes and context
🎯 Use before committing or deploying
reviewcode-qualitybest-practices

/security-review

Comprehensive security audit

bash
💡 Complete security audit of pending changes
⚡ Checks for common vulnerabilities
🔍 Reviews authentication, authorization, data exposure
🎯 Essential before production deployments
securityauditvulnerabilities

/bug

Report bugs to Anthropic

bash
💡 Submit bug report to Anthropic
⚡ Includes conversation context for debugging
🔍 Helps improve Claude Code
🎯 Use for crashes, errors, unexpected behavior
bugsupportreport

Configuration & Settings

Customize Claude Code behavior and preferences

/config

Open Settings interface

bash
💡 Opens full Settings interface
⚡ Configure model, output style, integrations
🔍 Central place for all preferences
🎯 Also use specific commands like /model
configsettingspreferences

/model

Switch AI model

bash
💡 Switch between Sonnet, Opus, and Haiku
⚡ Choose based on task complexity
🔍 Sonnet is default and best for most tasks
🎯 Opus for complex work, Haiku for simple tasks
modelaisettings

/output-style

Set response output style

bash
💡 Customize how Claude responds
⚡ Options: concise, detailed, code-focused
🔍 Interactive menu or set directly
🎯 Match style to your preference and task
output-stylepreferencesresponse

Tools & Integration

Manage plugins, MCP servers, and integrations

/mcp

Manage Model Context Protocol servers

bash
💡 Manage Model Context Protocol server connections
⚡ Connect external tools and services to Claude
🔍 OAuth authentication support
🎯 Exposes custom slash commands per server
mcpintegrationprotocol

/plugin

Manage Claude Code plugins

bash
💡 Install and manage Claude Code plugins
⚡ Extend functionality with community tools
🔍 Plugins provide custom slash commands
🎯 Browse marketplace or install from GitHub
pluginextensionsmarketplace

/hooks

Configure event-triggered automation

bash
💡 Trigger shell commands on tool events
⚡ Automate linting, testing, commits
🔍 Configure in .claude/hooks.json
🎯 Great for workflow automation
hooksautomationevents

System & Diagnostics

Health checks and system administration

/doctor

Check Claude Code installation health

bash
💡 Comprehensive installation health check
⚡ Diagnoses configuration and connectivity issues
🔍 Provides fix suggestions
🎯 Run when experiencing problems
doctordiagnosticshealth

/permissions

Manage tool and file access

bash
💡 Control what Claude can access and execute
⚡ Configure per-tool permissions
🔍 Set file access restrictions
🎯 Important for security and control
permissionssecurityaccess

/sandbox

Enable isolated execution environment

bash
💡 Enable isolated, secure execution environment
⚡ Filesystem and network isolation
🔍 Safer for running untrusted code
🎯 Trade-off: security vs functionality
sandboxsecurityisolation

Custom Commands

Create your own slash commands

Project Custom Command

Create team-shared custom command

markdown
💡 Create in .claude/commands/ for team sharing
⚡ Shared via git, labeled "(project)"
🔍 Use $1, $2 for arguments
🎯 Great for team workflows and standards
customprojectcommands

User Custom Command

Create personal custom command

markdown
💡 Create in ~/.claude/commands/ for personal use
⚡ Available across all projects
🔍 Not shared via git, labeled "(user)"
🎯 Build your personal toolkit
customuserpersonal

Command with File Reference

Use @file syntax in custom commands

markdown
💡 Use @ prefix to include file contents
⚡ Works with $1, $ARGUMENTS for dynamic files
🔍 Claude reads files automatically
🎯 Simplifies file-based commands
customfilesreference

Command with Bash Execution

Run bash before command prompt

markdown
💡 Use ! prefix to run bash before prompt
⚡ Requires allowed-tools: [Bash] in frontmatter
🔍 Command output included in context
🎯 Perfect for test/build automation
custombashautomation