AgentSkillsCN

git-commit

根据差异自动生成提交信息,对暂存和提交进行分步操作。当用户希望以智能提交信息进行提交——即“基于变更生成提交信息”——或希望在不手动输入提交信息的情况下一次性完成暂存与提交时,可使用此功能。

SKILL.md
--- frontmatter
name: git-commit
description: Stages changes and commits with an auto-generated message derived from the diff. Use when the user wants to commit with a smart message, "git commit with message from changes", or to stage and commit in one go without typing the message.

Git Commit (auto message)

Workflow

  1. Stagegit add -A (or stage specific paths if the user specified).
  2. Inspect — Run git status -sb and git diff --cached (and git diff --cached --stat if helpful). If nothing staged, stop and report.
  3. Compose — From the staged diff, write a single short commit message: concise, imperative, summarizing the change (e.g. "Add raw mouse cursor clip on focus loss", "Fix cbuf overflow logging in debug build"). Prefer conventional style only when it fits (e.g. fix(menus): ...).
  4. Commitgit commit -m "message".

Do not bump version or push unless the user asks.

Optional: stage and show in one go

From repo root, to stage everything and print the diff for message composition:

bash
./.cursor/skills/git-commit/scripts/stage_and_show.sh

Then compose the message from the output and run git commit -m "...".

Scope

  • Default: stage all changes (git add -A). If the user names paths or says "only …", stage only those.
  • Untracked files are included with -A; ensure .gitignore is correct.