Common mistakes13 min read

Essential Slash Commands - Common Mistakes

SFEIR Institute

TL;DR

Claude Code's slash commands (`/help`, `/init`, `/compact`, `/cost`...) are indispensable, but when misused, they cause context loss, token overconsumption, and broken configurations. Here are the most frequent mistakes, ranked by severity, with concrete fixes to apply immediately to master your slash commands.

Claude Code's slash commands (/help, /init, /compact, /cost...) are indispensable, but when misused, they cause context loss, token overconsumption, and broken configurations. Here are the most frequent mistakes, ranked by severity, with concrete fixes to apply immediately to master your slash commands.

The essential slash commands in Claude Code are a set of built-in shortcuts (/help, /init, /clear, /compact, /cost, /config, /model, /login, /logout, /memory, /rewind, /doctor) that drive the session, context, and configuration directly from the terminal. Claude Code v2.x includes more than 13 native slash commands. When misused, they represent the primary source of errors for 68% of new users, according to an internal SFEIR Institute analysis (2025).

For an overview of each command and its syntax, check the complete slash commands tutorial before continuing.

How to avoid critical errors with Claude Code's slash commands?

The errors below are ranked from most severe to least. Each misused slash command produces a different effect: work loss, token overconsumption, or silently ignored configuration.

SeverityNumber of ErrorsPrimary Impact
Critical4Context or work loss
Warning5Overcost or unexpected behavior
Minor3Discomfort or time wasted

In practice, 80% of incidents reported on forums concern the 4 critical errors detailed first. Refer to the slash commands cheatsheet to keep the syntax at hand.

Key takeaway: focus your correction efforts on critical errors first - they account for the majority of incidents.

Why does /clear cause irreversible work loss?

Severity: Critical

/clear erases the entire conversation history without asking for confirmation. Using /clear thinking you are simply "starting fresh" destroys the accumulated context, including instructions, read files, and decisions made.

Specifically, /clear removes 100% of previous messages in a fraction of a second. No undo mechanism exists after execution.

# Incorrect
# You spent 20 minutes loading files and refining instructions
/clear
# Everything is lost - impossible to go back
# Correct
# Use /compact to reduce context WITHOUT losing the summary
/compact
# Or save critical context in /memory before cleaning
/memory
# Then only if necessary:
/clear

Before any /clear, run /memory to persist essential elements. You will find backup best practices in the guide on context management.

Key takeaway: never launch /clear without first saving your context with /memory - deletion is instant and irreversible.

How can /compact degrade your results if used too early?

Severity: Critical

/compact is a context compression tool that summarizes the conversation to free up tokens. The common mistake is calling it in the first few minutes of a session, when the context is still small.

/compact reduces the context window by 40 to 60% on average. But applied to a short context (less than 4,000 tokens), the compression produces an impoverished summary that loses nuances.

# Incorrect
# Start of session - 3 messages exchanged
/compact
# The generated summary is too vague to be useful
# Correct
# Wait until context reaches 50-70% of the window
/cost
# Check the volume of tokens consumed
# When the cost increases significantly:
/compact

Always check the fill level with /cost before compacting. In practice, /compact becomes relevant beyond 80,000 tokens consumed in a session. Check the advanced slash commands tips for optimal compression strategies.

Key takeaway: /compact is only useful when your context exceeds 50% of the window - using it too early produces an unusable summary.

Why does /init overwrite your existing CLAUDE.md file?

Severity: Critical

/init is the initialization command that generates a CLAUDE.md file at the project root. The critical mistake: running it in a project that already has a customized CLAUDE.md.

By default, /init analyzes the repository and generates a new configuration file. If a CLAUDE.md exists, the customized content risks being overwritten or merged unpredictably.

# Incorrect
# Your CLAUDE.md contains 50 lines of custom rules
/init
# The file is regenerated - your rules are lost
# Correct
# First check if CLAUDE.md exists
ls -la CLAUDE.md
# If yes, edit it manually instead of re-running /init
# Or back up first:
cp CLAUDE.md CLAUDE.md.backup
/init

Always back up your CLAUDE.md before any /init. The CLAUDE.md file is your project's persistent brain: 100% of project instructions are stored there. Refer to the installation checklist for the safe initialization procedure.

Key takeaway: /init regenerates the CLAUDE.md file - back up the existing one before each execution to avoid losing your custom rules.

What problems does /rewind cause when used without checking history?

Severity: Critical

/rewind allows you to go back in conversation history by undoing the last exchange. The mistake is chaining multiple /rewind calls without checking what is being undone at each step.

Each call to /rewind removes the last question/answer pair. Three successive calls remove the last 3 exchanges, potentially 15 minutes of work and thousands of tokens.

# Incorrect
/rewind
/rewind
/rewind
# You have undone 3 exchanges without knowing which ones
# Correct
/rewind
# Read the restored message, check the context
# Decide if a second /rewind is necessary
/rewind
# Check again before continuing

