commit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCommit 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:
| Type | Description | Example |
|---|---|---|
| New feature | |
| Bug fix | |
| Documentation only | |
| Code style (formatting, semicolons, etc.) | |
| Code refactoring (no feature change) | |
| Performance improvement | |
| Add or modify tests | |
| Build process or auxiliary tools | |
| CI/CD configuration | |
| Build system changes | |
基于项目历史分析,使用以下类型:
| Type | 描述 | 示例 |
|---|---|---|
| 新功能 | |
| Bug修复 | |
| 仅文档变更 | |
| 代码样式(格式化、分号等) | |
| 代码重构(无功能变更) | |
| 性能优化 | |
| 添加或修改测试 | |
| 构建流程或辅助工具变更 | |
| CI/CD配置变更 | |
| 构建系统变更 | |
Scope (Optional)
范围(可选)
Scope indicates the affected module or area, enclosed in parentheses:
feat(agentloop): add verification skill
fix(auth): resolve token refresh issueCommon scopes in this project:
- Plugin names: ,
agentloop,blockletarcblock-context - Skill names: ,
blocklet-dev-setupblocklet-pr - Module names: specific functional modules
范围表示受影响的模块或区域,用括号括起:
feat(agentloop): add verification skill
fix(auth): resolve token refresh issue本项目中的常见范围:
- 插件名称:,
agentloop,blockletarcblock-context - 技能名称:,
blocklet-dev-setupblocklet-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 managementfix: resolve gh command order issuedocs: update installation guide
Bad examples:
- (wrong tense, has period)
feat: Added new feature. - (missing type prefix)
Fix bug - (too verbose)
feat: This commit adds a new feature that...
- 使用祈使语气:用"add"而非"added"或"adds"
- 首字母小写
- 结尾无句号
- 长度控制在50字符以内
- 描述提交的内容
良好示例:
feat: add blocklet-branch skill for branch managementfix: resolve gh command order issuedocs: 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 diffbash
git status
git diff --staged
git diffStep 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:
- List all unstaged/untracked files
- 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
}]
}- If user selects "Stage all": run then continue to Step 3
git add . - If user selects "Abort": stop the workflow and inform user to stage changes manually
- DO NOT proceed until all intended changes are staged
重要提示:如果存在未暂存的变更,请使用AskUserQuestion工具确认后续操作。
检查未暂存的变更:
- 已修改但未暂存的文件()
Changes not staged for commit - 未跟踪的文件()
Untracked files
如果存在未暂存的变更:
- 列出所有未暂存/未跟踪的文件
- 使用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
}]
}- 如果用户选择"Stage all":执行然后继续步骤3
git add . - 如果用户选择"Abort":终止工作流程并告知用户手动暂存变更
- 在所有预期变更都已暂存前,请勿继续
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:
- - Proceed to commit
Approve - - User wants to modify the message
Edit message - - Abort the commit
Cancel
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 --onelinebash
git log -1 --onelineExamples 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 pluginfeat: 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 pluginRules
规则
- Always use English for commit messages
- Always use lowercase type prefix
- Always use imperative mood in subject
- Never end subject with period
- Add Co-Authored-By footer when AI generates the commit
- Keep subject under 50 characters when possible
- Reference PR/Issue numbers when applicable:
(#123)
- 提交信息始终使用英文
- 类型前缀始终使用小写
- 主题始终使用祈使语气
- 主题结尾永远不要加句号
- 当AI生成提交时,添加Co-Authored-By页脚
- 尽可能将主题长度控制在50字符以内
- 适用时引用PR/Issue编号:
(#123)