Boost Your Productivity 10× with Claude Code Slash Commands
This guide walks through every built‑in slash command in Claude Code, explains when and how to use each one, shows concrete demos and tips for session management, context handling, model control, code review, and background tasks, helping developers dramatically increase efficiency.
Overview
The author introduces Claude Code’s slash commands, which appear when you type / and cover session management, context control, parallel execution, and more. Using these commands correctly can save time and reduce token usage.
1. Session Management
/clear – Clears the current conversation to start fresh. Useful when switching to a new task; the previous context can be restored later with /resume.
/compact – Compresses the conversation to free up context space. When the token window reaches ~95%, Claude auto‑compresses, but the author recommends running it manually after each logical step (e.g., after debugging a bug). Example:
/compact 重点保留 API 接口的设计决策和参数定义.
/resume – Restores a cleared or previous conversation. You can select a specific session from the selector or specify a name/ID, e.g., /resume 昨天的重构任务.
/branch and /fork – Create a new branch from the current dialogue to explore alternative solutions without affecting the original flow. Example: /branch 试试用 Redis 替代内存缓存的方案.
/rewind – Reverts the conversation and code to an earlier checkpoint, similar to git reset. You choose the target node from a popup.
2. Information & Diagnosis
/usage – Shows token consumption and estimated cost. Important to avoid unexpected charges; note that third‑party models may report inaccurate costs.
/context – Visualizes current context usage as a colored grid. Adding all expands details. The author pairs it with /compact to decide when to compress.
/diff – Opens an interactive diff viewer for uncommitted changes. The author suggests using a GUI diff tool for large changes.
/status – Opens the settings tab showing version, model, account, and connection status. Can be invoked while Claude is busy.
/help – Lists all available commands with brief descriptions.
/insights – Generates an analysis report of your Claude Code usage, including frequent directories, interaction patterns, and problem areas.
3. Model & Mode Control
/plan – Enters planning mode, prompting Claude to produce an execution plan before writing code. Example: /plan 重构整个项目,增加用户系统和 JWT 认证.
/goal – Sets a completion condition so Claude works autonomously until the condition is met. The author warns to write verifiable conditions (e.g., test exit code 0) and to add a safety limit, e.g.,
/goal 把所有 API 调用迁移到 v2 格式,直到测试通过,如果 20 轮还没搞定就停下来.
/model , /effort , /fast – Adjust the underlying AI model, reasoning effort (low to max), and enable fast mode (≈2.5× speed, higher token price).
4. Configuration & Extensions
/config – Opens the settings UI for theme, model, output style, etc.
/mcp , /skills , /plugin – Manage MCP server connections, custom skill lists, and plugin bundles. These are rarely needed after initial setup.
5. Code Review
/review – Reviews the current branch’s pull request, automatically launching parallel agents to find bugs.
/simplify – Reviews recent changes and directly applies fixes for code reuse, quality, and efficiency. You can focus the fix, e.g., /simplify 重点关注内存效率.
/ultrareview – A deeper cloud‑based multi‑agent review that consumes extra usage credits (three free runs for Pro/Max users).
6. Agents & Parallel Execution
/agents – Shows and configures sub‑agents; most users let Claude manage them automatically.
/tasks – Lists background tasks in the current session; selecting a task shows its detailed output.
/background – Detaches the whole session to run in the background, freeing the terminal. You can add a final instruction, e.g.,
/background 编写单元测试并运行,执行失败则自动修复.
/loop – Sets a periodic task, such as /loop 5m 检查项目前后端的部署状态. The author cautions about forgetting to stop loops, which can waste resources.
Conclusion
The author emphasizes that you don’t need to memorize every command; simply typing / shows the list, and describing your intent in Chinese lets Claude pick the appropriate command automatically. Mastering these slash commands can significantly reduce cognitive load in the AI‑assisted programming workflow.
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.
Java Tech Enthusiast
Sharing computer programming language knowledge, focusing on Java fundamentals, data structures, related tools, Spring Cloud, IntelliJ IDEA... Book giveaways, red‑packet rewards and other perks await!
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.
