FAQ12 min read

Essential Slash Commands - FAQ

SFEIR Institute

TL;DR

Claude Code's slash commands (`/help`, `/compact`, `/cost`, `/memory`...) let you drive your session without leaving the terminal. This FAQ guide answers frequently asked questions about each slash command, from context management to model configuration, with concrete examples and practical tips.

Claude Code's slash commands (/help, /compact, /cost, /memory...) let you drive your session without leaving the terminal. This FAQ guide answers frequently asked questions about each slash command, from context management to model configuration, with concrete examples and practical tips.

The essential slash commands in Claude Code are built-in terminal shortcuts that trigger specific actions - reset the context, switch models, diagnose a problem - without typing complex prompts. Claude Code offers more than 13 native slash commands accessible via the / prefix. these commands reduce the number of interactions needed to manage an AI-assisted development session by 40%.


How to display the full help with /help?

Type /help in the Claude Code terminal to display the list of all available commands with their description.

This command is your entry point when discovering the tool. It shows each slash command, its parameters, and a usage example. You do not need any additional arguments.

$ claude
> /help

The result lists commands grouped by category: navigation, configuration, memory, and diagnostics. If you are getting started, check the installation and first launch guide to verify that your environment is operational.

In practice, /help displays approximately 15 commands with their aliases in under 200 ms.

Key takeaway: /help is the first command to know - it serves as a built-in reference for all others.


How to initialize a project with /init?

Run /init to automatically generate a CLAUDE.md file at the root of your project.

This CLAUDE.md file serves as persistent memory: it stores project conventions, build commands, code patterns, and team preferences. Claude Code reads it at every session start to adapt its responses to your context.

$ claude
> /init
# Generates ./CLAUDE.md with detected conventions
Generated ElementTypical ContentEditable
Tech stackNode.js 22, TypeScript 5.xYes
Build commandsnpm run build, npm testYes
Code conventionsESLint, Prettier, namingYes
Project structureKey directories, entry pointsYes

Specifically, /init analyzes your package.json, config files, and directory tree to pre-fill the file. You can then edit this file manually. To understand in detail how this file works, explore the CLAUDE.md memory system.

Key takeaway: Launch /init once per project - the generated CLAUDE.md file persists and enriches over time.


How to reset the conversation with /clear?

Use /clear to erase the current conversation history and start from a clean context.

This command does not delete your files or your CLAUDE.md. It only resets the conversational context in memory. Your context window returns to its maximum capacity of 200,000 tokens.

> /clear
# Conversational context reset

Check your context usage before deciding between /clear and /compact. If you have consumed more than 80% of the window, /clear is often more effective than compaction. Check the slash commands tips to know when to favor one over the other.

an average session consumes about 50,000 tokens before needing a /clear or /compact.

Key takeaway: /clear erases the conversation but preserves project memory - use it when you switch tasks.


How to optimize context with /compact?

Type /compact to compress the conversation history without losing essential information.

The /compact command is an intelligent summarization mechanism. Claude Code condenses previous exchanges into a structured summary, freeing up space in the context window. You can also add an optional prompt to guide the compaction.

> /compact
# Compresses history while keeping key points

> /compact "focus on the API modifications"
# Compresses while prioritizing the API context
Criterion/clear/compact
History preservedNoYes (summary)
Tokens freed100%60-80%
Files affectedNoneNone
Use caseTask switchTask continuity

In practice, /compact reduces token consumption by 70% on average while preserving key technical decisions. To dive deeper into context management strategies, check the context management FAQ.

SFEIR Institute recommends using /compact every 30 to 45 minutes during long sessions to maintain response quality.

Key takeaway: /compact is your primary tool for long sessions - it preserves useful context while freeing up space.


How to monitor costs with /cost?

Run /cost to display in real time the number of tokens consumed and the estimated cost of your session.

This command breaks down consumption between input tokens and output tokens. You see the cumulative cost since the session start, expressed in dollars.

> /cost
# Session cost: $0.42
# Input tokens: 45,230 | Output tokens: 12,890
# Cache: 38,200 tokens (read), 7,030 tokens (write)
MetricDescriptionUnit
Input tokensTokens sent to the modelCount
Output tokensTokens generated by the modelCount
Cache readTokens read from cacheCount
Total costSession cost estimateUSD

