Claude Code slash commands: the 10 I use every single session
If you're not using slash commands in Claude Code, you're doing it the slow way.
Slash commands are the fastest way to control Claude Code's behavior mid-session — no CLAUDE.md edits, no config files, just /command and it happens.
Here are the 10 I reach for every session.
The essentials
/clear
Resets the conversation context. Use this when Claude starts referencing stale context from earlier in the session.
/clear
When to use: after completing a major task, before switching to a new file/feature, when responses start feeling "confused".
/compact
Compresses the conversation history while keeping the important context. Different from /clear — you don't lose everything.
/compact
When to use: 50k+ tokens into a session, when you need to keep going but context is getting heavy.
/memory
Shows what Claude currently has in its "memory" — the summary of past compacted conversations.
/memory
When to use: after a /compact to verify what survived, when Claude seems to have forgotten something important.
/doctor
Diagnostic check. Shows your current Claude Code config status — API keys, model settings, MCP server connections.
/doctor
When to use: first thing when something seems broken, before assuming it's a Claude issue.
/model
Switch models mid-session without restarting.
/model claude-opus-4-5
/model claude-sonnet-4-5
/model claude-haiku-4-5
When to use: switch to Haiku for simple tasks (faster, cheaper), Opus for complex reasoning.
The power moves
/init
Generates a CLAUDE.md for the current project. Claude analyzes your codebase and writes a starter config.
/init
When to use: first time running Claude Code in a new repo. Don't skip this — it gives Claude the project context it needs.
/vim
Toggles vim keybindings in the input editor.
/vim
When to use: if you live in vim and muscle memory keeps fighting you.
/terminal-setup
Installs shell integration — lets Claude Code set the terminal title, show status in your prompt, etc.
/terminal-setup
When to use: once, during initial setup. Makes the UX noticeably better.
/bug
Sends a bug report to Anthropic directly from Claude Code, with your current session context attached.
/bug
When to use: when Claude does something genuinely broken. The session context helps Anthropic diagnose it.
/help
The one you always forget about.
/help
Shows all available slash commands with descriptions. Run it at least once — there are commands in there most people don't know exist.
Custom slash commands
You can define your own slash commands in .claude/commands/.
Create a markdown file:
mkdir -p .claude/commands
cat > .claude/commands/review.md << 'EOF'
Review the current file for:
1. Security issues
2. Performance problems
3. Code style consistency with the rest of the codebase
4. Missing error handling
Format output as a numbered list with severity (high/medium/low).
EOF
Now /review is available in any Claude Code session in this project.
Other useful custom commands to build:
# .claude/commands/deploy-check.md
Before deploying, verify:
1. All tests pass
2. No console.log statements left
3. Environment variables are documented in .env.example
4. CHANGELOG.md is updated
# .claude/commands/pr-description.md
Generate a pull request description for the current changes:
- Summary of what changed and why
- Breaking changes (if any)
- Testing instructions
- Screenshots placeholder (if UI changes)
The session startup pattern
Here's my actual session startup sequence:
# 1. Check everything is healthy
/doctor
# 2. If new project, generate CLAUDE.md
/init
# 3. Start working...
# [after 50k+ tokens]
# 4. Compress before context gets heavy
/compact
# 5. Verify what survived
/memory
# 6. Continue with confident context
Rate limits and the slash command workaround
One thing slash commands can't fix: hitting Anthropic's API rate limits mid-session.
If you're running long Claude Code sessions (especially with parallel subagents via /model switching), rate limits will interrupt you.
The cleanest fix is routing through ANTHROPIC_BASE_URL to a flat-rate proxy:
export ANTHROPIC_BASE_URL=https://simplylouie.com/api/proxy
This sends your Claude Code traffic through a proxy that removes the rate limit — useful for CI/CD pipelines and long automation sessions.
Slash commands give you control. Rate limit removal gives you continuity. Both together = uninterrupted sessions.
Quick reference
| Command | What it does | When to use |
|---|---|---|
/clear |
Reset context | Stale responses |
/compact |
Compress history | Long sessions |
/memory |
Show memory state | After compact |
/doctor |
Config diagnostic | When broken |
/model |
Switch model | Task switching |
/init |
Generate CLAUDE.md | New projects |
/vim |
Vim keybindings | Vim users |
/terminal-setup |
Shell integration | First setup |
/bug |
Report to Anthropic | Real bugs |
/help |
Show all commands | Always |
Save this table. You'll use it.
Running long Claude Code sessions? Set ANTHROPIC_BASE_URL to simplylouie.com for flat-rate API access — no rate limit interruptions, $2/month.
Top comments (0)