Plan and create small, logical git commits from a mixed working tree, with confirmation before every commit and no push or history rewrite unless asked.
--- name: git-commit-automation description: Turns a working tree with mixed changes into a reviewed series of small, logical git commits. Inspects status and diffs, proposes a commit plan with messages, stages and commits only after the user confirms, and adds an annotated tag only when asked. Use when the user says commit my changes, split this into commits, clean up these changes into commits, or tag a release locally. Never pushes or rewrites published history unless explicitly requested. compatibility: Requires git and a shell in the repository the user wants to commit to. metadata: version: "1.0.0" category: "Development Tools" --- # Git Commit Automation End-to-end local commit workflow: inspect, plan, confirm, commit, verify. For writing a single message from what is already staged, a narrower message-only skill is enough; this skill decides *what* goes into each commit. ## When not to use - The user only wants a message for changes they already staged. - The repository is mid-merge, mid-rebase or mid-cherry-pick (`git status` says so). Report the state and stop; finishing it is the user's decision. - The user asks to push, force-push, amend or rebase commits that already exist on a remote. Do those only on an explicit, specific request and say what will change on the remote first. ## Inputs to collect - Repository path (default: current directory). - Commit message convention used by the project: check `git log --oneline -20`, `CONTRIBUTING.md`, commitlint config. Default to Conventional Commits only if the history already uses it. - Whether a tag is wanted, its name and message. No tag unless asked. ## Workflow 1. **Inspect, read-only.** ```bash git rev-parse --show-toplevel git status --porcelain=v1 --branch git diff --stat # unstaged git diff --cached --stat # already staged git log --oneline -20 ``` If changes are already staged, ask whether to keep that staging as the first commit or re-plan from scratch. 2. **Screen for things that should not be committed**: `.env`, keys, tokens, credentials, large binaries, build output, editor files, debug prints. List them and leave them out unless the user insists; suggest a `.gitignore` entry instead. 3. **Group changes into logical commits.** One purpose per commit (a feature, a fix, a refactor, docs, dependency bump). Keep a source change with its tests. When one file mixes purposes, plan a partial stage with `git add -p <file>` and say which hunks go where. 4. **Show the plan and stop for confirmation.** For each commit: files (or hunks), message subject (imperative, ≤72 chars), optional body explaining why. Nothing is staged or committed before the user approves or edits the plan. 5. **Execute one commit at a time.** ```bash git add -- path/one path/two # or git add -p path for partial files git diff --cached --stat # confirm the index matches the plan git commit -m "fix(parser): handle empty input" -m "Body explaining why." ``` Do not use `--no-verify`. If a pre-commit hook fails, show its output, fix only if the fix is obvious and in scope, and ask before retrying. 6. **Optional tag (only if requested).** ```bash git tag -a v1.4.0 -m "Release 1.4.0" ``` Check the name is unused first (`git tag --list v1.4.0`). Do not push the tag. 7. **Verify and report.** ```bash git log --oneline -n <number of new commits> git status --short ``` Report each new commit hash and subject, and anything intentionally left uncommitted. ## Output format ``` Commit plan (3 commits) 1. feat(cart): add quantity limits src/cart.js, test/cart.test.js 2. docs: document quantity limits README.md 3. chore: ignore local coverage output .gitignore Left out: .env.local (contains secrets) Proceed? (yes / edit / cancel) ``` ## Safety and limitations - Never run `git push`, `git push --force`, `git commit --amend`, `git rebase`, `git reset --hard` or `git clean` as part of this workflow unless the user explicitly asks for that specific operation. - Messages describe the diff; do not claim tests passed unless you ran them in this session and saw them pass. - Repository host (GitHub, GitLab, Bitbucket) does not matter for local commits; this skill does not call any hosting API. ## Example Working tree: `src/cart.js` and `test/cart.test.js` add a max-quantity check, `README.md` documents it, `.env.local` was edited. Plan: commit 1 `feat(cart): reject quantities above the configured maximum` (src + test), commit 2 `docs: document maximum cart quantity` (README), `.env.local` left out and reported. After "yes": two commits created, `git status --short` lists only `.env.local` (`??` if untracked, ` M` if tracked).
Generate a GitHub Actions (or other CI) pipeline from the repo's real scripts, with least-privilege permissions, caching, concurrency and a gated deploy.
Generate a compose.yaml for your app, database and cache with health-checked startup, named volumes and secrets in .env, validated with docker compose config.
Automate notifications and alerts
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
Content reviewed .
A developer has finished a small feature but the working tree also contains a docs edit and a local secrets file; they want clean commits without accidentally committing the secret.
Commit my changes as separate logical commits. Modified: src/cart.js and test/cart.test.js (new max-quantity check), README.md (documents the limit). Untracked: .env.local. Then tag it v0.2.0 locally.
First a read-only inspection (git status --porcelain=v1 --branch, git diff --stat) and a commit plan, then a pause for confirmation. Illustrative plan: 1. feat(cart): reject quantities above the configured maximum — src/cart.js, test/cart.test.js 2. docs: document maximum cart quantity — README.md Left out: .env.local (looks like local secrets) Tag after commits: v0.2.0 (annotated, not pushed) After the user confirms: two commits, an annotated tag v0.2.0, and a report listing the new hashes and that .env.local remains uncommitted. No push.
AI Agent Skills are reusable workflow packages that extend your AI coding assistant with multi-step capabilities. Install Git Commit Automation by following these steps.
SKILL.md inside, in the location documented by your client. Do not assume every AI application reads the same directory.Requires an Agent Skills-compatible client; supported locations and activation vary by version. Read the SKILL.md setup guide. MCP connects tools and data and does not, by itself, install a skill.
Generate a GitHub Actions (or other CI) pipeline from the repo's real scripts, with least-privilege permissions, caching, concurrency and a gated deploy.
Generate a compose.yaml for your app, database and cache with health-checked startup, named volumes and secrets in .env, validated with docker compose config.
Automate notifications and alerts