AI logoAIv2.1BEGINNER

Claude Code Slash Commands

Claude Code slash commands cheat sheet — complete reference for all built-in CLI commands with syntax, options, and usage examples.

8 min read
claudeclaude-codeslash-commandsclicommands

Sign in to mark items as known and track your progress.

Sign in

Core Commands

Essential commands for managing your session

/help

Display all available commands

bash
/help
💡 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
/clear
💡 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
/exit
💡 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
/status
💡 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
/compact
/compact [focus instructions]
💡 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
/context
💡 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
/resume
💡 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
/rewind
💡 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
/export
/export [filename]
💡 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
/init
💡 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
/memory
💡 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
/add-dir <directory-path>
💡 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
/review
💡 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
/security-review
💡 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
/bug
💡 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
/config
💡 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
/model
💡 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
/output-style
/output-style explanatory
💡 Customize how Claude responds
⚡ Built-in styles: default, explanatory, learning
🔍 Interactive menu or set directly
🎯 Create custom styles with /output-style:new
output-stylepreferencesresponse

Tools & Integration

Manage plugins, MCP servers, and integrations

/mcp

Manage Model Context Protocol servers

bash
/mcp
💡 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
/plugin
💡 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
/hooks
💡 Trigger shell commands on tool events
⚡ Automate linting, testing, commits
🔍 Configure in settings.json under the hooks key
🎯 Great for workflow automation
hooksautomationevents

System & Diagnostics

Health checks and system administration

/doctor

Check Claude Code installation health

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

/permissions

Manage tool and file access

bash
/permissions
💡 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
/sandbox
💡 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
# .claude/commands/review-pr.md
---
description: Review pull request changes
---
Review the current PR and provide feedback
💡 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
# ~/.claude/commands/daily-standup.md
---
description: Generate daily standup summary
argument-hint: <date>
---
Summarize work completed on $1
💡 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
# Command that reads files
---
description: Analyze file for security issues
---
Review @$1 for security vulnerabilities
💡 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
# Command with bash prefix
---
description: Test and review results
allowed-tools: [Bash]
---
!npm test
Review test results above
💡 Use ! prefix to run bash before prompt
⚡ Requires allowed-tools: [Bash] in frontmatter
🔍 Command output included in context
🎯 Perfect for test/build automation
custombashautomation