Reference10 min read

Essential Slash Commands - Command Reference

SFEIR Institute

TL;DR

Claude Code integrates over a dozen slash commands that let you configure, diagnose, and drive your sessions without leaving the terminal. This reference guide groups each command by category - from `/init` for initialization to `/compact` for context management - with complete syntax, options, and copy-paste-ready examples.

Claude Code integrates over a dozen slash commands that let you configure, diagnose, and drive your sessions without leaving the terminal. This reference guide groups each command by category - from /init for initialization to /compact for context management - with complete syntax, options, and copy-paste-ready examples.

The slash commands /help, /init, /clear, and the complete list of commands form the foundation of any effective Claude Code usage. Claude Code (version 1.0.33) offers 13 native slash commands covering the entire work cycle: project initialization, context management, configuration, authentication, and debugging. these commands reduce time spent on repetitive configuration tasks by 40%.

What are the /help, /init, /clear slash commands in the complete Claude Code command list?

Here is the quick reference table of the most commonly used commands. Check it before each session to save time.

CommandDescriptionExample
/helpDisplays help and shortcuts/help
/initInitializes the CLAUDE.md file/init
/clearClears the conversation context/clear
/compactCompresses the active context/compact
/costShows tokens consumed/cost
/configOpens global configuration/config
/modelChanges the active LLM model/model sonnet
/memoryEdits memory files/memory
/doctorDiagnoses the installation/doctor
/loginAuthenticates your session/login

Each command runs directly in the Claude Code interactive prompt. Type / followed by the name to activate it. To discover all variants, check the practical slash commands examples which illustrate each use case.

Key takeaway: these 10 commands cover 95% of daily interactions with Claude Code.

How to use the initialization and help commands?

/help - Your entry point

The /help command is the entry point to Claude Code's built-in documentation. Run it without arguments to display the list of all available commands, keyboard shortcuts, and configuration options.

$ claude
> /help

In practice, /help displays 3 categories: slash commands, keyboard shortcuts, and links to online documentation. 78% of beginner users start with this command.

/init - Project initialization

The /init command is the automatic generator for the CLAUDE.md file at your project root. This file contains the conventions, instructions, and context that Claude Code will read at each session.

$ claude
> /init

Verify that the CLAUDE.md file was created with ls -la. The generated file weighs on average 2 KB and contains between 30 and 80 lines of configuration. You can then customize this file by following the CLAUDE.md memory system guide which details best practices.

AspectWithout /initWith /init
Project contextNoneAuto-detected conventions
Setup time5-10 min manual15 seconds
ConsistencyVariableReproducible
Generated fileNoneCLAUDE.md (2 KB)

Key takeaway: launch /init once per project, then maintain the CLAUDE.md file manually.

How to manage context with /clear and /compact?

Context management is the #1 performance lever in Claude Code. The context window consumes tokens with each exchange - mastering it saves budget and improves response quality.

/clear - Full reset

The /clear command is the complete conversation reset function. It deletes all exchange history while keeping CLAUDE.md files in memory. Specifically, it frees 100% of tokens used by the conversation.

> /clear

Use /clear when you switch topics or when response quality decreases after 20+ exchanges. The associated keyboard shortcut is Ctrl+L in the interactive terminal.

/compact - Intelligent compression

The /compact command is the automatic summarization mechanism that compresses your conversation without deleting it. It reduces token consumption by 50 to 70% on average while preserving essential information.

> /compact
> /compact "focus on the REST API part"

You can pass an optional instruction in quotes to guide the compression. In practice, /compact transforms 80,000 tokens into approximately 25,000 tokens, a 68% reduction. To go further in optimizing your sessions, check the first conversations cheatsheet.

CommandEffectTokens FreedContext Preserved
/clearTotal deletion100%CLAUDE.md only
/compactCompression50-70%Intelligent summary
/compact "focus X"Targeted compression60-75%Oriented summary

Key takeaway: alternate between /compact for long sessions and /clear for a radical topic change.

What monitoring tools do /cost and /context offer?

/cost - Consumption tracking

The /cost command is the real-time indicator of your token consumption and API cost for the current session. It shows the number of input tokens, output tokens, and the estimated cost in dollars.

> /cost
# Shows: Session tokens: 45,230 | Cost: $0.34

In practice, a 30-minute session consumes between 20,000 and 120,000 tokens depending on task complexity. Monitor this counter after each /compact to verify the compression impact.

/context - Context inspection

The /context command is the diagnostic tool that shows the detailed state of the active context window. You will find the number of tokens used, the fill percentage, and the list of loaded files.

Specifically, /context helps you identify which files or conversations take up the most space. If the fill rate exceeds 80%, run /compact immediately. To understand the common errors related to slash commands, check the context state first.

Key takeaway: check /cost for the budget and /context for performance diagnostics.

How to configure Claude Code with /config and /model?

/config - Global configuration

The /config command is the centralized management interface for Claude Code settings. It opens an interactive menu that lets you modify permissions, theme, notifications, and default behavior.

> /config

You access 4 categories of settings: permissions (read/write/execute), appearance, default model, and integrations. more than 15 settings are configurable via this command. For a complete overview of initial configuration, refer to the installation and first launch cheatsheet.

/model - Model selection

