Claude Code: Advanced Commands Tutorial
root
Jun 27 2026
Claude Code: Advanced Commands
Slash commands control how Claude behaves, not what it does. Type / to browse them live.
Session Management
/context # See what's consuming your context window
/compact # Compress history — run at 70%, not the default 95%
/clear # Wipe session between unrelated tasks
/cost # Check token spend
/rewind # Undo file changes and restore prior state
Planning & Execution
/plan <task> # Claude explains every change before touching files
/goal <condition> # Autonomous work until condition is met (e.g. "all tests pass")
/loop 5m <check> # Recurring check on a schedule (e.g. monitor CI)
/branch # Fork session to safely explore a risky approach
/ask <question> # Side question — doesn't pollute main context
Model & Effort
/model claude-sonnet-4-6 # Switch to Sonnet for daily tasks
/model claude-opus-4-6 # Switch to Opus for complex reasoning
/model opusplan # Opus thinking + Sonnet execution (best for refactors)
/effort low|medium|high|max
Code Quality
/code-review [high] [--fix] # Review diff — optionally auto-fix
/simplify # Cleanup pass: remove duplication, improve readability
/security-review # OWASP-mapped security audit
Agents & Parallelism
/agents # Configure subagents with different models per role
/batch # Run multiple independent tasks simultaneously
Project Setup (run once per repo)
/init # Generate CLAUDE.md project memory
/permissions # Set which tools Claude can run without asking
/mcp # Manage connected MCP servers
Diagnostics
/doctor # Health check + auto-fix
/help # List all available commands
Full reference: code.claude.com/docs/en/commands
root
Just share your knowledge!