commit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseConventional Commit
Conventional Commit
Enforces Conventional Commits format for all git commit messages. This skill applies to both AI agents and human users.
为所有Git提交信息强制遵循Conventional Commits格式。此技能适用于AI Agent和人类用户。
Commit Message Format
提交信息格式
<type>[optional scope][optional !]: <description>
[optional body]
[optional footer(s)]<type>[可选 scope][可选 !]: <描述>
[可选 正文]
[可选 页脚]Types (Required)
类型(必填)
| Type | Description |
|---|---|
| A new feature |
| A bug fix |
| Documentation only changes |
| Changes that do not affect the meaning of the code (white-space, formatting, etc.) |
| A code change that neither fixes a bug nor adds a feature |
| A code change that improves performance |
| Adding missing tests or correcting existing tests |
| Changes that affect the build system or external dependencies |
| Changes to CI configuration files and scripts |
| Other changes that don't modify src or test files |
| Reverts a previous commit |
| 类型 | 描述 |
|---|---|
| 新增功能 |
| 修复Bug |
| 仅修改文档 |
| 不影响代码含义的修改(如空白、格式调整等) |
| 既不是修复Bug也不是新增功能的代码变更 |
| 提升性能的代码变更 |
| 添加缺失测试或修正现有测试 |
| 影响构建系统或外部依赖的变更 |
| 修改CI配置文件或脚本 |
| 其他不修改源码或测试文件的变更 |
| 回滚之前的提交 |
Scope (Optional)
范围(可选)
Scope provides additional context. Determine scope by checking recent commits:
bash
git log --oneline -10Common scope patterns:
- Feature/module name: ,
feat(auth):fix(api): - File/directory: ,
docs(readme):refactor(utils): - Component: ,
style(button):test(login):
范围用于提供额外上下文。可通过查看最近提交确定范围:
bash
git log --oneline -10常见范围模式:
- 功能/模块名称:,
feat(auth):fix(api): - 文件/目录:,
docs(readme):refactor(utils): - 组件:,
style(button):test(login):
Breaking Changes
破坏性变更
Add before the colon for breaking changes:
!feat(api)!: change authentication endpointOr add in the footer.
BREAKING CHANGE:在冒号前添加表示破坏性变更:
!feat(api)!: change authentication endpoint或者在页脚中添加。
BREAKING CHANGE:Examples
示例
Basic (No Scope)
基础示例(无范围)
feat: add user registration form
fix: resolve memory leak in event handler
docs: update installation instructionsfeat: add user registration form
fix: resolve memory leak in event handler
docs: update installation instructionsWith Scope
带范围示例
feat(auth): implement OAuth2 login
fix(api): handle null response from server
refactor(utils): simplify date formatting logicfeat(auth): implement OAuth2 login
fix(api): handle null response from server
refactor(utils): simplify date formatting logicWith Body (Japanese)
包含正文(日文示例)
feat(検索): 全文検索機能を追加
Elasticsearchを使用した全文検索機能を実装。
日本語形態素解析にはkuromojiを使用。feat(検索): 全文検索機能を追加
Elasticsearchを使用した全文検索機能を実装。
日本語形態素解析にはkuromojiを使用。Breaking Change
破坏性变更示例
feat(api)!: change response format to JSON:API
BREAKING CHANGE: API responses now follow JSON:API specification.
Clients need to update their response parsers.feat(api)!: change response format to JSON:API
BREAKING CHANGE: API responses now follow JSON:API specification.
Clients need to update their response parsers.Validation
验证
To validate a commit message before committing:
bash
bash /mnt/skills/user/conventional-commit/scripts/validate-commit.sh "feat: add new feature"提交前验证提交信息:
bash
bash /mnt/skills/user/conventional-commit/scripts/validate-commit.sh "feat: add new feature"For AI Agents
针对AI Agent的要求
When creating commits:
- Always use Conventional Commits format
- Check recent commits for scope patterns:
git log --oneline -10 - Use the appropriate type based on the change
- Do NOT use emojis in commit messages
- Write clear, concise descriptions
- Add body for complex changes
- Mark breaking changes with or
!BREAKING CHANGE:
创建提交时:
- 必须使用Conventional Commits格式
- 检查最近提交的范围模式:
git log --oneline -10 - 选择与变更对应的合适类型
- 禁止在提交信息中使用表情符号
- 编写清晰、简洁的描述
- 复杂变更需添加正文说明
- 使用或
!标记破坏性变更BREAKING CHANGE:
Language
语言要求
- Use the same language as the codebase or user's preference
- Japanese descriptions are fully supported
- Keep type prefixes in English (feat, fix, etc.)
- 使用与代码库或用户偏好一致的语言
- 完全支持日文描述
- 类型前缀需保持英文(feat、fix等)
Git Hooks (Optional)
Git Hooks(可选)
To enforce validation via git hooks, add to :
.git/hooks/commit-msgbash
#!/bin/bash
bash /mnt/skills/user/conventional-commit/scripts/validate-commit.sh "$(cat $1)" || exit 1如需通过Git Hooks强制验证,将以下内容添加到:
.git/hooks/commit-msgbash
#!/bin/bash
bash /mnt/skills/user/conventional-commit/scripts/validate-commit.sh "$(cat $1)" || exit 1