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, /doctor) that drive the session, context, and configuration directly from the terminal. Claude Code includes dozens of native slash commands. When misused, they are a frequent source of errors for new users.

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

SFEIR Institute trainings

Claude Code Training

1 day · Fundamentals

View program

AI-Augmented Developer

2 days · Intermediate

View program

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, many 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 summarizes the conversation to free up a significant portion of the context window (the exact reduction varies with the conversation). But applied to a very small context (only a few messages in), 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 the context has grown large
/context
# Check the fill level (or use /usage)
# When the context is substantially filled:
/compact

Always check the fill level with /cost before compacting. In practice, /compact becomes worthwhile once the context has grown large (use /context or /usage to gauge fill level) rather than at a fixed token count. Check the advanced slash commands tips for optimal compression strategies.

Key takeaway: /compact is only worthwhile once the context has grown large (check the fill level with /context or /usage); 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: many instructions are stored there. Refer to the installation checklist for the safe initialization procedure.

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

What happens when the context window fills up and Claude Code forgets instructions?

Severity: Critical

The Claude Code context window goes up to 1M tokens on current models (Opus 4.6+ and Sonnet 4.6), while older models and the Bedrock/Vertex defaults cap at 200,000 tokens. Whatever the limit, when it fills up, Claude Code starts losing instructions given at the beginning of the session and response quality degrades.

Signs of a saturated context: Claude Code forgets your conventions, repeats previously corrected mistakes, or produces responses inconsistent with the start of the conversation.

# Incorrect
# You continue working without monitoring context
# After 45 minutes, Claude Code forgets your instructions
# You repeat the same guidelines without understanding why
# Correct
# Monitor your consumption regularly
/cost
# When token volume increases significantly:
/compact
# Or if you change topics:
/clear

Monitor your consumption with /cost and use /compact proactively before the context saturates. For more complex context errors, check the context troubleshooting guide.

Key takeaway: monitor your consumption with /cost and compress with /compact before the context saturates.

How is /cost misinterpreted by many?

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.

many 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. Session cost depends on task complexity and the chosen model, so use the dashboard rather than assuming a fixed per-session amount. 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
Editor modePersistent~/.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 opus" >> 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, best referenced through their aliases (opus, sonnet, haiku, plus the default, best, opusplan, opus[1m] and sonnet[1m] variants) rather than hard version numbers. The latest model is Opus 4.8, and the default is plan-dependent: Sonnet 4.6 on Pro and Team Standard, Opus 4.8 on Max, Team Premium, Enterprise and API. Selecting a model unavailable on your plan can trigger an automatic fallback to a lower model without visible warning.

# Incorrect
/model
# Selection of opus with a plan that doesn't support it
# Claude silently falls back to a lower model and you don't notice
# Correct
/model
# Select your model
/status
# /status shows the active model and account info
# Or re-open the picker with /model to confirm the selection

Verify the active model after each change with /status or /model. Token pricing differs substantially between the smaller (Haiku) and larger (Opus) models, so check current Anthropic pricing before settling on a model. 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 /status (or re-open /model) 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 be abused to run up significant unauthorized charges. 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 lead to substantial unauthorized charges.

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, many never configure their CLAUDE.md file. They repeat the same instructions manually each session, wasting tokens and time at every startup.

# Incorrect
# Each new session:
"Use TypeScript strict, ESLint Airbnb, and test with Vitest"
# Copy-pasted every time - tokens wasted on each 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. Across many sessions, persisting your conventions once saves a meaningful amount of tokens and time you would otherwise spend re-typing them. 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 a meaningful amount of tokens over time, so 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 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 slash commands?

Severity: Minor

/help displays Claude Code's general help. The common mistake: adding arguments to commands that do not accept them.

/help itself takes no arguments, and not every command accepts flags. Typing /help compact will not display specific help for /compact. Some commands do take arguments or flags (for example /compact accepts free text, and /code-review accepts options like --fix and --comment), so check each command's own syntax rather than assuming --help/--verbose works everywhere.

# Incorrect
/help compact
# /help takes no arguments
/compact --help
# /compact takes free-text instructions, not a --help flag
# Correct
/help
# Check the complete list of commands
/compact focus on the database migration
# /compact accepts free text to guide compression

Refer to the main slash commands guide for the exact syntax of each command.

Key takeaway: /help takes no arguments, and not every command accepts flags. Check each command's own syntax instead of assuming --help/--verbose works everywhere.

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. These combinations can produce undesirable effects.

CombinationRiskAlternative
/compact then /clearTotal loss: the compact summary is also deletedUse /compact alone
/clear after /compact + workLoss of compact summary and recent workContinue with compressed context
/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. Undetected context saturation: forgotten instructions and degraded responses.
  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: /help takes no arguments.
  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, context saturation) are the most frequent. Fix them first.

Recent articles about Claude

Claude Code Training

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