Claude Code 命令指南:内置命令速查与团队技能模板
想把 Claude Code 命令真正用进团队开发?本文梳理常用斜杠命令、技能、插件与 MCP 提示词的区别,讲清参数和权限,并提供五套可直接使用的团队模板,覆盖 PR 审查、测试驱动修复、迁移规划、产品发布说明和每周变更日志。学会用本地仓库证据检查结果,再衡量准备、修正与维护成本,让重复任务更容易交接。
发布于

Claude Code 命令能把反复进行的代码审查、缺陷修复和发布工作,变成全队都能复用的流程。先掌握 Claude Code 的会话控制命令,再把自己的命令做成项目技能,提交到代码仓库。这样既能减少重复交代任务的时间,也能让同事执行时少漏检查项。
一条实用的团队命令,需要写清输入、要核查的证据,以及结果的呈现方式。可以把它看成一份与代码放在一起的任务单:输入命令名,就能把这份任务单用到当前工作上。
先学会 /plan、/diff、/context 和 /compact,再从下方模板中加入 /team-pr-check。 代码审查很适合作为起点,因为每次改动都绕不开权限、数据和测试这些问题。
先掌握这些 Claude Code 命令
在 Claude Code 中,将这些命令输入到消息开头。方括号表示可选参数,尖括号表示必填参数。下表保留了 Anthropic 当前命令参考文档中的语法,核对日期为 2026 年 10 月 13 日。具体可用的命令会因平台、套餐和环境而异。
继续同一个任务时用 /compact,切换任务时用 /clear。如果功能开发还没完成,可以这样保留关键信息:/compact keep the acceptance criteria, unresolved risks, and exact test commands。
/release-notes 打开的是 Claude Code 自身的更新日志,不会替你的应用起草发布说明。因此,下方的自定义命令特意用了另一个名字。
想了解这些控制命令在日常工作中怎么用,可以阅读 Claude Code 最佳实践。
命令菜单里也有随附技能
有些斜杠命令会把一套操作流程交给 Claude 执行。它们属于随附技能,与 CLI 的固定控制命令不同:
/code-review审查 diff 或其他受支持的目标,/review是它的别名。加上--fix表示要求修改,加上--comment表示要求发布审查评论。/simplify检查已修改的代码,找出可精简之处并应用修复。/verify构建并运行应用,检查实际行为。/doctor诊断环境配置问题并提出修复建议。
如果希望先看问题,再决定是否修改,就使用不附加修改要求的审查命令。完整语法、前提条件和可用范围,见命令参考文档中的随附条目。
Claude Code 自定义命令,现在用技能来写
新建团队流程时,把 Markdown 指令文件放到仓库的 .claude/skills/<name>/SKILL.md,并提交到版本控制,让同事拿到同一套流程。个人流程则放在 ~/.claude/skills/<name>/SKILL.md。
旧的 .claude/commands/<name>.md 格式仍然可用。两种写法都会生成 /<name> 命令。技能目录还可以存放模板、参考文档和脚本;流程越复杂,越适合使用这种目录结构。Anthropic 技能指南

