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 offers dozens of native slash commands covering the entire work cycle: project initialization, context management, configuration, authentication, and debugging. These commands significantly accelerate repetitive configuration tasks.
SFEIR Institute trainings
Claude Code Training
1 day · Fundamentals
AI-Augmented Developer
2 days · Intermediate
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.
| Command | Description | Example |
|---|---|---|
/help | Displays help and shortcuts | /help |
/init | Initializes the CLAUDE.md file | /init |
/clear | Clears the conversation context | /clear |
/compact | Compresses the active context | /compact |
/cost | Shows tokens consumed | /cost |
/config | Opens global configuration | /config |
/model | Changes the active LLM model | /model sonnet |
/memory | Edits memory files | /memory |
/doctor | Diagnoses the installation | /doctor |
/login | Authenticates your session | /login |
/logout | Disconnects your session | /logout |
/status | Displays session status | /status |
/permissions | Manages tool permissions | /permissions |
/allowed-tools | Manages tool permissions (alias of /permissions) | /allowed-tools |
/diff | Shows current modifications | /diff |
/context | Visualizes loaded context | /context |
/bug | Reports a bug to Anthropic | /bug |
/feedback | Sends feedback to Anthropic | /feedback |
/mcp | Manages MCP servers | /mcp |
/hooks | Manages Claude Code hooks | /hooks |
/add-dir | Adds a directory to context | /add-dir ./lib |
/resume | Resumes a previous session | /resume |
/plan | Creates a structured action plan | /plan |
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: this table covers the most common commands. Type /help to see the full list in your version of 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 the available slash commands, keyboard shortcuts, and links to online documentation. The /help command takes no arguments: simply type /help to get the complete list.
/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 CLAUDE.md is a concise file capturing the conventions detected in your project; its size varies from one codebase to another. You can then customize this file by following the CLAUDE.md memory system guide which details best practices.
| Aspect | Without /init | With /init |
|---|---|---|
| Project context | None | Auto-detected conventions |
| Setup time | Slow manual setup | Near-instant |
| Consistency | Variable | Reproducible |
| Generated file | None | CLAUDE.md |
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 resets the conversation context, freeing the tokens the exchange had accumulated.
> /clear
Use /clear when you switch topics or when response quality starts to decline after a long conversation. Note: Ctrl+L in the terminal only refreshes the screen display, it does not reset the conversation context like /clear.
/compact - Intelligent compression
The /compact command is the automatic summarization mechanism that compresses your conversation without deleting it. It summarizes the exchange to substantially reduce context size while preserving essential information; the exact reduction varies by conversation.
> /compact
> /compact "focus on the REST API part"
You can pass an optional instruction in quotes to guide the compression. In practice, /compact replaces a long history with a compact summary, freeing significant context space. To go further in optimizing your sessions, check the first conversations cheatsheet.
| Command | Effect | Context Freed | Context Preserved |
|---|---|---|---|
/clear | Total deletion | Full reset | CLAUDE.md only |
/compact | Compression | Substantial | Intelligent summary |
/compact "focus X" | Targeted compression | Substantial | Oriented summary |
Key takeaway: alternate between /compact for long sessions and /clear for a radical topic change.
What monitoring tool does /cost 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 token usage and estimated cost
Token consumption per session varies widely depending on task complexity and the number of exchanges. Monitor this counter after each /compact to verify the compression impact. If you notice the context becoming too large, use /compact to compress it. To understand the common errors related to slash commands, check the troubleshooting guide.
Key takeaway: check /cost regularly to track your budget and know when to use /compact.
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
/config opens the interactive Settings interface where you can adjust permissions, appearance, the default model, and other options. 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.8, Claude Sonnet 4.6, and Claude Haiku 4.5 without restarting.
> /model
> /model opus
> /model sonnet
> /model haiku
| Model | ID | Speed | Relative Cost | Recommended Usage |
|---|---|---|---|---|
| Opus 4.8 | claude-opus-4-8 | Standard | Highest | Complex tasks |
| Sonnet 4.6 | claude-sonnet-4-6 | Fast | Moderate | Daily usage |
| Haiku 4.5 | claude-haiku-4-5 | Ultra-fast | Lowest | Simple tasks |
In practice, the default model is plan-dependent: Sonnet 4.6 on Pro and Team Standard, Opus 4.8 on Max, Team Premium, Enterprise, and API. Sonnet 4.6 offers the best quality-to-price ratio for most everyday use cases, while Opus 4.8 is the most capable for complex work. Switch to Opus for multi-file refactoring and to Haiku for quick searches. Prefer the aliases (opus, sonnet, haiku) over hard version numbers so your config keeps tracking the latest model. To finely manage permissions and security, combine /config with the right model settings.
Key takeaway: the default model depends on your plan; use /model sonnet for everyday tasks and reserve Opus for architectural work.
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
/login signs you in or switches accounts, and your credentials are stored locally after the flow completes. To check your authentication status non-interactively, run claude auth status.
/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 avoids the interactive login flow entirely, which suits automated environments.
Key takeaway: /login for interactive sessions, environment variable for automation.
How to use /memory and /doctor daily?
/memory - Persistent memory management
The /memory command lets you edit your CLAUDE.md memory files and manage auto-memory (enable or disable it, and view its entries). Changes take effect at the next interaction.
> /memory
Specifically, /memory lets you add team conventions, important file paths, or recurring instructions. Discover the advanced CLAUDE.md memory tips to structure this file effectively.
Undoing an action
To undo an action performed by Claude Code, ask it to use git to revert, or directly use git checkout, git stash, or git reset in your terminal.
/doctor - System diagnostics
The /doctor command diagnoses your Claude Code installation and settings, reporting any problems it finds. Press f to have Claude attempt to fix the detected issues.
> /doctor
/doctor checks your installation and configuration, then flags anything that looks misconfigured. The exact checks evolve with each release, so run it whenever something feels off and let the report guide you.
If /doctor reports a problem, press f to let Claude attempt a fix, or resolve it manually 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 just a few moments. Launch /init first to generate the CLAUDE.md, then select your model and adjust the configuration.
Long session
> /cost # Check consumption
> /compact # Compress when context grows large
> /cost # Verify the compression effect
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 shortcuts below to speed up your sessions.
| Shortcut | Action | Equivalent Command |
|---|---|---|
Ctrl+L | Refresh the screen display (does not reset context) | - |
Ctrl+C | Cancel the current generation | - |
Tab | Command autocomplete | - |
Up / Down | Navigate history | - |
Escape | Exit current mode | - |
/ + Tab | List available commands | /help |
Here is how to use autocomplete: type /co then press Tab. Claude Code suggests /compact, /config, and /cost. This avoids typos and speeds up input. 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: Tab for autocomplete is the shortcut that will save you the most time daily. Note that Ctrl+L only refreshes the display, it does not reset your conversation.
Recent articles about Claude

Claude Managed Agents: Anthropic's Platform for Production Agent Deployment
Anthropic launches Managed Agents: a cloud platform for deploying AI agents in production. Secure sandbox, checkpointing, multi-agent, autonomous sessions lasting hours. Notion, Rakuten, Asana and Sentry already use it.

Claude Code Dream & Auto Dream: Automatic Memory Consolidation
After 20 sessions, Auto Memory notes become a mess. Auto Dream solves this by automatically consolidating Claude Code's memory: deduplication, stale entry removal, relative-to-absolute date conversion.

Claude Code Auto Mode: Autonomy Without the Risk
Auto Mode in Claude Code eliminates permission interruptions while keeping a safety net. A classifier analyzes every action before execution and blocks destructive operations. The sweet spot between approving everything and letting everything through.
This topic is covered in Module 6 of our Claude Code training
Useful Commands and Tips
1-day training • 60% hands-on labs • Expert instructors
View full program