Chapter 1: Ground Zero
Using Slash Commands
Using Slash Commands
Slash commands are built-in shortcuts that give you quick access to common actions. Instead of typing a full sentence, you type a / followed by the command name.
The essential slash commands
Here are the commands you'll use most often:
/help
Shows all available commands and keyboard shortcuts.
When in doubt, start here. It lists every available command with a brief description.
/clear
Conversation history cleared. Context reset.
Wipes the conversation history and starts fresh. Use this when the conversation has drifted off-topic or you're switching to a completely different task.
If Claude Code seems confused or is referencing something from earlier that's no longer relevant, /clear is your reset button.
/compact
Conversation compacted. Summary retained, details trimmed.
This is different from /clear. Instead of wiping everything, /compact summarizes the conversation so far and keeps the summary. You get a shorter context window without losing the thread.
Use /compact when you've been working for a while and notice Claude Code getting slower or less accurate. It's like defragmenting the conversation.
/review
Claude Code reviews your uncommitted changes and provides feedback.
Asks Claude Code to review your current uncommitted changes. It reads the git diff and gives you feedback on code quality, potential bugs, and improvements. Great before committing.
/commit
Claude Code generates a commit message based on your staged changes and commits.
Claude Code looks at your staged changes, writes a meaningful commit message, and makes the commit for you. No more staring at a blank commit message wondering what to write.
When to use each
| Command | When to use it |
|---|---|
/help | You forgot a shortcut or want to discover new features |
/clear | Starting a brand new task, conversation is cluttered |
/compact | Long session, need to free up context space |
/review | Before committing, want a second pair of eyes |
/commit | Ready to commit, want a well-written message |
Don't overuse /clear. The conversation history helps Claude Code understand what you've been doing. Only clear when you're genuinely starting something new.
Combining commands with prompts
You can follow up a slash command with a regular prompt in the same session:
- Type
/compactto slim down the context - Then ask "Now let's add a form to create new todos"
- Claude Code continues with the compacted context and your new instruction
Switching models
Claude Code can run on different AI models. Use /model to switch:
"/model"
This shows you the available models. The two you'll use most:
- Sonnet — faster, great for straightforward tasks like "rename this variable" or "add a CSS class"
- Opus — more capable, better for complex reasoning like architectural decisions, debugging tricky issues, or planning multi-file changes
A good rule of thumb: use Sonnet for tasks you could describe in one sentence, and Opus for tasks that need thinking. You can switch mid-conversation — no need to start over.
These shortcuts become second nature quickly. Next, let's understand the engine behind it all -- Claude Code's context window.