Claude Code 插件和 MCP 命令从哪里来?
插件把功能打包,方便复用。 插件中的 skills/<name>/SKILL.md 会生成带命名空间的命令,例如 /plugin-name:skill-name。旧式插件命令放在 commands/ 中。这些文件夹都应位于插件根目录,与存放清单文件的 .claude-plugin/ 目录平级,而不是放在它里面。用 /plugin 管理插件,修改后运行 /reload-plugins。插件组件说明
流程只服务于一个代码仓库时,先用项目技能。需要跨仓库维护和分发同一套流程时,再考虑插件。动手开发之前,可以先看看 Claude Code 插件推荐中值得评估的现成方案。
MCP 提示词由已连接的服务器提供。 MCP 即 Model Context Protocol(模型上下文协议),用于将 Claude Code 连接到外部工具和数据。服务器也可以发布可复用的提示词。菜单中会以 /servername:promptname (MCP) 的形式显示,也可以通过 /mcp__servername__promptname 调用。只有已连接的服务器提供了相应提示词,它们才会出现。某个集成提供工具,并不代表它自动具备你需要的所有提示词。MCP 提示词文档
MCP 提示词的参数按空白字符拆分,并遵循服务器声明的参数定义。提示词返回的内容会进入对话。不要默认服务器提示词与本地技能采用相同的参数处理方式。
先写技能文件,再传入任务参数
Frontmatter 是 Markdown 指令之前的一小段 YAML 配置。开头的 --- 必须位于文件第一行。下面这些字段涵盖了本文模板的需要:
allowed-tools 用于授予权限,并不把可用工具限制为列表中的这些。所有 frontmatter 字段都是可选的,建议填写 description。旧式命令文件支持相同字段,但不支持 name 和 paths。Frontmatter 参考文档
参数: $ARGUMENTS 插入完整输入字符串。$0 或 $ARGUMENTS[0] 表示第一个参数,$1 表示第二个。命名参数按声明顺序对应各个位置。一个位置参数如果包含多个单词,应加上引号。argument-hint 只是输入说明,流程本身仍要检查输入是否有效。参数替换说明
这些模板省略了 name,因此命令名由文件夹名决定。它们的 frontmatter 也适用于旧式命令文件。仓库中长期有效的信息放在 CLAUDE.md 团队记忆里,具体任务的执行步骤则放在对应技能中。
五个可以直接使用的团队自定义命令
按下面给出的路径创建文件夹,将代码块粘贴到对应的 SKILL.md 中,再运行 /reload-skills 重新扫描文件。这些是供你调整使用的原创模板,不是 Anthropic 随附命令,也不代表经过测试的结果。
下方先介绍可重复执行的工程检查,再介绍沟通类任务。模板尽可能使用本地仓库中的证据,不依赖已连接的工单系统或 PR 服务,也能产出有用的结果。
涉及客户数据的改动:PR 审查清单
小型 SaaS 团队可以在发起人工审查前使用这条命令。即使作者赶时间,它也会逐项检查租户隔离、授权和测试覆盖。价值在于让交接更一致,并把每个问题都对应到具体位置和触发场景。
保存为 .claude/skills/team-pr-check/SKILL.md。使用 /team-pr-check main 调用,以当前分支与 main 的合并基点为起点,审查当前分支的改动。
---
description: Review a branch against the team's business-risk checklist
argument-hint: "[base-ref]"
disable-model-invocation: true
---
Review the current branch against this base ref: $ARGUMENTS
If no base is supplied, ask for it. Confirm it exists locally.
Read CLAUDE.md and any repository review guidance first.
Inspect the diff from the merge base to HEAD. Report uncommitted
changes separately; do not silently mix them into the branch review.
Check:
- Authorization and tenant boundaries on every changed data path.
- Validation, failure handling, retries and duplicate side effects.
- Schema compatibility, rollout assumptions and rollback options.
- Regression coverage for the changed behavior.
- Secrets, sensitive logs and changes to public contracts.
For each finding: severity, file and line, triggering scenario,
user impact and a concrete repair or test. Separate verified findings
from questions. Mark checks you could not assess as unknown.
Return findings first, then the checklist with pass/fail/unknown
and supporting evidence. If none are found, say so and name gaps.
Review only. Do not edit files, post comments, approve or merge.审查清单只有写进产品真实的故障模式,才值得保留。把通用检查项替换成产品真正需要守住的边界,例如账号归属、计费状态,或通过团队继承的权限。
可稳定复现的缺陷:先写测试,再修复
独自维护线上产品的创始人,遇到有明确复现步骤的缺陷报告时,可以使用这条命令。它把失败行为和回归检查都写进任务要求,避免最后只交付一个看起来合理的补丁。
保存为 .claude/skills/team-test-first-fix/SKILL.md。调用示例:/team-test-first-fix duplicate webhook events create duplicate invoices。
---
description: Reproduce a bug with a failing test before fixing it
argument-hint: "[bug description or local issue file]"
disable-model-invocation: true
---
Bug: $ARGUMENTS
If the expected behavior is unclear, ask before changing code.
Read CLAUDE.md, inspect the working tree and preserve unrelated edits.
Find the relevant code and the repository's existing test runner.
Use local fixtures or mocks; do not call production services.
Add the smallest regression test that demonstrates the reported bug.
Run it before changing implementation. Confirm that it fails for
this bug, not because the environment or test setup is broken.
If you cannot demonstrate that failure, explain the blocker and stop.
Make the smallest implementation change that fixes the behavior.
Rerun the regression test and relevant nearby tests. Do not weaken
assertions to obtain a pass or expand into unrelated refactoring.
Report the cause, changed files, failing-before evidence,
passing-after evidence and any tests you could not run.
Do not commit, push or deploy.这套流程适合能复现的缺陷。如果线上故障偶发、证据不足,应先调查,不要硬让命令编出一个失败测试。
修改共享系统前:先制定迁移方案
团队要改数据库结构或替换 API 时,可以先用这条命令找出执行顺序和兼容性方面的问题。真正有用的产出,是一份能接受质疑和审查的方案,尤其要说明新旧版本同时运行时会发生什么。
保存为 .claude/skills/team-migration-plan/SKILL.md。调用示例:/team-migration-plan "billing storage" "new invoice schema"。
---
description: Plan a migration with compatibility checks and rollback gates
argument-hint: "[scope] [target-state]"
arguments: [scope, target]
disable-model-invocation: true
---
Plan a migration of $scope to $target.
If either input is missing or ambiguous, ask for clarification.
Read CLAUDE.md and inspect the current implementation and consumers.
Do not edit files, execute migrations or connect to production.
Describe the current state with file references. List affected data,
APIs, background jobs, integrations and deployment dependencies.
Separate verified facts from assumptions that need an owner.
Propose small phases with dependencies, acceptance checks and a
stop/go decision for each. Include compatibility between old and new
versions, backfill validation, retries and observability.
For each phase, describe rollback or recovery. Flag irreversible
steps and data that a code rollback cannot restore.
Return a reviewable plan, open questions and the smallest safe pilot.
Do not invent a duration, data volume or owner.要求它制定计划,并不会改变 Claude Code 的权限模式。如果还希望会话进入 Plan Mode,应先输入 /plan,再调用技能。书面流程和会话的工具权限,是需要分别设置的控制手段。Plan Mode 说明
为自己的产品起草发布说明
负责发布的开发者可以用这条命令,将指定范围内的代码改动整理成面向客户的草稿。它能减少把提交记录转写为用户影响的工作,同时要求每项表述都有证据。
保存为 .claude/skills/team-release-notes/SKILL.md。使用 /team-release-notes previous-release HEAD 调用,并将 previous-release 替换为已有标签或提交。
---
description: Draft product release notes from a verified Git range
argument-hint: "[base-ref] [head-ref]"
arguments: [base, head]
disable-model-invocation: true
---
Draft release notes for $base..$head.
If either ref is missing, ask. Confirm both resolve locally.
Read CLAUDE.md and the project's existing release-note format.
Inspect commits in the range and compare the endpoint trees.
Use the changed code and tests to verify what each change does.
Group the draft into Added, Changed, Fixed and Breaking Changes.
Omit empty sections. Describe user impact without exposing internal
secrets or vulnerability details that need coordinated disclosure.
Attach a commit or file reference to each item for the reviewer.
Do not claim a change is deployed, enabled for every customer or
faster by a measured amount without evidence of that fact.
Finish with upgrade actions, unresolved questions and any changes
excluded because their impact could not be established.
Return a draft in chat. Do not edit the changelog, tag a release,
publish, send messages or deploy.代码范围能证明仓库发生了哪些变化,不能证明哪些客户已经用上这些变化。发布草稿前,要核实实际发布状态。

