commit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Commit Skill

Commit 技能

Generate standardized git commit messages following the project's Conventional Commits specification.
遵循项目的Conventional Commits规范生成标准化的Git提交信息。

Commit Message Format

提交信息格式

<type>(<scope>): <subject>

<body>

<footer>
<type>(<scope>): <subject>

<body>

<footer>

Type (Required)

类型(必填)

Based on project history analysis, use the following types:
TypeDescriptionExample
feat
New feature
feat: add user authentication
fix
Bug fix
fix: resolve login timeout issue
docs
Documentation only
docs: update API documentation
style
Code style (formatting, semicolons, etc.)
style: fix indentation
refactor
Code refactoring (no feature change)
refactor: extract validation logic
perf
Performance improvement
perf: optimize database queries
test
Add or modify tests
test: add unit tests for auth module
chore
Build process or auxiliary tools
chore: update dependencies
ci
CI/CD configuration
ci: add GitHub Actions workflow
build
Build system changes
build: upgrade webpack to v5
基于项目历史分析,使用以下类型:
Type描述示例
feat
新功能
feat: add user authentication
fix
Bug修复
fix: resolve login timeout issue
docs
仅文档变更
docs: update API documentation
style
代码样式(格式化、分号等)
style: fix indentation
refactor
代码重构(无功能变更)
refactor: extract validation logic
perf
性能优化
perf: optimize database queries
test
添加或修改测试
test: add unit tests for auth module
chore
构建流程或辅助工具变更
chore: update dependencies
ci
CI/CD配置变更
ci: add GitHub Actions workflow
build
构建系统变更
build: upgrade webpack to v5

Scope (Optional)

范围(可选)

Scope indicates the affected module or area, enclosed in parentheses:
feat(agentloop): add verification skill
fix(auth): resolve token refresh issue
Common scopes in this project:
  • Plugin names:
    agentloop
    ,
    blocklet
    ,
    arcblock-context
  • Skill names:
    blocklet-dev-setup
    ,
    blocklet-pr
  • Module names: specific functional modules
范围表示受影响的模块或区域,用括号括起:
feat(agentloop): add verification skill
fix(auth): resolve token refresh issue
本项目中的常见范围:
  • 插件名称:
    agentloop
    ,
    blocklet
    ,
    arcblock-context
  • 技能名称:
    blocklet-dev-setup
    ,
    blocklet-pr
  • 模块名称:特定功能模块

Subject (Required)

主题(必填)

  • Use imperative mood: "add" not "added" or "adds"
  • Lowercase first letter
  • No period at the end
  • Keep under 50 characters
  • Describe what the commit does
Good examples:
  • feat: add blocklet-branch skill for branch management
  • fix: resolve gh command order issue
  • docs: update installation guide
Bad examples:
  • feat: Added new feature.
    (wrong tense, has period)
  • Fix bug
    (missing type prefix)
  • feat: This commit adds a new feature that...
    (too verbose)
  • 使用祈使语气:用"add"而非"added"或"adds"
  • 首字母小写
  • 结尾无句号
  • 长度控制在50字符以内
  • 描述提交的内容
良好示例:
  • feat: add blocklet-branch skill for branch management
  • fix: resolve gh command order issue
  • docs: update installation guide
不良示例:
  • feat: Added new feature.
    (时态错误,带句号)
  • Fix bug
    (缺少类型前缀)
  • feat: This commit adds a new feature that...
    (过于冗长)

Body (Optional)

正文(可选)

  • Wrap at 72 characters
  • Explain "what" and "why" vs "how"
  • Separate from subject with blank line
  • 每行不超过72字符
  • 解释"做了什么"和"为什么做",而非"怎么做"
  • 与主题之间用空行分隔

Footer (Optional)

页脚(可选)

  • Reference issues:
    Closes #123
  • Breaking changes:
    BREAKING CHANGE: description
  • 引用问题:
    Closes #123
  • 破坏性变更:
    BREAKING CHANGE: description

Workflow

工作流程

When user requests to create a commit:
当用户请求创建提交时:

Step 1: Check Current Status

步骤1:检查当前状态

bash
git status
git diff --staged
git diff
bash
git status
git diff --staged
git diff

Step 2: Verify All Changes Are Staged

步骤2:确认所有变更已暂存

IMPORTANT: If there are unstaged changes, use AskUserQuestion to confirm how to proceed.
Check for unstaged changes:
  • Modified files not staged (
    Changes not staged for commit
    )
  • Untracked files (
    Untracked files
    )
If unstaged changes exist:
  1. List all unstaged/untracked files
  2. Use AskUserQuestion tool to ask user how to proceed:
json
{
  "questions": [{
    "question": "There are unstaged changes. How would you like to proceed?",
    "header": "Unstaged",
    "options": [
      {"label": "Stage all", "description": "Run `git add .` to stage all changes"},
      {"label": "Abort", "description": "Cancel the commit and handle changes manually"}
    ],
    "multiSelect": false
  }]
}
  1. If user selects "Stage all": run
    git add .
    then continue to Step 3
  2. If user selects "Abort": stop the workflow and inform user to stage changes manually
  3. DO NOT proceed until all intended changes are staged
