C Claude Code Internals
| EN | ES

斜杠命令

Claude Code 在 src/commands.ts 中注册约 100 个斜杠命令。它们分为 5 个类别:核心用户面向、平台限制、隐藏、功能标志控制和仅 Anthropic 内部。

~100 总命令数 5 类别 3 命令类型
i 命令类型
每个命令都有一个类型:local(本地运行,无模型调用)、 local-jsx(渲染交互式 React/Ink UI)或 prompt(将提示词注入到对话中并调用模型)。 通过 /skill-name 调用的技能是由 SkillTool 单独处理的第四类。

类别 1:核心用户命令(约 45 个)

始终在 /help 和自动完成中可见。在所有环境中可用。

Command Type Description
/clear reset, new local 清除对话历史。与 /compact 不同,不保留摘要。
/compact local 清除历史但保留摘要。接受自定义摘要指令。
/model local-jsx 更改 AI 模型。如未指定模型则显示交互式选择器。
/config settings local-jsx 打开交互式配置面板。
/memory local-jsx 打开 CLAUDE.md 内存文件编辑器。
/diff local-jsx 未提交更改的可视化差异和每轮差异。
/cost local Token 使用和成本分解。对 claude.ai 订阅者隐藏。
/resume continue local-jsx 按 ID 或搜索词重新打开之前的对话。
/vim local 切换输入编辑器的 Vim 键绑定。
/theme local-jsx 打开交互式主题选择器。
/doctor local-jsx 运行安装、配置、API、hooks 和 MCP 服务器的诊断。
/export local-jsx 将对话导出到文件(markdown、JSON)或剪贴板。
/mcp local-jsx 管理 MCP 服务器:启用/禁用单个服务器或显示所有状态。
/context local-jsx 将上下文窗口使用情况可视化为彩色网格。
/plan local-jsx 进入计划模式或查看当前会话计划。
/permissions allowed-tools local-jsx 管理工具允许/拒绝规则的交互式 UI。
/help local-jsx 显示所有可用命令、快捷键和使用信息。
/init prompt 分析代码库并创建 CLAUDE.md 文件。还使用 NEW_INIT 标志创建技能和 hooks。
/review prompt 使用 gh pr diff 和 gh pr view 审查 PR。查找 bug 和安全问题。
/pr-comments prompt 使用 gh CLI 获取并格式化 GitHub PR 的评论。
/security-review prompt 对当前分支与 origin/HEAD 的更改进行详尽的安全审查。
/branch fork* local-jsx 在当前点创建对话分支以进行并行探索。
/fast local-jsx 切换快速模式(相同模型,更快输出,贵 6 倍)。
/rename local-jsx 重命名当前对话会话。
/copy local-jsx 将 Claude 的最后响应(或第 N 个最新)复制到剪贴板。
/rewind checkpoint local 将代码和对话状态恢复到之前的检查点。
/hooks local-jsx 显示所有配置的 hooks 及其触发事件。
/skills local-jsx 列出所有来源的所有可用技能。
/status local-jsx 综合状态报告:版本、模型、账户、API、工具状态。
/tasks bashes local-jsx 列出和管理后台任务和运行中的代理。
/add-dir local-jsx 向会话范围添加额外的工作目录。
/color local-jsx 设置当前会话的提示栏颜色。
/effort local-jsx 控制模型应用的思考量(low/medium/high/max/auto)。
/keybindings local 打开 ~/.claude/keybindings.json 进行编辑。
/release-notes local 显示当前版本的发行说明。
/stats local-jsx 显示使用统计和活动历史。
/btw local-jsx 提出附带问题而不中断主对话流。
/exit quit local-jsx 退出 Claude Code。
/agents local-jsx 管理自定义代理配置。
/plugin plugins, marketplace local-jsx 从 Claude Code marketplace 管理插件。
/ide local-jsx 显示 IDE 集成状态(VS Code、JetBrains)并管理连接。
/feedback bug local-jsx 提交反馈或 bug 报告。
/insights prompt 生成 Claude Code 使用会话的分析报告。
/statusline prompt 通过 statusline-setup 代理配置 shell 状态行。
/stickers local 打开页面订购实体 Claude Code 贴纸。

* /fork alias only active when FORK_SUBAGENT flag is inactive

