productivity

>Slash Commands Reference

commandsreferenceshortcuts

Ever fumbled through Claude Code's interface, clicking through menus when a simple command would have done the job? You're not alone. Mastering slash commands is like learning keyboard shortcuts for your favorite IDE — once you know them, you'll wonder how you ever worked without them.

Slash commands are Claude Code's secret weapon for power users. They give you instant access to core functionality without breaking your flow. Whether you're clearing conversation history, checking file changes, or debugging configuration issues, these commands keep your hands on the keyboard and your focus on the code.

Essential Navigation Commands

Let's start with the commands you'll use every single session. These are your bread and butter for basic navigation and session management.

The /help command is your first stop whenever you're stuck:

/help
# Shows complete command reference with descriptions
# Useful when you forget a command or need to discover new ones

When your conversation gets cluttered with old context that's no longer relevant, /clear gives you a fresh start:

/clear
# Completely wipes conversation history
# Useful when switching to a new project or debugging session

For those times when you need a clean slate but don't want to lose everything, /compact is your friend:

/compact
# Intelligently summarizes and compresses conversation context
# Keeps important information while reducing token usage
# Perfect for long sessions that are hitting context limits

Pro tip: Use /compact instead of /clear when you're in the middle of a complex project. It preserves the essential context while freeing up space for new interactions.

Session Management Commands

Understanding your current session state is crucial for effective debugging and project management. These commands give you visibility into what Claude Code is tracking behind the scenes.

The /status command provides a comprehensive overview of your current session:

/status
# Displays:
# - Active files being tracked
# - Current working directory
# - Session duration and token usage
# - Any pending operations

This is particularly useful when you're returning to a project after a break or when things aren't behaving as expected. You can quickly see what files Claude Code is aware of and whether there are any background processes running.

For configuration issues, /config is your diagnostic tool:

/config
# Shows current configuration settings
# Allows editing of user preferences
# Displays API limits and usage statistics

Use this command when you need to verify your settings or when Claude Code isn't behaving as expected. It's also helpful for checking your API usage if you're approaching limits.

File Management and Version Control

These commands help you manage file changes and maintain visibility into your project's evolution. They're essential for any serious development work.

The /undo command is a lifesaver when Claude Code makes changes you didn't expect:

/undo
# Reverts the last file modification made by Claude
# Works on a per-file basis
# Can be chained to undo multiple changes: /undo /undo /undo

Common pitfall: /undo only works on changes made by Claude Code in the current session. It won't revert changes you made manually in your editor or changes from previous sessions.

Before committing changes or when you want to review what's been modified, /diff shows you exactly what's changed:

/diff
# Shows a git-style diff of all pending changes
# Highlights additions, deletions, and modifications
# Works across multiple files

Here's a practical workflow using these commands:

# Check current session state
/status

# Review all pending changes before committing
/diff

# If you see unexpected changes, undo them
/undo

# Check the diff again to confirm
/diff

# Clear history to start fresh if needed
/clear

Advanced Command Combinations

The real power of slash commands comes from combining them effectively. Here are some workflows that experienced Claude Code users rely on:

Project switching workflow:

/status          # Check current project state
/diff            # Review any uncommitted changes
/compact         # Compress context to save important info
# Now switch to new project

Debugging workflow:

/config          # Check configuration for issues
/status          # Verify session state
/clear           # Start with clean context if needed
/help            # Reference commands for debugging

End-of-session cleanup:

/diff            # Final review of all changes
/status          # Confirm session state
/compact         # Save context for next session

Pro Tips for Command Mastery

Muscle memory matters: Practice these commands in low-stakes situations until they become automatic. You don't want to be fumbling for the right command when you're debugging a critical issue.

Chain commands strategically: You can often execute multiple commands in sequence. For example, /diff /status gives you a comprehensive view of your current project state.

Use /help liberally: The command reference includes usage examples and flags that aren't obvious from the basic syntax. Don't memorize everything — just know that /help has the answers.

Know when to /clear vs /compact: Use /clear when starting completely fresh projects. Use /compact when you want to continue working on the same project but need to free up context space.

Bookmark common patterns: Create mental shortcuts for command sequences you use frequently. For instance, always running /status /diff before making major changes becomes second nature.

Common Pitfalls to Avoid

Don't overuse /clear: It's tempting to clear everything when things get messy, but you lose valuable context that could help with your current task. Try /compact first.

Remember command scope: Commands like /undo only work within the current session. Don't expect them to revert changes from previous sessions.

Check /status before troubleshooting: Many issues stem from Claude Code not tracking the files you think it's tracking. A quick status check often reveals the problem.

What's Next

Now that you've mastered basic slash commands, you're ready to explore more advanced Claude Code features. Consider diving into file system integration commands, learning about context management strategies, or exploring how to set up custom command aliases for your most-used sequences.

The key is to gradually incorporate these commands into your daily workflow. Start with the basics (/help, /status, /clear) and add more as they become relevant to your projects. Before long, you'll be navigating Claude Code like a seasoned pro.