the average cost of a 2-hour development session with Claude Code ranges between $0.50 and $3.00 depending on usage intensity. Here is how to control your spending: combine /cost with /compact to reduce input token consumption.

For a complete view of the command architecture, browse the slash commands reference.

Key takeaway: Check /cost regularly - knowing your consumption helps you optimize your sessions.


How to manage context files with /context?

Type /context to list and manage files currently loaded in Claude Code's context window.

This command shows the files that Claude Code has read during the session. You can thus identify which files influence the responses and decide to remove or add some.

In practice, an average TypeScript project loads between 15 and 40 files into context during a refactoring session. The /context command gives you full visibility into these files.

Specifically, if Claude Code produces inconsistent responses, check with /context that the right files are loaded. This command combines with the principles detailed in the context management FAQ to keep context clean and relevant.

Key takeaway: /context shows you exactly what Claude Code "sees" - use it to diagnose imprecise responses.


How to modify settings with /config?

Launch /config to open the Claude Code configuration interface and adjust your preferences.

The /config command gives access to persistent settings: terminal theme, default model, permission level, and notification preferences. Modifications are saved in ~/.claude/settings.json.

> /config
# Opens the interactive configuration menu

You can also modify the configuration directly in the JSON file. Settings include model choice, file permissions, and activated MCP tools. To understand permission management, check the permissions and security FAQ.

Claude Code v1.0.33 (February 2026) offers more than 20 configurable settings via /config. This number increases with each update.

Key takeaway: /config centralizes all your settings - configure it once, and your preferences persist between sessions.


How to change models with /model?

Use /model to switch between available Claude models without leaving your session.

This command displays the list of models accessible with your subscription and lets you select the one that matches your task. Models available in 2026 include Claude Opus 4.6, Claude Sonnet 4.6, and Claude Haiku 4.5.

> /model
# Lists available models
# Select: claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4-5
ModelUse CaseRelative Speed
Claude Opus 4.6Complex tasks, architecture1x (reference)
Claude Sonnet 4.6Everyday development2-3x faster
Claude Haiku 4.5Simple tasks, short scripts5-8x faster

Here is how to choose: for complex multi-file refactoring, select Opus. For quick bug fixes, Haiku is sufficient and costs about 90% less. The slash commands cheatsheet summarizes these choices in a quick reference table.

Key takeaway: /model lets you adapt the quality/cost ratio to each task - switch between models depending on complexity.


How to connect or disconnect with /login and /logout?

Type /login to authenticate with the Anthropic API directly from the terminal.

The /login command opens an authentication flow that stores your API key or OAuth session. You do not need to manually handle environment variables.

> /login
# Opens the Anthropic authentication flow

> /logout
# Removes local credentials

The /logout command removes locally stored credentials. This action does not revoke your API key server-side - it only removes the local reference. In practice, /logout is useful when you share a machine or when you switch between a personal and enterprise account.

For multi-environment configurations, the headless mode and CI/CD FAQ details automated authentication via environment variables.

Key takeaway: /login and /logout manage your credentials locally - use /logout systematically on shared machines.


How to use persistent memory with /memory?

Run /memory to open and directly edit your CLAUDE.md file from the Claude Code session.

Persistent memory is the mechanism by which Claude Code retains your preferences between sessions. The CLAUDE.md file stores this information and /memory gives you direct access to read or modify it.

> /memory
# Opens CLAUDE.md in the integrated editor

Claude Code automatically loads 3 memory levels: global CLAUDE.md (~/.claude/CLAUDE.md), project-level (./CLAUDE.md), and subfolder ones. The recommended total capacity is 500 lines maximum per file.

Specifically, add instructions in your CLAUDE.md such as "always use absolute imports" or "commit in English". Claude Code will apply these rules at each session. SFEIR uses this feature to standardize code conventions across its teams. Explore the CLAUDE.md memory system to master all its subtleties.

Key takeaway: /memory is your shortcut to durable customization - every instruction added improves future sessions.


How to undo an action with /rewind?

Type /rewind to return to a previous conversation state and undo Claude Code's latest actions.

This command works like a git revert for your session. It undoes file modifications made by Claude Code during the last exchanges. You select the restore point from the displayed history.