为团队整理每周变更日志
工程负责人可以用这条命令,向产品和支持团队汇报每周进展。它会区分已合并的工作和经核实已发布的功能,避免把仍受功能开关控制的内容误报为已经上线。
保存为 .claude/skills/team-weekly-changelog/SKILL.md。使用 /team-weekly-changelog START_DATE END_DATE main 调用,将日期替换为包含时区的 ISO 时间戳。统计区间包含起始时间,不包含结束时间。
---
description: Draft a weekly engineering changelog from branch history
argument-hint: "[since] [until] [branch]"
arguments: [since, until, branch]
disable-model-invocation: true
---
Prepare a weekly changelog for $branch from $since inclusive to
$until exclusive. If an input is missing, ask. Confirm the timezone
and that the branch exists locally. State whether its checkout may
be stale; do not fetch or assume it matches the remote.
Read CLAUDE.md and the team's update format. Inspect commits reachable
from the branch, filtering by committer timestamp in this window.
Explain that commit timestamps do not prove merge or release dates.
Read diffs for claimed outcomes. Group related changes into themes
and avoid counting a merge and its constituent commits as separate
outcomes. Separate product changes, fixes and maintenance.
For each item, give its impact and a commit or file reference.
Label release status unknown unless deployment evidence is available.
Do not infer blockers, revenue, adoption or completion percentages
from commit messages. List evidence gaps at the end.
Return a concise draft in chat. Do not write files or send the update.发布说明和每周更新应分开处理。发布说明面向客户,有明确的代码范围;每周更新按汇报时间段组织,也可能包含有价值但尚未发布的工作。
什么样的命令值得长期保留?
要衡量的是围绕模型反复发生的工作,而不是第一次回答看起来有多出色。
每周价值可以这样计算:运行次数 ×(原来的准备与修正时间 − 现在的准备与修正时间)× 团队小时成本 − 额外模型支出 − 按同一小时成本折算的维护时间成本。 用自己的实测数据代入。提示词写得更长、看起来更自动化,如果增加了审查工作,也可能得不偿失。
最有可能节省的,是资深开发者反复解释同一流程、补救不完整交接所花的时间。架构或发布流程变化后,命令里的流程也需要维护。
Claude 执行已保存的命令时,仍会消耗模型用量。/usage 会显示 token 费用估算和套餐用量信息;界面上的 API 费用估算,并不等于订阅账单。Anthropic 费用文档
围绕这些命令,可以做哪两类产品?
这些模板是实用的内部工具。要把它们做成产品,还需要比保存提示词更难被替代的优势。
最值得考虑:针对具体仓库的审查规则
小型软件团队可能愿意为持续维护的审查包付费,前提是它理解团队自己的高风险边界:哪些表属于某个账号、哪些操作会影响计费,以及哪些改动必须配套测试。
2026 年 10 月 13 日,DataForSEO 的 Google 美国英语关键词概览显示,“ai code review”的预估月搜索量为 1,300。这说明有人关注代码审查这个任务,不代表某个 Claude Code 插件已经有市场需求。DataForSEO 关键词概览
最小可售版本可以把项目审查清单、配套架构说明和历史缺陷评估集放在一起。先验证它能针对这些案例给出有证据支持的发现,再打包为插件分发。
难点在于竞争很强:Claude Code 已经具备审查能力,CodeRabbit 也在销售代码审查工具。通用审查提示词很难形成差异化。我只会在能拿到某个团队的历史故障记录、并且有人负责维护检查项准确性的前提下,选择这个方向。
较小的机会:有证据支撑的发布沟通
产品团队可以使用一套持续维护的工作流,把仓库改动整理成面向客户的发布说明和供内部支持团队使用的简报,同时附上来源,并明确检查发布状态。
同一次关键词概览中,“release notes generator”的预估月搜索量为 70。这个搜索信号不强,因此我会先从服务或内部工作流做起,再考虑开发独立软件。DataForSEO 关键词概览
最小版本可以按团队现有格式,从选定的 Git 范围生成草稿。难的是把代码改动与功能开关、部署和客户实际可用状态对应起来。命令能整理证据,无法补出团队从未记录过的证据。
在业务代码仓库中使用时,有哪些边界?
命令能统一指令,结果是否合格仍要靠测试、审查和发布控制来判断。 把这五个模板当作初始流程,对它们的修改也应像应用代码一样接受审查。
技能的完整内容会在使用时加载,因此流程应尽量简洁,详细参考资料放进配套文件。个人技能可能优先于同名项目技能;在本地终端会话中,技能也可能覆盖内置命令。命名要有辨识度;同事遇到不同执行行为时,应检查技能来源。技能加载与优先级
工具权限规则需要单独配置。写一句“仅审查”是在告诉 Claude 你的意图,并不构成操作系统层面的限制。Claude Code 权限说明
周一上班,先做这件事
先把 /team-pr-check 提交到仓库。回想上次出问题的改动本应通过哪些检查,用它们替换模板中的通用条目。找一次已经完成、结果也清楚的改动试跑,将审查发现与实际问题对照,修订流程后再让团队常态化使用。发布说明和每周更新的输出格式达成共识后,再加入对应命令。
新建命令,该写命令文件还是 SKILL.md?
新流程建议使用项目级 SKILL.md,配套文件也能放在同一个技能目录里。现有的 .claude/commands/ 文件仍然有效,可以先保留有用的命令,再有计划地迁移。
怎样让全队都能用上同一条命令?
把对应的 .claude/skills/ 文件夹提交到仓库。需要跨仓库分发和维护共用的功能包时,再使用插件。如果同事得到的执行行为不同,检查是否存在同名个人技能。
不主动调用,Claude 会运行这五条命令吗?
这些模板把 disable-model-invocation 设为 true,要求显式调用。这个设置只控制调用方式,不能替代工具权限,也不能替代对结果的人工审查。
为什么斜杠命令菜单里找不到我的命令?
先检查文件名、存放位置和 frontmatter,再运行 /reload-skills。插件命令用 /plugin 检查插件状态;MCP 提示词用 /mcp 检查背后的服务器连接。平台、套餐和环境也会影响哪些内置命令可用。命令可用性说明
团队每周变更日志,也用 release-notes 命令吗?
应保留不同流程。产品发布说明面向客户,描述经过核实的代码范围;每周变更日志面向团队,描述一个汇报时间段。Claude Code 内置的 /release-notes 显示的是工具自身的更新日志。
如果希望把这些工作流接入业务系统,我提供 AI 自动化开发服务,围绕团队真正需要的检查来构建流程。
- 发布日期
- 分类
- Build
- 语言