重要提示:如果存在未暂存的变更,请使用AskUserQuestion工具确认后续操作。
检查未暂存的变更:
  • 已修改但未暂存的文件(
    Changes not staged for commit
  • 未跟踪的文件(
    Untracked files
如果存在未暂存的变更:
  1. 列出所有未暂存/未跟踪的文件
  2. 使用AskUserQuestion工具询问用户后续操作:
json
{
  "questions": [{
    "question": "There are unstaged changes. How would you like to proceed?",
    "header": "Unstaged",
    "options": [
      {"label": "Stage all", "description": "Run `git add .` to stage all changes"},
      {"label": "Abort", "description": "Cancel the commit and handle changes manually"}
    ],
    "multiSelect": false
  }]
}
  1. 如果用户选择"Stage all":执行
    git add .
    然后继续步骤3
  2. 如果用户选择"Abort":终止工作流程并告知用户手动暂存变更
  3. 在所有预期变更都已暂存前,请勿继续

Step 3: Analyze Staged Changes

步骤3:分析已暂存的变更

Only proceed if all changes are properly staged:
  • Identify the type of change (feature, fix, docs, etc.)
  • Determine the scope if applicable
  • Summarize the change concisely
仅当所有变更都已正确暂存时,才可继续:
  • 确定变更类型(功能、修复、文档等)
  • 确定适用的范围(如有)
  • 简洁总结变更内容

Step 4: Generate and Confirm Commit Message

步骤4:生成并确认提交信息

Generate the commit message following the format, then use AskUserQuestion tool to confirm:
Proposed commit message:

<type>(<scope>): <subject>

<body if needed>

Co-Authored-By: Claude <noreply@anthropic.com>
Use AskUserQuestion tool with options:
  • Approve
    - Proceed to commit
  • Edit message
    - User wants to modify the message
  • Cancel
    - Abort the commit
Example AskUserQuestion usage:
json
{
  "questions": [{
    "question": "Proceed with this commit message?",
    "header": "Commit",
    "options": [
      {"label": "Approve", "description": "Create the commit with this message"},
      {"label": "Edit message", "description": "Modify the commit message"},
      {"label": "Cancel", "description": "Abort the commit"}
    ],
    "multiSelect": false
  }]
}
按照格式生成提交信息,然后使用AskUserQuestion工具确认:
Proposed commit message:

<type>(<scope>): <subject>

<body if needed>

Co-Authored-By: Claude <noreply@anthropic.com>
使用AskUserQuestion工具提供以下选项:
  • Approve
    - 继续提交
  • Edit message
    - 用户想要修改信息
  • Cancel
    - 终止提交
AskUserQuestion工具使用示例:
json
{
  "questions": [{
    "question": "Proceed with this commit message?",
    "header": "Commit",
    "options": [
      {"label": "Approve", "description": "Create the commit with this message"},
      {"label": "Edit message", "description": "Modify the commit message"},
      {"label": "Cancel", "description": "Abort the commit"}
    ],
    "multiSelect": false
  }]
}

Step 5: Execute Commit (Only After User Confirmation)

步骤5:执行提交(仅在用户确认后)

bash
git commit -m "$(cat <<'EOF'
<type>(<scope>): <subject>

<body if needed>

Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"
bash
git commit -m "$(cat <<'EOF'
<type>(<scope>): <subject>

<body if needed>

Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"

Step 6: Verify Commit

步骤6:验证提交

bash
git log -1 --oneline
bash
git log -1 --oneline

Examples from Project History

项目历史中的示例

feat: parse blocklet urls from dev output instead of constructing from did
feat: add blocklet-branch skill for branch management
feat: enhance blocklet-server-dev-setup skill with GitHub CLI authentication guidance
feat(agentloop): add verification skill (#1)
fix: gh move top
docs: prefer git URL format for marketplace installation
chore: initial commit
chore: cleanup hello world plugin
feat: parse blocklet urls from dev output instead of constructing from did
feat: add blocklet-branch skill for branch management
feat: enhance blocklet-server-dev-setup skill with GitHub CLI authentication guidance
feat(agentloop): add verification skill (#1)
fix: gh move top
docs: prefer git URL format for marketplace installation
chore: initial commit
chore: cleanup hello world plugin

Rules

规则

  1. Always use English for commit messages
  2. Always use lowercase type prefix
  3. Always use imperative mood in subject
  4. Never end subject with period
  5. Add Co-Authored-By footer when AI generates the commit
  6. Keep subject under 50 characters when possible
  7. Reference PR/Issue numbers when applicable:
    (#123)
  1. 提交信息始终使用英文
  2. 类型前缀始终使用小写
  3. 主题始终使用祈使语气
  4. 主题结尾永远不要加句号
  5. 当AI生成提交时,添加Co-Authored-By页脚
  6. 尽可能将主题长度控制在50字符以内
  7. 适用时引用PR/Issue编号
    (#123)