类别 2:平台限制(约 15 个)

仅在特定平台上可用(claude.ai 或 Anthropic 控制台)。

Command Platform Description
/usage claude-ai Shows current plan usage and limits.
/upgrade claude-ai Upgrade flow for Max plan (disabled for enterprise).
/desktop claude-ai Hands off the current session to Claude Desktop (macOS/Windows).
/mobile any Shows QR code to download the Claude mobile app.
/chrome claude-ai Configures Claude in Chrome browser extension.
/login any OAuth login flow for Anthropic account.
/logout any Signs out of the current Anthropic account.
/install-github-app claude-ai, console Sets up Claude as a GitHub Actions workflow for a repo.
/install-slack-app claude-ai Installs the Claude app in Slack.
/extra-usage any Configures overage usage when rate limits are hit.
/privacy-settings any Privacy settings management (consumer subscribers only).
/passes any Generates referral passes for free weeks of Claude Code.
/session remote only Shows URL and QR code for the current remote session.
/remote-env claude-ai Configures the default remote environment for teleport sessions.
/sandbox sandboxable Configures sandbox mode for command execution.

类别 3:隐藏命令(4 个)

这些命令存在但不在 /help 或自动完成中显示。

/output-style hidden

Deprecated. Redirects to /config.

/heapdump hidden

Dumps the JavaScript heap to ~/Desktop. Internal debugging tool.

/rate-limit-options hidden

Automatically triggered when rate limits are hit. Shows recovery options. claude.ai only.

/thinkback-play hidden

Plays the thinkback animation. Gated by tengu_thinkback feature flag.

类别 4:功能标志控制(约 15 个)

仅在构建时启用特定功能标志时出现。

Feature flag Command Description
PROACTIVE / KAIROS /proactive Toggle proactive / autonomous mode
KAIROS / KAIROS_BRIEF /brief Toggle brief output mode
KAIROS /assistant Assistant mode command
BRIDGE_MODE /bridge IDE bridge mode
VOICE_MODE /voice Toggle voice input mode
HISTORY_SNIP /force-snip Force history snip
WORKFLOW_SCRIPTS /workflows Manage workflow scripts
CCR_REMOTE_SETUP /web-setup Setup Claude Code on the web
KAIROS_GITHUB_WEBHOOKS /subscribe-pr Subscribe to PR webhooks
ULTRAPLAN /ultraplan Ultra planning mode
FORK_SUBAGENT /fork Fork sub-agent (replaces /branch alias)
BUDDY /buddy Buddy companion
tengu_thinkback /think-back 2025 Year in Review
tengu_ultrareview /ultrareview Deep bug-finding review (~10-20 min)

类别 5:Anthropic 内部(约 22 个)

仅在 process.env.USER_TYPE === 'ant' 时启用。 在外部构建中,它们被标记为禁用和隐藏。

Command Description
/files List all files currently in context
/tag Toggle a searchable tag on the current session
/version Print the version this session is running
/commit Create git commits with proper attribution
/commit-push-pr Full flow: commit, push, and create PR
/issue Report a model-related issue
/share Upload full session transcript for product bugs
/init-verifiers Create verifier skill(s) for automated verification
/bridge-kick Inject bridge failures for recovery testing
/backfill-sessions Backfill session data
/break-cache Force cache invalidation
/bughunter Bug hunting tool
/good-claude Good Claude reward
/ctx_viz Context visualization (internal)
/mock-limits Mock rate limits for testing
/onboarding Onboarding flow
/summary Session summary
/teleport Teleport to remote environment
/reset-limits Reset rate limits
/ant-trace Anthropic tracing
/perf-issue Performance issue reporting
/env Environment inspection

总结

Category Count
Core user commands ~45
Platform-restricted ~15
Hidden 4
Feature-flag gated ~15
Anthropic-internal ~22
Total ~100

Additionally, the system dynamically loads skill commands from /.claude/skills/, plugin commands, MCP commands, and workflow commands (if WORKFLOW_SCRIPTS is active).

大多数用户不知道的三个命令
/btw 让你提出附带问题而不影响主对话。 /rewind 将代码和对话状态恢复到之前的检查点。 /branch 分叉对话,这样你可以从同一点探索两种方法而不会丢失任何一个。