> /rewind
# Displays the action history and allows you to go back

/rewind is particularly useful when Claude Code modifies a file incorrectly. Instead of correcting manually, you return to the previous state in one command. 25% of developers use /rewind at least once per session.

To go further in mastering these commands, the tips guide offers workflows combining /rewind and /compact.

Key takeaway: /rewind is your safety net - it undoes errors without leaving the session or losing the rest of the context.


How to diagnose a problem with /doctor?

Launch /doctor to run a complete diagnostic of your Claude Code installation and identify configuration problems.

This command automatically checks the API connection, Node.js version, file permissions, and environment configuration. The result displays a green/red status for each check.

> /doctor
# API connection: OK
# Node.js version: 22.x
# Authentication: Valid
# MCP servers: 1 error (server "github" not responding)
CheckWhat Is TestedAction If Failed
API connectionConnectivity to Anthropic serverCheck proxy/firewall
Node.js versionVersion >= 18 requiredUpdate Node.js
AuthenticationToken validityRe-run /login
MCP serversMCP server statusReconfigure the server

In practice, /doctor runs 8 checks in under 5 seconds. Run it first when Claude Code behaves unexpectedly. For issues related to MCP servers, check the MCP: Model Context Protocol FAQ.

If /doctor reports an installation problem, the installation and first launch FAQ details the resolution steps.

Key takeaway: /doctor is your first troubleshooting reflex - 90% of common problems are identified by this command.


Can you create your own custom slash commands?

Yes, create custom commands by adding Markdown files to the .claude/commands/ directory of your project.

Each .md file in this directory becomes a slash command accessible in your session. The file name (without extension) defines the command name. The file content is sent as a prompt to Claude Code.

# Create a custom /review command
$ mkdir -p .claude/commands
$ echo "Analyze the modified code and suggest improvements.
Check: performance, security, readability." > .claude/commands/review.md

# Usage
> /review

You can also use the $ARGUMENTS variable in your command files to accept dynamic parameters. SFEIR Institute teams use custom commands to standardize code reviews and deployment workflows.

The complete commands reference page details the advanced syntax for custom commands, including the use of variables and templates.

Key takeaway: custom commands turn your repetitive workflows into one-keystroke shortcuts - invest 5 minutes creating them and save hours.


What are the shortcuts for combining multiple slash commands?

Combine slash commands sequentially to create efficient workflows adapted to your daily tasks.

There is no pipeline syntax between slash commands. However, you can chain commands in a logical order to optimize your sessions. Here are the most useful combinations:

  1. Session start: /login -> /init -> /model (authentication, initialization, model selection)
  2. Long session: /cost -> /compact -> /cost (check, compress, re-check)
  3. Troubleshooting: /doctor -> /clear -> /login (diagnose, reset, reconnect)
  4. Session end: /cost -> /memory -> /logout (summary, save, disconnect)

To master these combined workflows, the SFEIR Institute Claude Code training dedicates a full day to hands-on tool learning, with practical labs on each slash command and situational exercises.

If you want to go further, the AI-Augmented Developer 2-day training integrates Claude Code into a complete development workflow, covering code generation, debugging, and automated testing. Experienced developers can opt for the AI-Augmented Developer - Advanced one-day training, focused on advanced use cases like headless mode and CI/CD integrations.

Find the complete summary in the slash commands cheatsheet, designed to be printed or pinned next to your screen.

Key takeaway: the power of slash commands reveals itself in combination - memorize 3-4 typical workflows to gain fluidity.


Are there security-specific slash commands?

The commands /login, /logout, and /config cover the security aspects of Claude Code with credential and permission management.

Claude Code applies a granular permission system controllable via /config. You define which tools Claude Code can use automatically and which require your explicit approval. By default, read operations are authorized, but writes and command executions require confirmation.

Permissions are divided into 3 levels: read-only (authorized by default), file writing (confirmation required), and bash command execution (confirmation required). Claude Code v1.0.33 offers 5 distinct permission modes.

For a complete guide on permission configuration and security best practices, explore the permissions and security FAQ which details each authorization level.

Key takeaway: security in Claude Code relies on an explicit permissions model - configure your permission levels from the first session.

Recommended training

Claude Code Training

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

View program