跳到主要内容

斜杠命令库

进阶

把它们复制到 .claude/commands/<name>.md(项目级)或 ~/.claude/commands/<name>.md(个人级)。文件名即命令名。运作机制参见自定义斜杠命令

/commit —— 从暂存的 diff 生成 Conventional Commit

---
description: Write a Conventional Commit message from the staged changes
---
Run `git diff --cached`. Write ONE Conventional Commit message (feat/fix/docs/
refactor/test/chore) describing the change. Output only the message.

/review —— 审查一个文件或 diff

---
description: Review code for bugs, edge cases, and clarity
---
Review the target for correctness bugs, missing edge cases, and clarity issues.
Report only real, high-confidence findings as a checklist. Target: $ARGUMENTS

/pr —— 起草一份 PR 描述

---
description: Draft a pull request description from the branch diff
---
Compare against the default branch (`git diff main...HEAD`). Write a PR
description: what changed, why, and how it was verified. Use short sections.

/explain —— 用通俗语言解释代码

---
description: Explain how something works
---
Explain $ARGUMENTS in plain language: what it does, how it flows, and any gotchas.
Read the relevant files first.

/scaffold —— 新建组件/模块

---
description: Scaffold a new component following project conventions
---
Create a new $ARGUMENTS following this repo's existing patterns (structure,
naming, tests). Show a plan first, then create the files.

/changelog —— 总结最近的变更

---
description: Summarize recent commits into a changelog entry
---
Run `git log --oneline -20`. Group the changes into Added / Changed / Fixed in
Keep a Changelog style.

:::tip 以插件形式分享 把你团队最喜欢的命令(连同 hooks 和技能)打包成一个插件,让每个人一步就能安装。 :::

下一步