luzhenqian/ai-coding-lab/commit-msg
Claude Code and agent skill by luzhenqian/ai-coding-lab
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
分析 git diff 并生成规范的 Conventional Commit 消息。当用户提到提交代码、写 commit message、git commit、提交信息、代码提交规范时使用。
Install
npx vskill@latest install luzhenqian/ai-coding-lab/commit-msgSKILL.md
Git Commit Message 规范化
概述
自动分析当前 git 暂存区的变更内容,生成符合 Conventional Commits 规范的 commit message。确保团队提交历史清晰、可追溯、可自动生成 changelog。
工作流程
执行步骤
第一步:读取暂存区变更
运行以下命令收集信息:
如果暂存区为空,提示用户先执行 git add,不要自动执行 git add。
第二步:分析变更内容
分析以下维度:
| 维度 | 关注点 | |
|---|---|---|
| 变更范围 | 涉及哪些模块/目录 | |
| 变更类型 | 新增功能、修复bug、重构、文档等 | |
| 变更规模 | 文件数、行数是否合理 | |
| 是否有破坏性变更 | API 变更、数据库迁移、配置格式变化 |
过大提交的判断标准:
- 超过 5 个不相关的文件被修改
- 变更超过 300 行(不含自动生成文件)
- 同时包含功能变更和重构
如果提交过大,给出拆分建议,列出建议的拆分方式。
第三步:判断变更类型
按照 Conventional Commits 规范,从以下类型中选择:
| 类型 | 含义 | 示例场景 | |
|---|---|---|---|
feat | 新功能 | 添加用户注册接口 | |
fix | Bug 修复 | 修复登录页面崩溃 | |
docs | 文档变更 | 更新 README | |
style | 代码格式(不影响逻辑) | 调整缩进、去掉多余空行 | |
refactor | 重构(不改功能不修 bug) | 提取公共方法 | |
perf | 性能优化 | 添加数据库索引 | |
test | 测试相关 | 补充单元测试 | |
build | 构建系统或依赖 | 升级 webpack 版本 | |
ci | CI/CD 配置 | 修改 GitHub Actions | |
chore | 其他杂项 | 更新 .gitignore |
第四步:生成 Commit Message
格式规范:
各部分规则:
Header(必填):
type:从上表选择,小写scope:可选,变更涉及的模块名(如auth、api、ui)subject:简短描述,不超过 50 字符- 使用祈使语气("add" 而非 "added")
- 首字母小写
- 末尾不加句号
- 中文项目可以用中文 subject
Body(可选,推荐):
- 说明"为什么"做这个变更,而非"做了什么"
- 每行不超过 72 字符
- 与 header 空一行
Footer(特殊情况):
- 破坏性变更:以
BREAKING CHANGE:开头 - 关联 Issue:
Closes #123或Refs #456
第五步:展示并确认
将生成的 commit message 展示给用户,格式如下:
不要自动执行 git commit,等待用户确认。
特殊情况处理
中英文混合项目
- 如果最近的 commit 是中文的,生成中文 message
- 如果最近的 commit 是英文的,生成英文 message
- 保持与项目已有风格一致
合并提交 (Merge Commit)
- 不处理 merge commit,提示用户使用默认的 merge message
空提交
- 如果暂存区没有变更,提示用户先
git add - 列出当前未暂存的修改文件供参考
常见错误示例
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/.claude/skills/commit-msg/SKILL.md
Popularity
- Repository stars
- 139
- Repository forks
- 20
- 7-day trend score
- 25
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/luzhenqian/ai-coding-lab/commit-msg)