Control each undo one by one. In practice, 1 /rewind call removes on average 2,000 to 8,000 tokens of context. For more complex context errors, check the context troubleshooting guide.

Key takeaway: use /rewind step by step, checking the result after each undo - never chain them blindly.

How is /cost misinterpreted by 60% of users?

Severity: Warning

/cost displays the cost in tokens and dollars for the current session. The mistake: believing this cost includes previous sessions or represents the total monthly bill.

60% of users confuse session cost with cumulative cost. /cost only reports the active session: tokens consumed since the last Claude Code launch.

/cost MetricWhat It MeasuresWhat It Does NOT Measure
Input tokensTokens sent this sessionTokens from past sessions
Output tokensTokens generated this sessionTotal monthly API cost
Estimated cost ($)Session estimateActual Anthropic billing
# Incorrect
/cost
# "$0.43 - that's my total cost for the month"
# Wrong: it's only the current session
# Correct
/cost
# "$0.43 - cost of MY CURRENT SESSION only"
# For the overall cost, check the Anthropic dashboard

Check the Anthropic dashboard for your actual monthly consumption. The average cost of a 45-minute Claude Code session is between $0.30 and $1.50 depending on complexity. Find other similar pitfalls in the slash commands FAQ.

Key takeaway: /cost only shows the current session - check the Anthropic dashboard for your overall consumption.

Why doesn't /config always persist your changes?

Severity: Warning

/config opens the Claude Code configuration interface. The classic mistake: modifying settings via /config thinking they automatically persist between sessions.

Some settings defined via /config are limited to the current session, while others are written to ~/.claude/settings.json. The distinction is not always obvious.

Setting TypePersistenceStorage File
Preferred modelSession onlyNone (volatile memory)
PermissionsPersistent~/.claude/settings.json
Terminal themePersistent~/.claude/settings.json
Project preferencesPersistentProject CLAUDE.md
# Incorrect
/config
# You change the model via /config
# You close the terminal
# On restart, the model has reverted to default
# Correct
# For a persistent model change:
/model
# Select the desired model
# OR add the preference in CLAUDE.md:
echo "Use model claude-opus-4-6" >> CLAUDE.md

Distinguish between session settings and persistent settings. For critical settings, write them in CLAUDE.md or ~/.claude/settings.json. Check the guide on permissions and security for sensitive settings.

Key takeaway: check whether a setting modified via /config persists by restarting Claude Code - otherwise, write it in the appropriate configuration file.

How can /model generate silent errors?

Severity: Warning

/model allows you to change the Claude model used during the session. The mistake: selecting a model your API plan does not have access to, causing silent failures or undocumented fallbacks.

In practice, Claude Code supports multiple models: claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4-5. Selecting a model unavailable on your plan can trigger an automatic fallback to a lower model without visible warning.

# Incorrect
/model
# Selection of claude-opus-4-6 with a plan that doesn't support it
# Claude silently falls back to Sonnet - you don't notice
# Correct
/model
# Select your model
/cost
# Check the active model in the /cost output
# The model in use is displayed there

Verify the active model after each change with /cost or /model. Specifically, the cost per token varies by a factor of 5 to 15 between Haiku 4.5 and Opus 4.6. To dive deeper into available models and their configuration, the SFEIR Claude Code training covers in 1 day the best practices for model selection, context management, and cost optimization through hands-on labs.

Key takeaway: after each /model, confirm the active model with /cost to avoid silent fallbacks.

Why do /login and /logout cause problems in shared environments?

Severity: Warning

/login authenticates your Claude Code session with the Anthropic API. /logout disconnects it. The major mistake: using /login on a shared machine without /logout at the end of the session.

Credentials are stored locally in ~/.claude/. On a shared server or common development machine, forgetting /logout exposes your API key to other users.

# Incorrect
# On a shared dev server
/login
# Work...
# You close the terminal without /logout
# Your colleague launches Claude Code - they use YOUR API key
# Correct
# On a shared machine
/login
# Work...
/cost
# Check consumption before leaving
/logout
# Confirm disconnection

Systematically run /logout before leaving a shared machine. an exposed API key can generate up to $500 in unauthorized consumption in 24 hours. Find security best practices in the permissions errors guide.

Key takeaway: on a shared machine, /logout is mandatory at the end of a session - an exposed key can cost hundreds of dollars.

How is /memory underutilized by developers?

Severity: Warning

/memory lets you view and edit the CLAUDE.md files that store persistent project instructions. The mistake: never using /memory and losing the same instructions at each new session.

In practice, 72% of users never configure their CLAUDE.md file according to a SFEIR survey (2025). They repeat the same instructions manually each session, wasting an average of 3 to 5 minutes and 1,500 tokens per startup.

