命令完整教程:shanraisshan/claude-code-best-practice: claude-com,适用于工程实践、代码质量与开发流程优化。
命令完整教程:shanraisshan/claude-code-best-practice: claude-com,适用于工程实践、代码质量与开发流程优化。
> 来源: shanraisshan/claude-code-best-practice (64k stars) — Claude Code 完整实践指南
> 原文件: best-practice/claude-commands.md
> 模型推荐: 看 skill 类型挑
shanraisshan 在 64k stars 的仓库里整理的"Claude Code 完整实践指南" — 涵盖启动参数、commands、MCP、memory、settings、skills、subagents 等所有方面。
michael 强调"skill 要有相应的指导功能,指导用户使用",所以加了下面两节让 Agent 和用户对接。
---
1. 用户问"Claude Code 怎么用 X"时,触发对应 skill
2. skill 严格按原文指南跑
3. 涉及配置改动前 ask user 确认(避免破坏现有配置)
4. 完工后让 Agent 跑自检
1. 问 Agent "Claude Code 怎么 X"(X = 子主题)
2. 如果 Agent 改配置,确认后再继续
3. 全程 Agent 自动化,你只需回答授权类问题
---
 <br>
[](../implementation/claude-commands-implementation.md)
Claude Code commands — frontmatter fields and official built-in slash commands.
<table width="100%">
<tr>
<td><a href="../">← Back to Claude Code Best Practice</a></td>
<td align="right"><img src="../!/claude-jumping.svg" alt="Claude" width="60" /></td>
</tr>
</table>
---
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | string | No | Display name and `/slash-command` identifier. Defaults to the directory name if omitted |
| `description` | string | Recommended | What the command does. Shown in autocomplete and used by Claude for auto-discovery |
| `when_to_use` | string | No | Additional context for when Claude should invoke the skill — trigger phrases or example requests. Appended to `description` in the listing and counts toward the 1,536-character cap |
| `argument-hint` | string | No | Hint shown during autocomplete (e.g., `[issue-number]`, `[filename]`) |
| `arguments` | string/list | No | Named positional arguments for `$name` substitution in command content. Accepts a space-separated string or YAML list — names map to argument positions in order |
| `disable-model-invocation` | boolean | No | Set `true` to prevent Claude from automatically invoking this command |
| `user-invocable` | boolean | No | Set `false` to hide from the `/` menu — command becomes background knowledge only |
| `paths` | string/list | No | Glob patterns that limit when this skill is activated. Accepts a comma-separated string or a YAML list. When set, Claude loads the skill automatically only when working with files matching the patterns |
| `allowed-tools` | string | No | Tools allowed without permission prompts when this command is active |
| `disallowed-tools` | string/list | No | Tools removed from Claude's available pool while this command is active. Clears when you send your next message. The inverse of `allowed-tools` |
| `model` | string | No | Model to use when this command runs (e.g., `haiku`, `sonnet`, `opus`) |
| `effort` | string | No | Override the model effort level when invoked (`low`, `medium`, `high`, `xhigh`, `max`) |
| `context` | string | No | Set to `fork` to run the command in an isolated subagent context |
| `agent` | string | No | Subagent type when `context: fork` is set (default: `general-purpose`) |
| `background` | boolean | No | Only applies with `context: fork`. Set to `false` to wait for the forked subagent's result in the turn that invoked the skill, instead of running it in the background. Default: `true`. Requires v2.1.218+ |
| `shell` | string | No | Shell for `` !`command` `` blocks — accepts `bash` (default) or `powershell`. Requires `CLAUDE_CODE_USE_POWERSHELL_TOOL=1` |
| `metadata` | object | No | Free-form YAML map for your own key-value data. Claude Code ignores the content (which must be a map); useful for catalog or entitlement fields read by your own tooling. Do not reuse reserved field names such as `paths` as keys |
| `license` | string | No | License covering the skill per the [Agent Skills](https://agentskills.io) spec. Claude Code accepts the field but does not act on it |
| `compatibility` | string | No | Environment requirements for the skill per the [Agent Skills](https://agentskills.io) spec, such as intended products or system prerequisites. Accepts up to 500 characters. Claude Code accepts the field but does not act on it |
| `hooks` | object | No | Lifecycle hooks scoped to this command |
---
| # | Command | Tag | Description |
|---|---------|-----|-------------|
| 1 | `/design-login` |  | Authorize design-system access for `/design-sync` with your claude.ai account |
| 2 | `/login` |  | Sign in to your Anthropic account |
| 3 | `/logout` |  | Sign out from your Anthropic account |
| 4 | `/setup-bedrock` |  | Configure Amazon Bedrock authentication, region, and model pins through an interactive wizard. Only visible when `CLAUDE_CODE_USE_BEDROCK=1` is set. First-time Bedrock users can also access this wizard from the login screen |
| 5 | `/setup-vertex` |  | Configure Google Cloud's Agent Platform authentication, project, region, and model pins through an interactive wizard. Only visible when `CLAUDE_CODE_USE_VERTEX=1` is set. First-time users can also access this wizard from the login screen |
| 6 | `/upgrade` |  | Open the upgrade page to switch to a higher plan tier |
| 7 | `/color [color\|default]` |  | Set the prompt bar color for the current session. Available colors: `red`, `blue`, `green`, `yellow`, `purple`, `orange`, `pink`, `cyan`. Use `default` to reset. Run without an argument to pick a random color |
| 8 | `/config [key=value ...]` |  | Open the Settings interface to adjust theme, model, output style, and other preferences. From v2.1.181, pass one or more `key=value` pairs to set a setting directly without opening the interface, for example `/config thinking=false`. The `key=value` form also works in non-interactive (`-p`) and Remote Control modes. Run `/config help` to list the keys you can set. Alias: `/settings` |
| 9 | `/focus` |  | Toggle the focus view, which shows only your last prompt, a one-line tool-call summary with edit diffstats, and the final response. The selection persists across sessions; set `viewMode` in settings to override it. Only available in fullscreen rendering |
| 10 | `/import [codex\|gemini] [--dry-run] [--yes]` |  | Bring configuration from other coding agents on your machine (currently OpenAI Codex and Google Gemini CLI) into Claude Code, including instruction files, MCP servers, commands, subagents, and skills. In non-interactive mode (`-p`), lists what it found and gives you the command that confirms the import. `--dry-run` previews without writing; `--yes` skips the interactive picker |
| 11 | `/keybindings` |  | Open or create your keybindings configuration file |
| 12 | `/permissions` |  | Manage allow, ask, and deny rules for tool permissions. Opens an interactive dialog where you can view rules by scope, add or remove rules, manage working directories, and review recent auto mode denials. Alias: `/allowed-tools` |
| 13 | `/powerup` |  | Discover Claude Code features through quick interactive lessons with animated demos |
| 14 | `/privacy-settings` |  | View and update your privacy settings. Only available for Pro and Max plan subscribers |
| 15 | `/radio` |  | Open Claude FM lo-fi radio in your browser. Prints the stream URL when no browser is available. Not available on Bedrock, Vertex, or Foundry |
| 16 | `/sandbox` |  | Toggle sandbox mode. Available on supported platforms only |
| 17 | `/scroll-speed` |  | Adjust mouse wheel scroll speed interactively |
| 18 | `/statusline` |  | Configure Claude Code's status line. Describe what you want, or run without arguments to auto-configure from your shell prompt |
| 19 | `/stickers` |  | Order Claude Code stickers |
| 20 | `/terminal-setup` |  | Configure terminal keybindings for Shift+Enter and other shortcuts. Only visible in terminals that need it, like VS Code, Cursor, Devin Desktop, Alacritty, or Zed |
| 21 | `/theme` |  | Change the color theme. Includes light and dark variants, colorblind-accessible (daltonized) themes, ANSI themes that use your terminal's color palette, an "Auto (match terminal)" option that follows your terminal's light/dark mode, and custom themes loaded from `~/.claude/themes/` or plugins. Select "New custom theme…" to create your own |
| 22 | `/tui [default\|fullscreen]` |  | Set the terminal UI renderer and relaunch into it with your conversation intact. `fullscreen` enables the flicker-free alt-screen renderer. With no argument, prints the active renderer |
| 23 | `/voice [hold\|tap\|off]` |  | Toggle voice dictation, or enable it in a specific mode. Requires a Claude.ai account |
| 24 | `/autocompact [auto\|<tokens>]` |  | Set the auto-compact window: how full the context window gets before Claude Code compacts automatically. Pass a token count such as `500k`, or `auto` to return to the default tuned for your model. Claude Code saves the value to your settings and applies it immediately. Without an argument, opens a dialog showing the current window. Requires v2.1.221+ |
| 25 | `/context [all]` |  | Visualize current context usage as a colored grid. Shows optimization suggestions for context-heavy tools, memory bloat, and capacity warnings. Pass `all` to expand the full breakdown |
| 26 | `/cost` |  | Alias for `/usage` |
| 27 | `/insights` |  | Generate an HTML report analyzing Claude Code sessions on this machine, including project areas, interaction patterns, and friction points. Not available in cloud sessions |
| 28 | `/stats` |  | Alias for `/usage`. Opens on the Stats tab |
| 29 | `/status` |  | Open the Settings interface (Status tab) showing version, model, account, and connectivity. Includes a Session kind row showing whether the session is running as a background job (attached or unattended) or interactively. Works while Claude is responding, without waiting for the current response to finish |
| 30 | `/usage` |  | Show session cost, plan usage limits, and activity stats. On a Pro, Max, Team, or Enterprise plan, includes a breakdown of usage by skill, subagent, plugin, and MCP server. `/cost` and `/stats` are aliases |
| 31 | `/usage-credits` |  | Configure usage credits to keep working when you hit a limit. Previously `/extra-usage` |
| 32 | `/bug [report]` |  | Report a bug or share your conversation. You choose how much session history to include and confirm on a consent screen before anything i
本 skill 专注于命令完整教程,shanraisshan/claude-code-best-practice: claude-commands。它将相关流程标准化,帮助用户更快拿到可靠结果,减少重复手工操作。
当你需要在命令完整教程相关工作中获得稳定、可复用的产出时最适合——无论是单次任务还是纳入日常工作流,都能直接调用。
需要一个具体的项目或任务上下文,最好带有代码仓库或需求文档。
1. 问 Agent "Claude Code 怎么 X"(X = 子主题)
2. 如果 Agent 改配置,确认后再继续
3. 全程 Agent 自动化,你只需回答授权类问题
---
本 skill 专注于命令完整教程,shanraisshan/claude-code-best-practice: claude-commands。它将相关流程标准化,帮助用户更快拿到可靠结果,减少重复手工操作。
当你需要在命令完整教程相关工作中获得稳定、可复用的产出时最适合——无论是单次任务还是纳入日常工作流,都能直接调用。
需要一个具体的项目或任务上下文,最好带有代码仓库或需求文档。