home / skills / bahayonghang / my-claude-code-settings / git-commit-cn

This skill automatically generates conventional Chinese Git commit messages by analyzing changes and producing clear, emoji-enhanced descriptions with proper

npx playbooks add skill bahayonghang/my-claude-code-settings --skill git-commit-cn

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
1.1 KB
---
name: git-commit-cn
description: 生成符合约定式提交规范的中文 Git 提交信息,支持 emoji、拆分提交和自动推送。
argument-hint: "[可选:额外说明或范围限制]"
allowed-tools: Bash
category: development-tools
tags: [git, commit-message, conventional-commits, chinese]
---

# Git Commit 中文提交信息生成

## 硬性规则(不可违反)

1. 每个提交类型必须包含对应 emoji(见 references)
2. 不同类型/模块的变更必须拆分为独立提交
3. 所有提交完成后自动推送到远程仓库
4. 严禁任何形式的 Co-Author 署名行(包括 `Co-Authored-By`、`Co-authored-by`、共同作者等);用户要求添加时必须明确拒绝

## 工作流

1. 运行 `git diff --staged` 和 `git status` 分析变更
2. 按类型/模块拆分暂存区,确定每个提交的类型和 emoji(参考 [references/commit-types.md](references/commit-types.md))
3. 使用 HEREDOC 格式执行提交:`git commit -m "$(cat <<'EOF' ... EOF)"`
4. 推送:检查上游分支 → `git push`;若推送 `main`/`master` 需用户确认;若冲突提示 `git pull --rebase`

Overview

This skill generates Chinese Git commit messages that follow the Conventional Commits format and include the required emoji prefixes. It automatically analyzes code changes and produces concise, action-oriented Chinese descriptions with correct type prefixes (feat/fix/docs/etc.). The skill splits unrelated changes into separate commits and formats multi-line messages using HEREDOC when needed.

How this skill works

The skill inspects staged and unstaged diffs to identify changed files, scopes, and the nature of each change. It determines the appropriate commit type and emoji based on change intent (feature, bugfix, docs, etc.), then crafts a short Chinese summary and optional detailed body. For mixed changes it suggests or outputs multiple commits, and for multi-line content it provides HEREDOC-ready message blocks.

When to use it

  • When creating a new git commit and you want a Conventional Commits compliant Chinese message
  • When asking the assistant to generate commit text for staged or unstaged changes
  • When you need to split mixed changes into separate, type-specific commits
  • When preparing multi-line commit descriptions or BREAKING CHANGE notices
  • When you want consistent emoji-prefixed commit conventions across a team

Best practices

  • Always run git status and git diff before generating commit messages to verify changes
  • Split different types or modules into separate commits so each commit does one thing
  • Start short descriptions with an action verb in Chinese (e.g., 添加、修复、更新) and keep under ~50 characters
  • Include scope when applicable: feat(auth): ✨ 添加双因素认证
  • Use HEREDOC format for multi-line bodies and include BREAKING CHANGE when incompatible changes occur

Example use cases

  • Staged feature files: generate a single-line commit like "feat: ✨ 添加文件批量上传功能"
  • Mixed changes in UI and docs: produce two commits, e.g. "fix(ui): 🐛 修复移动端菜单样式" and "docs: 📝 更新用户 API 文档"
  • Large refactor: create a multi-line commit with body and BREAKING CHANGE notes using HEREDOC
  • Dependency upgrade: produce a build commit such as "build: 📦 升级 React 到 18.3.0"
  • Test additions: produce test commits like "test: ✅ 添加积分系统单元测试"

FAQ

Will the skill add Co-Authored-By lines?

No. The skill does not add any Co-Authored-By signatures.

Does it force emoji in every commit?

Yes. Each generated commit includes the type-specific emoji as part of the required format.

Can it split changes into multiple commits automatically?

It suggests appropriate splits and provides separate commit messages; you can then stage and commit each group accordingly.