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.
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.
| Severity | Number of Errors | Primary Impact |
|---|---|---|
| Critical | 4 | Context or work loss |
| Warning | 5 | Overcost or unexpected behavior |
| Minor | 3 | Discomfort 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 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: many 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 happens when the context window fills up and Claude Code forgets instructions?
Severity: Critical
The Claude Code context window reaches 200,000 tokens. 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 Metric | What It Measures | What It Does NOT Measure |
|---|---|---|
| Input tokens | Tokens sent this session | Tokens from past sessions |
| Output tokens | Tokens generated this session | Total monthly API cost |
| Estimated cost ($) | Session estimate | Actual 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 Type | Persistence | Storage File |
|---|---|---|
| Preferred model | Session only | None (volatile memory) |
| Permissions | Persistent | ~/.claude/settings.json |
| Terminal theme | Persistent | ~/.claude/settings.json |
| Project preferences | Persistent | Project 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, many never configure their CLAUDE.md file 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 slash commands?
Severity: Minor
/help displays Claude Code's general help. The common mistake: adding arguments to commands that do not accept them.
/help takes no arguments. Typing /help compact will not display specific help for /compact. Similarly, /compact --help does not work: slash commands do not accept flags.
# Incorrect
/help compact
# /help takes no arguments
/compact --help
# Slash commands do not accept flags
# 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. Slash commands do not accept flags (no --help, --verbose, etc.).
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.
| Combination | Risk | Alternative |
|---|---|---|
/compact then /clear | Total loss: the compact summary is also deleted | Use /compact alone |
/clear after /compact + work | Loss of compact summary and recent work | Continue with compressed context |
/model then /compact | The new model summarizes with its own logic | Compact before switching models |
/init then /memory | Consistent - /init creates, /memory edits | Recommended 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:
/clearwithout saving - irreversible loss of the entire context./compacttoo early - impoverished summary, degraded context./initon an existing project - overwriting the customizedCLAUDE.md.- Undetected context saturation - forgotten instructions and degraded responses.
/costmisinterpreted - session/monthly total confusion./confignot persistent - settings lost on restart./modelwithout verification - silent model fallback./loginwithout/logout- API key exposure on shared machine./memorynever used - tokens wasted every session./doctorskimmed - warnings ignored./helpwith arguments -/helptakes no arguments.- 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 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