8 Essential Claude Code Slash Commands to Double Your Productivity
The article reveals eight high‑frequency slash commands for Claude Code—/init, /clear, /compact, /model, /permissions, /review, /cost, and /memory—explaining when and how to use each, providing concrete code examples, and showing how they can dramatically improve development efficiency and reduce token costs.
Many users install Claude Code but only type prompts in the chat box, wasting up to two hours a day. This guide presents eight slash commands that unlock the tool’s full potential.
/init – Initialize a new project
Running /init in a project directory makes Claude scan the codebase and generate a CLAUDE.md file that serves as a project brief, including structure, tech stack, coding standards, and build commands.
# In the project folder
/init
# Or specify a path
/init /path/to/your/projectAfter generation, manually add team‑specific rules (e.g., ESLint enforcement, camelCase naming) so Claude follows them precisely.
/clear – Reset the conversation before switching tasks
When moving between unrelated modules, residual context can corrupt Claude’s output and waste tokens. /clear wipes the conversation history, giving Claude a clean slate.
Switching to a completely different feature module
Finishing a task and starting a new one
Claude’s answers start drifting
Want to save tokens
/clearPractical tip: run /clear after each small feature; it improves answer accuracy and cuts token usage by over 40%.
/compact – Compress long conversations
Unlike /clear, /compact summarizes the existing dialogue, keeping key information while freeing context space, which speeds up Claude’s responses.
Conversation has become long and slow
Context is nearly full but you need to continue the current task
Taking a break in a long task and resuming later
# Simple compression
/compact
# Compression with focus on a topic
/compact authenticationUse /clear when changing tasks; use /compact when staying on the same task but needing a lighter context.
/model – Switch AI models to save cost
Claude Code supports three models:
Haiku : fast, low‑cost, ideal for comments and formatting
Sonnet : best‑value, suitable for everyday development
Opus : most capable, for complex architecture and deep reasoning, but highest token consumption
# List models
/model
# Switch model
/model sonnet
/model haiku
/model opusPractical tip: use Haiku for simple tasks, Opus for heavy debugging or design, and Sonnet for most work; this can cut token usage by nearly half compared to always using Opus.
/permissions – Fine‑grained control over AI actions
The command lets you specify which tools Claude may run automatically and which require manual confirmation, crucial for enterprise projects.
# View current permissions
/permissions
# Allow a tool
/allow Edit
# Deny a tool
/deny Bash
# Reset to defaults
/reset-permissions/review – Automated code review
/reviewanalyzes current changes, checking code quality, potential bugs, and best‑practice adherence.
# Review all changes
/review
# Review a specific file
/review src/components/Button.tsxTypical workflow: develop a feature → run /review → fix reported issues → submit.
/cost – Monitor token usage and cost
/costdisplays the number of tokens used, estimated expense, and input/output token ratios.
/costPractical tip: check /cost at the start of the day and every half hour during long tasks; if usage spikes, consider /compact or switching to a lighter model.
/memory – Persist project knowledge
The command manages the CLAUDE.md memory file, allowing you to edit or augment it with team conventions, design patterns, business logic, and FAQs.
# View memory file
/memory
# Edit memory file
/memory editUnlike ordinary chat, the memory file persists across sessions, so Claude automatically loads it next time, eliminating repeated project briefings.
Advanced tip: combine commands
Combining commands multiplies efficiency. Examples:
# New project onboarding
/init
/memory edit
# Long‑session management
/context
/compact
/cost
# Pre‑commit review
/review
/costConclusion
Mastering these eight commands—project initialization, context clearing and compression, model switching, permission management, code review, cost monitoring, and memory handling—covers Claude Code’s core use cases and enables developers to fully leverage the AI assistant.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Old Meng AI Explorer
Tracking global AI developments 24/7, focusing on large model iterations, commercial applications, and tech ethics. We break down hardcore technology into plain language, providing fresh news, in-depth analysis, and practical insights for professionals and enthusiasts.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
