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 從公開儲存庫中收錄這些內容。

檢舉或申請下架