Summary
当用户明确要求提交、打标签、发版、推送 git 变更,执行“原子提交”(分步/拆分提交),或要求“整理提交历史”(squash 提交、准备开 PR、合并或变基提交历史)时使用;适用于使用 CalVer 管理版本号的仓库。
zrong/skills
当用户明确要求提交、打标签、发版、推送 git 变更,执行“原子提交”(分步/拆分提交),或要求“整理提交历史”(squash 提交、准备开 PR、合并或变基提交历史)时使用;适用于使用 CalVer 管理版本号的仓库。
npx skills add zrong/skills --skill git-commit
当用户明确要求提交、打标签、发版、推送 git 变更,执行“原子提交”(分步/拆分提交),或要求“整理提交历史”(squash 提交、准备开 PR、合并或变基提交历史)时使用;适用于使用 CalVer 管理版本号的仓库。
Related neighbors and high-traction skills in the same topics — useful to compare before installing.
Execute git commit with conventional commit message analysis, intelligent staging, and message …
44.5K installsPrompt and workflow for generating conventional commit messages using a structured XML format. …
16.1K installsUse for every request to commit changes or draft a commit message. Creates Sentry-style convent…
4.2K installsCreate a git commit for the current changes. Use when asked to commit changes, make a commit, g…
48 installsWrite a Conventional Commits message compressed to intent only. Use for "write a commit", "comm…
344.3K installsSet up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the curr…
324.3K installsOther skills from zrong/skills · top by installs.
npx skills add zrong/skills
Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.
main
Files included with this skill beyond the listing page.
SKILL.md
7,322 B
SUMMARY.md
300 B
将当前仓库变更提交到 git,并按 CalVer 规则打 tag。
calver.py,不得手动推断。calver.py 是本 skill 自带脚本,不属于项目仓库。git push 和 git push --tags。calver.py 指的是 skill 自带脚本,而不是项目仓库里的同名文件。
执行时先定位 skill 的安装目录,再运行:
python3 <skill安装目录>/scripts/calver.py
如果环境不能提供安装目录,或目录无法可靠确定,立即停止并告知用户。
calver.py 获取下一个版本号。git push 和 git push --tags。提交变更时,Commit Message 必须严格遵循以下格式约束:
<type>(<scope>): <summary>
<正文:描述本次变更的背景与动机>
Agent-Task: <原始任务描述或任务 ID>
Agent-Model: <使用的模型,如 gpt-4o、gemini-2.5-pro>
Agent-Decision: <关键设计决策及理由>
Agent-Limitation: <已知局限或后续 TODO>
<type>:变更类型,如 feat (新功能), fix (修复), docs (文档), style (格式), refactor (重构), perf (性能), test (测试), chore (构建/工具)。<scope>:影响范围,可以是具体的组件、模块或 Skill 名称。<summary>:简短概括变更内容(必须使用简体中文)。Agent-Task:原始任务描述或任务 ID。Agent-Model:执行任务时所使用的模型名称(例如,本轮运行所使用的模型,如 gemini-3.5-flash-high 等)。Agent-Decision:关键技术/设计决策及其背后的合理理由。Agent-Limitation:任何已知的局限性、潜在风险或后续待办事项(TODO)。feat, fix 等 <type> 和 <scope>)以及英文字段名/元数据(Meta)的 Key(如 Agent-Task:)之外,<summary>、<正文> 以及各元数据字段的具体 Value 描述,必须使用简体中文进行撰写。当实现一个特性或应用户明确要求时,必须将你的工作拆分为原子提交(Atomic Commits)。每次提交都必须严格遵循以下要求:
当触发词包含“原子提交”、“分步提交”、“拆分提交”或在复杂的特性开发中,应采用以下独立触发的原子提交工作流:
git diff 或 git status 评估所有代码修改。- 使用 git add <file> 或 git add -p 仅暂存属于当前首个逻辑块的修改,避免混入无关代码。 - 为该块撰写符合 Commit Message 规范 的 commit message。 - 执行提交:git commit -m "..."。 - 验证当前状态:运行构建或测试,确保代码库处于完全可用状态。
- 仅在最后一个原子提交完成后,才运行 calver.py 获取最新版本号,并为该次最新提交打上 tag。 - 前置的过渡性原子提交不需要打 tag。
当触发词包含“整理提交历史”、“准备开 PR”、“squash 提交”、“合并提交”、“git rebase”或用户明确要求在开 PR 前整理分支提交历史时,应采用以下独立触发的提交历史整理工作流:
- 运行 git log --oneline main..HEAD 查看当前分支相对于主干分支(如 main)的所有提交历史。
- 识别提交历史中哪些属于同一逻辑变更(特别是带有 [WIP]、temp 等前缀的过渡性/临时性提交)。 - 规划合并方案:明确定义哪些提交需要保留(pick),哪些需要合并(squash 或 fixup)。 - 为合并后最终保留的每个 commit 规划新 Commit Message,新 Message 必须严格符合 Commit Message 规范(符合 Conventional Commits 格式,并包含 Agent-Task、Agent-Model、Agent-Decision、Agent-Limitation 尾注)。
- 将整理方案(包括哪些 commit 保留、哪些合并、修改后的完整 Commit Message 预览)以清晰的形式呈现给用户。 - 重要:必须在此步暂停,等待用户的明确确认! 在用户没有回复并明确同意前,禁止执行任何变基操作。
- 用户确认方案后,执行 git rebase -i main(对于 Agent 执行,如果直接交互有困难,可以通过配置非交互式变基环境变量或脚本,例如 GITSEQUENCEEDITOR 或 git commit --amend 等技术手段,来实现自动化的 squash/rebase 整理)。
- 变基整理完成后,再次运行 git log --oneline main..HEAD 展示最终的精简、规范的提交历史,确保整理结果符合预期。
YY.WW.MICROYY:ISO 年份后两位WW:ISO 周数MICRO:全局递增序号,跨年不重置| 错误做法 | 正确做法 |
|---|---|
在项目仓库里找 scripts/calver.py |
在 skill 安装目录里执行脚本 |
| 找不到路径就手动算版本号 | 直接停止 |
| 用户没明确要求就 push | 先只提交和打 tag |
| 把无关文件一起提交 | 只提交当前任务相关文件 |