Claude Code Commands — Every Command Explained
A comprehensive reference to every slash command in Claude Code. Grouped by category — session management, project setup, review & quality, and utility — with practical examples showing when and why to use each one.
Quick Reference
- →/help — Show all available commands and keyboard shortcuts
- →/clear — Reset conversation context to free up the context window
- →/compact — Summarize the conversation to reclaim context space without losing important details
- →/init — Generate a CLAUDE.md file for the current project based on codebase analysis
- →/memory — Open and edit your CLAUDE.md memory files directly
- →/review — Run an AI-powered code review on your current changes
- →/cost — Display token usage and estimated cost for the current session
- →/doctor — Diagnose environment issues (API keys, permissions, tool availability)
- →/login and /logout — Manage authentication with your Anthropic account
- →/status — Show current model, context usage, and session info
- →/plan — Enter Plan Mode to reason through a task before writing code
- →/think — Ask Claude to reason step-by-step without taking action
In this article
Why Commands Matter
Claude Code is not just a chat interface — it is an agentic coding assistant with a rich command vocabulary. Slash commands give you precise control over the session, the context window, project configuration, and output quality. Learning the commands is the difference between fighting the tool and flowing with it.
You can always ask Claude to do something in plain English, but slash commands are faster, deterministic, and bypass the LLM entirely for operations like clearing context or checking cost. Use commands for session control; use natural language for creative work.
Session Management
These commands control the lifecycle of your conversation with Claude Code. They help you manage context, keep sessions focused, and avoid hitting context-window limits mid-task.
| Command | What It Does | When to Use |
|---|---|---|
| /clear | Wipes the entire conversation history and starts fresh | When you switch to a completely different task or the conversation has become cluttered |
| /compact | Summarizes the conversation into a shorter form, preserving key decisions | When the context window is getting full but you still need the conversation's context |
| /status | Shows current model, context usage percentage, and session metadata | When you want to check how much context you have left before starting a big task |
| /cost | Displays token counts and estimated dollar cost for the session | Periodically during long sessions to monitor spend |
/compact keeps a summary of what you discussed — decisions, file paths, architecture choices. /clear erases everything. Use /compact when the conversation is still relevant; use /clear when you are starting something entirely new.
Project Setup
These commands help you configure Claude Code for your specific project. Running them early in a new repo saves time on every subsequent session.
| Command | What It Does | When to Use |
|---|---|---|
| /init | Scans your codebase and generates a CLAUDE.md with project conventions, tech stack, and common patterns | First time using Claude Code in a new repo |
| /memory | Opens your CLAUDE.md files for direct editing — supports both project-level and user-level memory | When you need to add or update project conventions, coding standards, or preferences |
| /login | Authenticate with your Anthropic account or API key | First-time setup or after token expiry |
| /logout | Sign out of the current Anthropic account | When switching accounts or for security |
The /init command does a best-effort analysis. It might miss conventions or infer incorrect patterns. Always review and edit the generated CLAUDE.md before committing it to the repo.
Review & Quality
Claude Code includes built-in review capabilities that go beyond simple linting. The /review command performs a holistic code review considering correctness, security, performance, and style.
| Command | What It Does | When to Use |
|---|---|---|
| /review | Runs an AI-powered review on staged or unstaged changes, reporting issues by severity | Before committing code, during PR preparation, or as a second pair of eyes |
When your CLAUDE.md includes project-specific conventions (e.g., 'always use Result types for errors'), /review will enforce those conventions in addition to general best practices.
Reasoning & Planning
These commands shift Claude Code into a higher reasoning gear. Instead of immediately writing code, Claude will think through the problem, consider tradeoffs, and propose a plan before acting.
| Command | What It Does | When to Use |
|---|---|---|
| /plan | Enters Plan Mode — Claude reads your codebase, reasons about the task, and outputs a step-by-step plan before writing any code | Complex features, refactors, or any task touching 3+ files |
| /think | Asks Claude to reason step-by-step about a question without modifying files | Architecture decisions, debugging, or when you want analysis without action |
For any task that touches more than two or three files, start with /plan. The upfront reasoning cost is tiny compared to the cost of undoing a poorly thought-through change across your codebase.
Utility Commands
These commands handle diagnostics, help, and other operational needs that keep Claude Code running smoothly.
| Command | What It Does | When to Use |
|---|---|---|
| /help | Lists all available commands, keyboard shortcuts, and usage tips | When you forget a command or want to discover new features |
| /doctor | Runs diagnostic checks — API connectivity, file permissions, tool availability, config validity | When Claude Code is behaving unexpectedly or after environment changes |
| /bug | Files a bug report with Anthropic, automatically including relevant session context | When you encounter a reproducible bug in Claude Code itself |
| /fast | Toggles between the default model and a faster, cheaper model for simpler tasks | When you need quick answers for simple questions and want to save tokens |
Command Chaining Patterns
While commands cannot be literally chained with pipes, experienced Claude Code users develop reliable sequences — command patterns they run in a predictable order for common workflows.
New Project Setup
/login (if needed) then /init to generate CLAUDE.md, then /memory to review and refine it
Pre-Commit Review
/review to catch issues, fix them, then /cost to see how much the session used
Context Recovery
/status to check context usage, /compact if above 60%, /clear if you are starting a new task entirely
Complex Feature
/plan to outline the approach, implement step by step, /review before committing, /compact to reclaim context
The most productive Claude Code users have a small set of command sequences they run automatically. Start with the pre-commit sequence: /review then fix then commit. It catches surprising issues.
Complete Quick Reference
| Command | Category | One-Liner |
|---|---|---|
| /help | Utility | Show all commands and shortcuts |
| /clear | Session | Wipe conversation and start fresh |
| /compact | Session | Summarize conversation to save context |
| /init | Setup | Generate CLAUDE.md from codebase analysis |
| /memory | Setup | Edit CLAUDE.md memory files |
| /review | Quality | AI-powered code review on changes |
| /cost | Session | Show token usage and cost |
| /doctor | Utility | Diagnose environment problems |
| /login | Setup | Authenticate with Anthropic |
| /logout | Setup | Sign out |
| /status | Session | Show model, context, session info |
| /bug | Utility | File a bug report |
| /fast | Utility | Toggle faster/cheaper model |
| /plan | Reasoning | Enter Plan Mode for complex tasks |
| /think | Reasoning | Reason step-by-step without acting |
Best Practices
Do
- ✓Run /init when you first open Claude Code in a new repository
- ✓Use /compact proactively before the context window fills up — check with /status
- ✓Use /plan before any task that touches more than two or three files
- ✓Run /review before every commit as a quality gate
- ✓Use /think when you want analysis or architecture advice without code changes
- ✓Check /cost periodically during long sessions to avoid surprise bills
- ✓Run /doctor as a first step when Claude Code behaves unexpectedly
Don’t
- ✗Don't use /clear when you need the conversation context — use /compact instead
- ✗Don't skip /init and rely on generic behavior — project-specific context dramatically improves output
- ✗Don't ignore /review suggestions without understanding them — they often catch real bugs
- ✗Don't forget to review the CLAUDE.md generated by /init before committing it
- ✗Don't use /plan for trivial one-file changes — it adds overhead without value
- ✗Don't run /compact after every message — only when context is getting full
Key Takeaways
- ✓Slash commands give you deterministic control over session lifecycle, project setup, and quality checks
- ✓/compact and /clear manage your most precious resource: the context window
- ✓/init and /memory are the foundation of project-specific AI assistance
- ✓/plan and /think shift Claude into deliberate reasoning mode for complex tasks
- ✓/review is a surprisingly effective pre-commit quality gate
- ✓/doctor should be your first stop when troubleshooting
- ✓Building command sequences into your workflow makes Claude Code dramatically more effective
Video on this topic
Claude Code Commands in 60 Seconds
tiktok