git-commit-cn

Original🇨🇳 Chinese
Translated

Generate Chinese Git commit messages that comply with the Conventional Commits specification. Use this when users request to create Git commits, generate commit messages, or mention "submit code", "git commit", or "Chinese commit". Automatically analyze code changes to generate standardized Chinese commit messages with correct type prefixes (feat/fix/docs, etc.) and clear descriptions.

4installs
Added on

NPX Install

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

SKILL.md Content (Chinese)

View Translation Comparison →

Generate Chinese Git Commit Messages

Automatically generate Chinese Git commit messages that comply with the Conventional Commits specification.

Default Behavior

Must follow these rules:
  1. Use emojis: Each commit type must include the corresponding emoji icon
  2. Split commits: Split changes of different types or modules into multiple independent commits
  3. Disable Co-Authored-By: Do not add the
    Co-Authored-By: Claude Sonnet 4.5
    attribution

Core Workflow

1. Analyze Code Changes

First check the code changes:
bash
# View unstaged changes
git diff

# View staged changes
git diff --staged

# View status
git status

2. Determine Commit Type and Emoji

Determine the commit type and corresponding emoji based on change content (Mandatory):
  • feat: ✨ New feature or functionality
  • fix: 🐛 Fix bug or error
  • docs: 📝 Documentation-only changes
  • style: 💄 Code format adjustments (no functional impact)
  • refactor: ♻️ Code refactoring
  • perf: ⚡ Performance optimization
  • test: ✅ Test-related changes
  • build: 📦 Build system or dependency changes
  • ci: 👷 CI/CD configuration changes
  • chore: 🔧 Other miscellaneous changes
Detailed explanations and examples can be found in references/commit-types.md

3. Generate Commit Message

Format Requirements:
<type>: <emoji> <short description>

[Optional detailed description]
Short Description Specifications:
  • Start with a verb: add, fix, update, delete, optimize, refactor
  • No more than 50 characters
  • Describe what was done, not why
  • No punctuation at the end
Examples:
Single-line commit:
feat: ✨ 添加用户头像上传功能
Multi-line commit:
feat: ✨ 添加用户头像上传功能

支持 JPG/PNG/WebP 格式,最大 5MB
自动生成 200x200 和 48x48 缩略图

4. Split and Execute Commits

Mandatory commit splitting by default: Split changes of different types or modules into separate commits.
Use HEREDOC format to commit to ensure correct formatting:
bash
git commit -m "$(cat <<'EOF'
feat: ✨ 添加用户管理功能

实现用户列表、添加、编辑、删除功能
集成角色权限管理
EOF
)"

Best Practices

Change Splitting (Default Behavior)

Must split changes of different types or modules into independent commits, each commit should do only one thing:
✅ Good practice:
git add src/auth/
git commit -m "feat: ✨ 添加 OAuth2 登录支持"

git add docs/api.md
git commit -m "docs: 📝 更新认证 API 文档"
❌ Bad practice:
git add .
git commit -m "feat: ✨ 添加登录功能和更新文档"

Commits with Scope

For large projects, use scopes to identify the scope of changes:
feat(auth): ✨ 添加双因素认证
fix(ui): 🐛 修复移动端菜单样式
docs(api): 📝 更新用户 API 文档

Breaking Change Markers

If changes are incompatible with older versions, use BREAKING CHANGE:
bash
git commit -m "$(cat <<'EOF'
feat: ✨ 重构用户认证 API

从 Session 改为 JWT Token 认证

BREAKING CHANGE: 旧的 /api/login 接口已移除,
请使用新的 /api/auth/token 接口
EOF
)"

Common Scenarios

New Feature Development

bash
# Add and commit
git add src/features/upload/
git commit -m "feat: ✨ 添加文件批量上传功能"

Bug Fixes

bash
git add src/components/LoginForm.tsx
git commit -m "fix: 🐛 修复登录表单验证码刷新问题"

Multi-file Changes (Must Split)

bash
# Feature implementation
git add src/
git commit -m "$(cat <<'EOF'
feat: ✨ 添加用户积分系统

实现积分获取和消费逻辑
添加积分历史记录
EOF
)"

# Test code
git add tests/
git commit -m "test: ✅ 添加积分系统单元测试"

# Documentation update
git add docs/
git commit -m "docs: 📝 更新积分系统 API 文档"

Dependency Updates

bash
git add package.json package-lock.json
git commit -m "build: 📦 升级 React 到 18.3.0"

Notes

  1. Pre-commit Check: Use
    git status
    and
    git diff
    to confirm change content
  2. Mandatory Commit Splitting: Changes of different types or modules must be split into separate commits (default behavior)
  3. Mandatory Emoji Usage: Each commit message must include the corresponding emoji icon (default behavior)
  4. Disable Co-Author: Do not add
    Co-Authored-By
    attribution (default behavior)
  5. Clear Description: Let others know what was done just by looking at the commit message
  6. Avoid Generic Descriptions: Do not use vague descriptions like "fix bug" or "update code"
  7. Use HEREDOC: Use HEREDOC format for multi-line commit messages to ensure correctness

Reference Resources

  • references/commit-types.md - Complete commit types and examples