Files
playbook/codex/skills/commit-message/SKILL.md
T
cshandClaude Opus 4.7 e1dbf3cc45 🐛 fix(skills): remove dual-path from commit-message skill
Drop the vendoring-scenario fallback path from commit-message/SKILL.md.
rewrite_skill_docs_links handles path rewriting at install time, so the
source file only needs the canonical docs/common/ path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 17:15:10 +08:00

2.1 KiB
Raw Blame History

name, description
name description
commit-message 基于 staged diff 生成符合 commit_message.md 的提交信息建议(:emoji: type(scope): subject)。Triggers: commit message, 提交信息, 写提交说明, 生成提交信息, emoji commit, git commit.

Commit Message(提交信息建议器)

目标:基于 git diff --cachedstaged diff)生成 1–3 条提交信息建议::emoji: type(scope): subject(可选 body/footer)。

权威规范(单一真源):

  • docs/common/commit_message.md

When to use

  • 用户要“写提交信息 / 生成 commit message / 按规范写提交说明 / emoji commit”
  • 已经 git add 了一批改动,准备 git commit

Proceduredefault

  1. 收集 staged 概览(尽量小上下文)

    • git diff --cached --name-status
    • git diff --cached --stat
    • 必要时只看关键文件:git diff --cached -- <path>
  2. 读取并遵循权威规范

    • 优先读取就近的 commit_message.md(见上方路径),以其中的 type/emoji/格式为准。
  3. 生成 1 条主建议 + 2 条备选

    • 格式固定::emoji: type(scope): subjectscope 可省略)。
    • subject 用一句话描述“做了什么”,避免含糊词;尽量 ≤ 72 字符,不加句号。
  4. 判断是否建议拆分提交

    • 当 staged 同时包含多个不相关模块/目的时:建议拆分,并给出拆分方式(按目录/功能点/风险)。
  5. 可选:补充 body/footer(如需要)

    • body:说明 why/impact/verify(按规范建议换行)。
    • footer:任务号或 BREAKING CHANGE:(若有)。
  6. 只给建议,不默认执行 git commit

    • 仅当用户明确要求时,才根据选定方案生成最终提交信息。

Output contract(固定输出)

  • Detected: staged files summary(文件数 + 关键路径 + 是否可能需要拆分)
  • Proposed:
    • Option Arecommended)::emoji: type(scope): subject
    • Option B...
    • Option C...
  • Optional body/footer(如适用)
  • Notes:规范路径命中情况(哪个 commit_message.md 被使用)