commit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCommit Skill
Commit Skill
Create conventional commits after task completion with user confirmation.
在完成任务后,经用户确认后创建符合规范的conventional commits。
When to Use
适用场景
- After completing a task or logical unit of work
- When the user requests a commit
- After significant documentation updates
- After implementing a feature or fix
- 完成任务或一个逻辑工作单元后
- 用户请求提交时
- 完成重要文档更新后
- 实现新功能或修复Bug后
Procedure
操作流程
Step 1: Gather Changes
步骤1:收集更改
bash
git status
git diff --statbash
git status
git diff --statStep 2: Analyze Changes
步骤2:分析更改
Identify:
- Files modified, added, or deleted
- Type of change (feat, fix, docs, refactor, style, test, chore)
- Scope (which module/area affected)
- Breaking changes (if any)
确认以下内容:
- 已修改、新增或删除的文件
- 更改类型(feat、fix、docs、refactor、style、test、chore)
- 影响范围(涉及哪个模块/区域)
- 是否存在破坏性更改(若有)
Step 3: Draft Commit Message
步骤3:草拟提交信息
Use conventional commits format:
<type>(<scope>): <short description>
<body with details>
<footer>Types:
- : New feature
feat - : Bug fix
fix - : Documentation only
docs - : Code change that neither fixes a bug nor adds a feature
refactor - : Formatting, missing semicolons, etc.
style - : Adding or updating tests
test - : Maintenance tasks, dependencies
chore
Example:
feat(auth): add password reset flow
- Add forgot password endpoint
- Implement email verification token
- Add password reset form component
Closes #123使用conventional commits格式:
<type>(<scope>): <简短描述>
<详细说明正文>
<页脚>类型说明:
- :新功能
feat - :修复Bug
fix - :仅更新文档
docs - :既不修复Bug也不添加新功能的代码变更
refactor - :格式调整,如缺少分号等
style - :添加或更新测试
test - :维护任务、依赖管理等
chore
示例:
feat(auth): add password reset flow
- Add forgot password endpoint
- Implement email verification token
- Add password reset form component
Closes #123Step 4: Show Diff and Confirm
步骤4:展示差异并确认
Before committing, ALWAYS:
- Show the user what will be committed:
bash
git diff --staged # or git diff if not staged-
Show the proposed commit message
-
Ask: "Ready to commit these changes? (yes/no)"
-
Wait for explicit user approval
提交前,必须执行以下操作:
- 向用户展示即将提交的内容:
bash
git diff --staged # 若未暂存则使用 git diff-
展示草拟的提交信息
-
询问:"是否准备提交这些更改?(是/否)"
-
等待用户明确批准
Step 5: Execute Commit (only after approval)
步骤5:执行提交(仅在获得批准后)
bash
git add -A # or specific files
git commit -m "<message>"bash
git add -A # 或指定具体文件
git commit -m "<message>"Step 6: Verify
步骤6:验证提交
bash
git log -1 --statbash
git log -1 --statRules
规则
- NEVER push — Only commit locally, never run
git push - ALWAYS confirm — Never commit without explicit user approval
- Show diff first — User must see changes before approving
- One logical unit — Each commit should represent one complete change
- Conventional format — Always use type(scope): description format
- 禁止推送 — 仅在本地提交,绝不执行命令
git push - 必须确认 — 未经用户明确批准,绝不提交
- 先展示差异 — 用户必须先查看更改内容再批准
- 单一逻辑单元 — 每次提交应代表一个完整的独立更改
- 遵循规范格式 — 始终使用 type(scope): description 格式
Output Format
输出格式
undefinedundefinedProposed Commit
拟提交内容
Type: feat
Scope: auth
Files:
- src/auth/reset.ts (new)
- src/components/ResetForm.tsx (new)
- src/api/routes.ts (modified)
Message:
feat(auth): add password reset flow
- Add forgot password endpoint
- Implement email verification token
- Add password reset form component
Closes #123Diff summary:
3 files changed, 245 insertions(+)
Ready to commit these changes?
undefined类型: feat
范围: auth
涉及文件:
- src/auth/reset.ts (新增)
- src/components/ResetForm.tsx (新增)
- src/api/routes.ts (修改)
提交信息:
feat(auth): add password reset flow
- Add forgot password endpoint
- Implement email verification token
- Add password reset form component
Closes #123差异摘要:
3 files changed, 245 insertions(+)
是否准备提交这些更改?
undefined