agentsclimarketplace

Commit message craftsman

Skill bingooyong/agent-skills/skills/commit-message-craftsman

agent-skills

Install
npx -y skills add bingooyong/agent-skills --skill commit-message-craftsman

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Generate well-structured commit messages from staged changes. Use when (1) crafting commit messages that follow Conventional Commits or team-specific formats, (2) summarizing complex multi-file changes, (3) ensuring commit history is searchable, (4) splitting large changes into logical commits. Outputs commit messages with type, scope, and body based on actual diffs.

SKILL.md

4.8 KB, as published. Nobody here has run it

Commit Message 工匠 Skill

基于暂存区变更内容生成规范的 commit message,支持 Conventional Commits 等多种格式,帮助保持提交历史清晰可检索。

何时使用

  • 准备提交代码,需要生成规范的 commit message
  • 团队要求统一提交格式
  • 复杂变更需要拆分为多个逻辑提交
  • 审视暂存区变更,确认提交内容的合理性

不适用:与 Git 无关的文本生成、changelog 生成、release notes。

Commit Message 格式规范

格式名称结构适用场景
Conventional Commitstype: description通用,支持自动 changelog
Conventional + Scopetype(scope): description多模块项目
Merge CommitMerge branch/PR #N合并分支
Revert CommitRevert "original message"回退提交

Conventional Commits 类型:

type说明
feat新功能
fix修复 bug
docs仅文档变更
style格式化(不影响逻辑)
refactor重构(不新增功能、不修复 bug)
perf性能优化
test测试相关
build构建系统或外部依赖
ciCI 配置
chore其他不修改 src 或 test 的变更

输入

输入类型说明必需
暂存区 diff 内容git diff --cached 的输出
项目 commit 历史风格最近几条 commit message否(默认 Conventional Commits)
目标格式指定 commit message 格式
是否需要拆分大变更是否拆为多个 commit否(默认判断)

输出

  • 规范化的 commit message(含 type / scope / body / footer)
  • 拆分建议(如适用)
  • 格式说明

执行步骤

1. 分析暂存区变更

  • 统计变更文件列表和变更类型(新增/修改/删除)
  • 识别变更涉及的模块(从文件路径前缀推断)
  • 提取关键变更内容(新增了什么、修改了什么、删除了什么)
  • 判断变更的复杂度(单模块简单 / 多模块复杂)

2. 推断变更类型和范围

推断变更类型 (type):
  IF 新增了文件 AND 无删除 AND 非测试非配置 → type: feat
  IF 修改了 bug 相关代码 OR 文件名含 fix → type: fix
  IF 只修改了文档文件 (.md, .txt, .rst) → type: docs
  IF 只修改了格式/空格/import 排序 → type: style
  IF 修改了构建配置/CI/依赖配置 → type: build 或 chore
  IF 只修改了测试文件 → type: test
  IF 重构了代码且未改变外部行为 → type: refactor
  IF 修改了性能相关逻辑 → type: perf
  IF 修改了 CI 配置文件 → type: ci

推断范围 (scope):
  从变更文件的公共路径前缀提取
  例: src/auth/login.ts + src/auth/logout.ts → scope: auth
  例: 仅修改根目录配置 → 无 scope

3. 生成 commit message

type(scope): 简短描述(不超过 50 字符)

详细说明变更的内容和原因。每行不超过 72 字符。
解释为什么做这个变更,而非做了什么。

如果有关联的 issue:
Refs #123

生成原则:

  • 标题行使用祈使语气("add feature" 而非 "added feature")
  • 标题行不超过 50 字符
  • 正文每行不超过 72 字符
  • 正文说明"为什么"而非"做了什么"(做什么已经在 diff 中)
  • 不在 message 中重复 diff 内容

4. 拆分建议(可选)

判断是否需要拆分:
  IF 变更涉及 3+ 不相关模块 → 建议按模块拆分为多个 commit
  IF 变更同时包含 feat 和 fix → 建议按类型拆分
  IF 变更同时包含代码和文档更新 → 建议拆分
  IF 单个文件变更超过 500 行 → 建议拆分

拆分方案:
  Commit 1: type(scope-a): 变更描述 A
  Commit 2: type(scope-b): 变更描述 B
  Commit 3: docs: 更新相关文档

边界与非目标

  • 不做自动执行 git commit — 只生成 message,提交由用户执行
  • 不做changelog 或 release notes 生成
  • 不做代码 review — 这是 code-review-checklist 的职责
  • 不做分支管理策略
  • 只生成 commit message,不改变暂存区内容
  • 不强制要求用户使用生成的 message

验收标准

  • 生成的 commit message 符合 Conventional Commits 格式
  • type 推断与实际变更内容匹配
  • scope 从文件路径正确推断(多模块项目)
  • 标题行不超过 50 字符,正文不超过 72 字符
  • 拆分建议只在变更确实跨模块时才提出

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.