.agents/skills/git-commit-cn/SKILL.md
生成符合行业规范的中文git提交信息,支持类型+范围+主题格式。分析代码变更后自动生成提交信息,询问是否提交,提交后询问是否推送。支持用户提前说明直接推送,多远程源时询问推送到哪个源(默认origin)。
npx skillsauth add EchoNoReturn/task-manager git-commit-cnInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
使用这个 skill 时,目标是帮助用户生成符合行业规范的中文 git 提交信息,并管理提交和推送流程。
首先检查当前 git 仓库状态:
git status
git diff
git log --oneline -5
分析暂存区的变更,识别:
根据分析结果,生成符合以下格式的中文提交信息:
<类型>(<范围>): <主题>
<body>
<footer>
user-profile、shopping-cart)Closes #123、Fixes #456)BREAKING CHANGE: 开头# 正确示例
feat(user): 添加用户登录功能
fix(cart): 修复购物车数量计算错误
docs(readme): 更新项目说明文档
style(components): 统一代码缩进风格
refactor(store): 重构用户状态管理逻辑
perf(image): 优化图片加载性能
test(unit): 添加用户模块单元测试
chore(deps): 升级vue到3.4版本
revert(auth): 回滚用户认证逻辑
# 错误示例
update code # 缺少类型和中文
修复bug # 缺少类型和范围
根据分析结果生成提交信息,格式如下:
我为您生成了以下提交信息:
类型: <类型>
范围: <范围>
主题: <主题>
完整提交信息:
<完整提交信息>
是否使用此提交信息进行提交?
1. 是,提交
2. 否,我想修改提交信息
3. 取消提交
如果用户选择提交:
git commit -m "<提交信息>"
提交成功后:
提交成功!是否推送到远程仓库?
1. 是,推送到 origin
2. 是,推送到其他远程仓库
3. 否,稍后手动推送
git remote -v
如果只有一个远程仓库(通常是 origin):
git push origin <当前分支>
如果有多个远程仓库,询问推送到哪个:
检测到多个远程仓库,请选择推送到哪个:
1. origin (默认)
2. upstream
3. 其他...
然后执行推送:
git push <选择的远程仓库> <当前分支>
如果用户在请求时明确说明"直接推送"或类似指令,则跳过询问步骤,直接执行:
git commit -m "<生成的提交信息>" && git push origin <当前分支>
如果没有文件被暂存:
当前没有暂存的文件。请先使用 `git add` 添加要提交的文件。
如果工作区有变更但未暂存:
检测到未暂存的变更。是否要暂存所有变更并提交?
1. 是,暂存所有变更并提交
2. 否,我只想提交已暂存的文件
3. 显示详细变更
如果提交信息不符合规范:
提交信息不符合规范,请检查:
- 类型是否正确
- 范围是否使用小写kebab-case
- 主题是否使用中文且不超过50字符
如果推送失败:
推送失败,可能的原因:
1. 远程仓库有新的提交,请先拉取
2. 权限不足
3. 网络问题
是否尝试先拉取再推送?
1. 是,执行 git pull --rebase 然后推送
2. 否,我手动处理
用户:帮我提交代码
助手:
用户:帮我提交代码并直接推送到 origin
助手:
用户:帮我提交代码
助手:
development
Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation.
tools
Enter explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements. Use when the user wants to think through something before or during a change.
tools
Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
tools
Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.