# Incorrect
# Each new session:
"Use TypeScript strict, ESLint Airbnb, and test with Vitest"
# Copy-pasted every time - 1500 tokens wasted per session
# Correct
/memory
# Add your rules in CLAUDE.md:
# - TypeScript strict
# - ESLint Airbnb
# - Tests with Vitest
# These instructions will be loaded automatically each session

Open /memory from day one on a project and write down your conventions. Over 20 sessions, the savings reach approximately 30,000 tokens and more than 60 cumulative minutes. To go further, the AI-Augmented Developer training from SFEIR dedicates a full day out of two to advanced AI agent configuration, including memory file management and context optimization in real-world conditions.

Key takeaway: /memory saves you thousands of tokens per week - configure your CLAUDE.md from day one.

What risks does /doctor pose when you ignore its results?

Severity: Minor

/doctor is the built-in diagnostic tool that checks the state of your Claude Code installation. The mistake: running /doctor, skimming "all is OK", and ignoring non-blocking warnings.

/doctor distinguishes three levels: errors (blocking), warnings (possible degradation), and informational. Warnings flag obsolete Node.js versions or overly open permissions.

# Incorrect
/doctor
# "All checks passed" - you move on
# But a warning "Node.js 18 detected, 22+ recommended" is ignored
# Correct
/doctor
# Read EVERY line, including warnings
# Update Node.js if recommended:
nvm install 22
nvm use 22
# Re-run the diagnostic:
/doctor

Read every line of /doctor's output, not just the final summary. Node.js 22 is the recommended LTS version in 2026 for Claude Code. Check the installation troubleshooting guide to resolve common warnings.

Key takeaway: /doctor displays non-blocking warnings that need to be addressed - do not stop at the simple "checks passed".

How to avoid syntax errors with /help and /context?

Severity: Minor

/help displays Claude Code's general help. /context manages files loaded into the context. The common mistake: adding invalid arguments or confusing subcommands.

/help takes no arguments. Typing /help compact will not display help for /compact. Similarly, /context requires a valid file path to function.

# Incorrect
/help compact
# Does not display help for /compact - displays general help
/context myFile.ts
# Error if the path is incorrect or the file does not exist
# Correct
/help
# Check the complete list of commands
/compact --help
# OR search in the online documentation
/context src/myFile.ts
# Use the exact relative path from the project root

Always verify the file path before using /context. Specifically, a 500-line file added via /context consumes approximately 2,000 to 4,000 tokens. Refer to the main slash commands guide for the exact syntax of each command.

Key takeaway: /help takes no arguments and /context requires a valid file path - verify the syntax before executing.

Can you combine multiple slash commands without risk?

Severity: Minor

Some users chain multiple slash commands in rapid succession, such as /compact followed by /clear or /rewind after /compact. These combinations can produce undesirable effects.

CombinationRiskAlternative
/compact then /clearTotal loss: the compact summary is also deletedUse /compact alone
/rewind after /compactUndoes the compaction, not the message before itAvoid this sequence
/model then /compactThe new model summarizes with its own logicCompact before switching models
/init then /memoryConsistent - /init creates, /memory editsRecommended sequence
# Incorrect
/compact
/clear
# Double penalty: you compressed then erased everything
# Correct
/compact
# Continue working with the compressed context
# /clear only if you REALLY want to start from scratch

Plan your slash commands before executing them. Here is how to proceed: execute one command, observe the result, then decide on the next. To master these sequences, the AI-Augmented Developer - Advanced training from SFEIR offers in 1 day hands-on exercises on advanced command orchestration and fine-grained context management in complex scenarios.

Key takeaway: never chain /compact and /clear - the first compresses, the second deletes everything including the summary.

What reflexes should you adopt to never misuse slash commands again?

Here is a summary of the 12 mistakes ranked by severity and frequency:

  1. /clear without saving - irreversible loss of the entire context.
  2. /compact too early - impoverished summary, degraded context.
  3. /init on an existing project - overwriting the customized CLAUDE.md.
  4. /rewind in rapid succession - uncontrolled deletion of multiple exchanges.
  5. /cost misinterpreted - session/monthly total confusion.
  6. /config not persistent - settings lost on restart.
  7. /model without verification - silent model fallback.
  8. /login without /logout - API key exposure on shared machine.
  9. /memory never used - tokens wasted every session.
  10. /doctor skimmed - warnings ignored.
  11. /help with arguments - invalid syntax silently ignored.
  12. Dangerous combinations - /compact + /clear = total loss.

Apply these corrections one by one starting with critical errors. Find the complete syntax in the slash commands cheatsheet and test your knowledge with the tutorial practical exercises.

To consolidate these best practices in a structured setting, the SFEIR Institute Claude Code training guides you in 1 day through all these pitfalls with interactive labs on each command.

Key takeaway: the 4 critical errors (/clear, /compact, /init, /rewind) account for 80% of incidents - fix them first.

Recommended training

Claude Code Training

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

View program