The /model command is the LLM model selector used during the session. You can switch between Claude Opus 4.6, Claude Sonnet 4.6, and Claude Haiku 4.5 without restarting.

> /model
> /model opus
> /model sonnet
> /model haiku
ModelIDSpeedRelative CostRecommended Usage
Opus 4.6claude-opus-4-6Standard3xComplex tasks
Sonnet 4.6claude-sonnet-4-6Fast1xDaily usage
Haiku 4.5claude-haiku-4-5Ultra-fast0.3xSimple tasks

In practice, Sonnet 4.6 offers the best quality-to-price ratio for 80% of use cases. Switch to Opus for multi-file refactoring and to Haiku for quick searches. To finely manage permissions and security, combine /config with the right model settings.

Key takeaway: /model sonnet is the default choice; reserve Opus for architectural tasks.

How to manage authentication with /login and /logout?

/login - Connection

The /login command is the authentication process that links your terminal to your Anthropic account or an API key. It opens an OAuth flow in your default browser.

> /login

The process takes less than 10 seconds. Your session token is stored locally in ~/.claude/ with a 30-day validity period. Check your authentication status by running /login - the command shows "Already logged in" if the session is active.

/logout - Disconnection

The /logout command is the secure disconnection procedure that revokes the active session token. Use it on shared machines or at the end of the day.

> /logout

To set up a CI/CD environment without interactive session, check the headless commands reference which covers authentication via environment variable. In practice, headless mode with ANTHROPIC_API_KEY is 3 times faster to configure than an interactive login.

Key takeaway: /login for interactive sessions, environment variable for automation.

How to use /memory, /rewind, and /doctor daily?

/memory - Persistent memory management

The /memory command is the built-in editor for Claude Code's memory files. It opens the project's CLAUDE.md file in your default editor (defined by $EDITOR). Changes take effect at the next interaction.

> /memory

Specifically, /memory lets you add team conventions, important file paths, or recurring instructions. The CLAUDE.md file supports up to 200 lines before truncation in the system prompt. Discover the advanced CLAUDE.md memory tips to structure this file effectively.

/rewind - Go back

The /rewind command is the undo function that removes the last exchange (your message + Claude's response). You can run it multiple times to go back through the history.

> /rewind

Use /rewind when a response goes in the wrong direction. This saves tokens compared to a manual correction - on average 2,000 to 5,000 tokens recovered per /rewind.

/doctor - System diagnostics

The /doctor command is the self-diagnostic tool that checks the integrity of your Claude Code installation. It verifies 6 points: Node.js version (minimum 18), API connectivity, file permissions, Git configuration, VS Code extensions, and disk space.

> /doctor
CheckSuccess ThresholdAlternative Command
Node.js>= v18.0.0node --version
API connectivityLatency < 5,000 mscurl api.anthropic.com
Disk space> 500 MB freedf -h
GitVersion >= 2.30git --version
PermissionsRead/write ~/.claude/ls -la ~/.claude/

If /doctor reports a problem, fix it before continuing. You will find solutions to common issues in the common slash command errors guide. Also check the permissions and security tips to resolve access problems.

Key takeaway: run /doctor after each Claude Code or Node.js update.

What command combinations to use for common workflows?

Slash commands reach their full power when you combine them. Here are the most effective sequences, tested on real projects.

Starting a new project

$ claude
> /init
> /model sonnet
> /config

This 3-command sequence initializes the project in under 30 seconds. Launch /init first to generate the CLAUDE.md, then select your model and adjust the configuration.

Long session (more than 45 minutes)

> /cost          # Check consumption
> /compact       # Compress if > 60,000 tokens
> /context       # Validate the compression

Task switch

> /cost          # Note the previous task's cost
> /clear         # Start from scratch
> /model haiku   # Switch if the task is simple

Installation debugging

> /doctor        # Diagnose
> /login         # Re-authenticate if needed
> /config        # Check settings

To create your own automated workflows, explore the custom commands and skills reference which lets you define reusable sequences.

Key takeaway: the best workflows combine 2-3 commands executed in a precise order.

What keyboard shortcuts accelerate command usage?

Claude Code offers native keyboard shortcuts that complement slash commands. Memorize the 5 shortcuts below to speed up your sessions by 30%.

ShortcutActionEquivalent Command
Ctrl+LClear the conversation/clear
Ctrl+CCancel the current generation-
TabCommand autocomplete-
Up / DownNavigate history-
EscapeExit current mode-
/ + TabList available commands/help

Here is how to use autocomplete: type /co then press Tab - Claude Code suggests /compact, /config, /cost, and /context. This avoids typos and speeds up input by 50%. Find the complete slash commands overview for a comprehensive view.

SFEIR Institute offers a one-day Claude Code training where you will practice each slash command on concrete projects with guided labs. If you want to deepen Claude Code integration into a complete development workflow, the AI-Augmented Developer 2-day training covers the full range of generative AI tools for code. Developers already comfortable can take the AI-Augmented Developer - Advanced level in 1 day to master advanced automation patterns.

Key takeaway: Ctrl+L and Tab are the two shortcuts that will save you the most time daily.

Recommended training

Claude Code Training

Master Claude Code with our expert instructors. Practical, hands-on training directly applicable to your projects.

View program