| name | git-commit-composer |
| metadata | {"version":"0.0.1","author":"ShuangShu"} |
| description | Summarize git diff changes, craft accurate commit messages, and execute a safe commit workflow. |
Git Commit Composer
Overview
Use this skill to turn raw git changes into a high-quality commit in one flow:
- describe diff,
- generate commit message,
- create commit.
Inputs Needed
- Target branch and task context.
- Current changes (
git status, git diff, git diff --staged).
- Optional commit style preference (free-form or Conventional Commits).
Workflow
- Inspect working tree.
- Run
git status --short to list changed files.
- If nothing is staged, inspect
git diff; if staged exists, prioritize git diff --staged.
- Build a diff summary.
- Summarize what changed, why it changed, and user-visible impact.
- Call out risk points: breaking behavior, config changes, migrations, test impact.
- Prepare commit scope.
- Stage only relevant files (
git add <files>).
- Re-check staged diff with
git diff --staged to avoid unrelated changes.
- Draft commit message.
- Subject line: imperative mood, <= 72 chars.
- Body (optional): why, what, and risk/compatibility notes.
- When requested, use Conventional Commits format:
<type>(<scope>): <subject>.
- Execute commit.
- Run
git commit -m "<subject>".
- If body is needed, use multiple
-m flags.
- Return commit hash and final message.
Safety Rules
- Never include unrelated files in staged set.
- Never use destructive git commands (
reset --hard, checkout --, etc.) unless explicitly requested.
- If diff contains mixed concerns, split into multiple commits and messages.
Output Contract
- Diff Summary: concise explanation of functional change.
- Proposed Commit Message:
- Commit Result:
- Executed command
- Commit hash
- Included file list