Agent Skills7-e1even/learn-agent › git-commit-convention

git-commit-convention

GitHub

指导如何编写符合 Conventional Commits 规范的 Git 提交信息,涵盖格式、type 选择、footer 规则及拆分原则,并提供提交前自查清单。

s10_prompt_assembly/skills/git-commit-convention/SKILL.md 7-e1even/learn-agent

触发场景

用户要求生成 git commit message 用户询问如何规范提交代码 用户需要整理或重写提交历史

安装

npx skills add 7-e1even/learn-agent --skill git-commit-convention -g -y
更多选项

非标准路径

npx skills add https://github.com/7-e1even/learn-agent/tree/main/s10_prompt_assembly/skills/git-commit-convention -g -y

不安装直接使用

npx skills use 7-e1even/learn-agent@git-commit-convention

指定 Agent (Claude Code)

npx skills add 7-e1even/learn-agent --skill git-commit-convention -a claude-code -g -y

安装 repo 全部 skill

npx skills add 7-e1even/learn-agent --all -g -y

预览 repo 内 skill

npx skills add 7-e1even/learn-agent --list

SKILL.md

Frontmatter
{
    "name": "git-commit-convention",
    "description": "写 git 提交信息、整理提交历史时使用——Conventional Commits 的格式、类型选择和拆分原则。"
}

Git 提交规范

格式

<type>(<scope>): <subject>

<body>

<footer>
  • type 必选,scope 可选(改动涉及的模块/目录名),subject 必选。
  • subject 用祈使句("add" 不是 "added"),不加句号,不超过 50 字符。
  • body 讲为什么改,不复述 diff 里能看到的"改了什么"。
  • 一次提交只做一件事:重构和功能修改不混在同一个提交里。

type 怎么选

type 用于
feat 新功能(用户可感知的行为变化)
fix 修 bug(引用 issue 编号写进 footer)
refactor 不改行为的结构调整
test 只增改测试
docs 只改文档/注释
chore 构建、依赖、CI 等工程杂务

拿不准 feat 还是 fix:问"用户之前的预期是什么"——之前就该这样但没做到 = fix;之前没有这个预期 = feat。

footer

  • 不兼容变更:以 BREAKING CHANGE: 开头,说明迁移方法。
  • 关联 issue:Closes #123

提交前自查

  1. git diff --staged 过一遍:有没有混进无关文件(调试代码、锁文件意外变更)?
  2. 这个提交单独 revert 时,代码库还能编译/测试通过吗?不能 → 拆分方式有问题。
  3. subject 能让三个月后的自己一眼看懂吗?

版本历史

  • a852537 当前 2026-07-19 08:53

同 Skill 集合

s10_prompt_assembly/skills/code-review-checklist/SKILL.md

元信息

文件数
0
版本
a852537
Hash
3f9d69f9
收录时间
2026-07-19 08:53

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-20 14:18
浙ICP备14020137号-1 $访客地图$