mcpField
G
git-commit

git-commit

github.com/cloudflare开发1.2k70 次安装3 天前更新
代码仓库

关于 git-commit

git-commit 是用于规范 Git 提交信息写法的仓库技能,涵盖标题和正文格式、措辞及内容要求,并提供推荐的 HEREDOC 命令格式。

主要功能

  1. 01七项提交信息规则
  2. 02标题与正文格式指南
  3. 03简洁描述变更的建议
  4. 04HEREDOC 命令模板
  5. 05正反提交示例

适用场景

  1. 01统一仓库中的提交信息格式
  2. 02撰写简洁标题和说明正文
  3. 03提交前检查提交文本

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/cloudflare/sandbox-sdk --skill git-commit

安装后在 Claude Code 中输入/git-commit确认已加载。

详细介绍

Git 提交指南

在为此仓库创建提交时,请遵循以下规则。

7 条规则

  1. 主题与正文之间空一行
  2. 主题行不超过 50 个字符
  3. 主题行首字母大写
  4. 主题行末尾不加句号
  5. 使用祈使语气(“Add feature”,而非“Added feature”)
  6. 正文每行最多 72 个字符
  7. 正文说明做了什么以及为什么,而不是怎么做

核心原则

简洁明了,不要冗长。 每个词都应发挥作用。避免不必要地描述实现细节,专注于说明有哪些变化以及这些变化为何重要。

主题行应独立成文——不应要求读者阅读正文才能理解变更。正文是可选的,仅在需要说明不明显的背景信息时使用。

专注于变更,而非发现变更的过程——提交消息中绝不要提及“审查反馈”“PR 评论”或“代码审查”。描述变更的内容和原因,而不是有人要求你这样做。

避免使用项目符号——写成段落,而不是列表。如果需要用项目符号来解释变更,说明你一次提交的内容太多,或者过度解释了实现细节。

格式

始终使用 HEREDOC,确保格式正确:

git commit -m "$(cat <<'EOF'
Subject line here

Optional body paragraph explaining what and why.
EOF
)"

好例子

Add session isolation for concurrent executions
Fix encoding parameter handling in file operations

The encoding parameter wasn't properly passed through the validation
layer, causing base64 content to be treated as UTF-8.

不好的例子

Update files

Changes some things related to sessions and also fixes a bug.

问题:主题含糊,没有说明变更内容

Add file operations support

Implements FileClient with read/write methods and adds FileService
in the container with a validation layer. Includes comprehensive test
coverage for edge cases and supports both UTF-8 text and base64 binary
encodings. Uses proper error handling with custom error types from the
shared package for consistency across the SDK.

问题:过度解释实现细节,措辞过多

提交前检查清单

  • 主题不超过 50 个字符
  • 主题使用祈使语气
  • 主题首字母大写,末尾不加句号
  • 正文(如有)说明原因,而非做法
  • 不提及审查反馈或 PR 评论
  • 正文中没有项目符号
  • 不提交敏感文件(.env、凭据)

评论

支持 Markdown