Commit Work

作者 softaworks3027f20f3181无许可证2.5K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库7个月前更新

Create high-quality git commits: review/stage intended changes, split into logical commits, and write clear commit messages (including Conventional Commits). Use when the user asks to commit, craft a commit message, stage changes, or split work into multiple commits.

AI 生成的概览

指导审查、暂存并拆分 git 改动为逻辑提交,并撰写 Conventional Commits 格式的提交信息。

功能
该技能提供一套准备 git 提交的清单式流程:检查工作区、确定提交边界、只暂存应包含的改动(混合改动可用补丁暂存),并审查已暂存的差异。它产出 Conventional Commits 格式的最终提交信息、每个提交的简短 what/why 说明,以及所用的暂存与审查命令。它还包含提交信息模板参考,并在继续前运行最小相关验证。
适用场景
当用户要求提交改动、撰写提交信息、暂存改动,或把工作拆分为多个提交时使用。它适用于希望提交逻辑清晰、信息遵循 Conventional Commits 的代码仓库。
运行要求
需要 git 仓库,并让智能体可调用 git;不附带脚本,只有说明和一份参考模板。技能声明 Conventional Commits 为必需格式,流程中会用到 git status、git diff、git add -p、git restore --staged、git commit -v 以及仓库中最快的相关检查。

Commit work

Goal

Make commits that are easy to review and safe to ship:

  • only intended changes are included
  • commits are logically scoped (split when needed)
  • commit messages describe what changed and why

Inputs to ask for (if missing)

  • Single commit or multiple commits? (If unsure: default to multiple small commits when there are unrelated changes.)
  • Commit style: Conventional Commits are required.
  • Any rules: max subject length, required scopes.

Workflow (checklist)

  1. Inspect the working tree before staging
    • git status
    • git diff (unstaged)
    • If many changes: git diff --stat
  2. Decide commit boundaries (split if needed)
    • Split by: feature vs refactor, backend vs frontend, formatting vs logic, tests vs prod code, dependency bumps vs behavior changes.
    • If changes are mixed in one file, plan to use patch staging.
  3. Stage only what belongs in the next commit
    • Prefer patch staging for mixed changes: git add -p
    • To unstage a hunk/file: git restore --staged -p or git restore --staged <path>
  4. Review what will actually be committed
    • git diff --cached
    • Sanity checks:
      • no secrets or tokens
      • no accidental debug logging
      • no unrelated formatting churn
  5. Describe the staged change in 1-2 sentences (before writing the message)
    • "What changed?" + "Why?"
    • If you cannot describe it cleanly, the commit is probably too big or mixed; go back to step 2.
  6. Write the commit message
    • Use Conventional Commits (required):
      • type(scope): short summary
      • blank line
      • body (what/why, not implementation diary)
      • footer (BREAKING CHANGE) if needed
    • Prefer an editor for multi-line messages: git commit -v
    • Use references/commit-message-template.md if helpful.
  7. Run the smallest relevant verification
    • Run the repo's fastest meaningful check (unit tests, lint, or build) before moving on.
  8. Repeat for the next commit until the working tree is clean

Deliverable

Provide:

  • the final commit message(s)
  • a short summary per commit (what/why)
  • the commands used to stage/review (at minimum: git diff --cached, plus any tests run)

来源与署名

来源:softaworks/agent-toolkit位于skills/commit-work提交3027f20

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架