AGENT SKILL

commit

Create scoped conventional commits from approved local changes, validate them, and push. Use only when the user explicitly asks to commit, invokes /commit or $commit, or clearly asks to ship approved work.

License 许可
MIT
所属仓库
PetrIvan/website
最近更新
2026-11-10
Stars
★ 0
Forks
0

01 前言 Front Matter

name
commit
description
Create scoped conventional commits from approved local changes, validate them, and push. Use only when the user explicitly asks to commit, invokes /commit or $commit, or clearly asks to ship approved work.

03 SKILL.md 正文

Commit Protocol

Commit only changes that belong to the approved task. Preserve unrelated user or agent work, including already staged changes.

A commit authorization always includes push authorization. Unless the user explicitly says not to push or to keep the commit local, this workflow is not complete until the current branch has been pushed successfully or a concrete push failure has been reported.

Preconditions

  1. Confirm that .git exists. If it does not, stop. Never initialize the repository from this skill.
  2. Read AGENTS.md.
  3. Run:
git status --short --untracked-files=all
git diff
git diff --cached

Before the first commit, inspect every untracked path. Do not stage environment files, tokens, account data, local agent state, build output, or unexpected personal material. Surface uncertain files to the user instead of guessing.

Scope and validate

Group the approved work into self-contained thematic commits. Format only the files in scope when possible.

Read AGENTS.md and run the narrowest checks that cover the exact changes intended for the commit. Use pnpm install --frozen-lockfile and pnpm run validate for broad site, dependency, CI, or deployment changes; do not impose the full browser suite on an isolated documentation or skill edit. For workflow changes, also validate the YAML and repository action policies, including full-length commit SHA pinning, because test commands do not cover job setup failures.

Do not hide failures with --no-verify. Fix failures caused by the scoped work and report unrelated failures without absorbing them.

Stage and inspect

Stage explicit paths. Avoid git add ., git add -A, and other broad staging for a shared or unaudited tree.

After staging each group, run:

git diff --cached --stat
git diff --cached

Confirm that the staged diff contains only the intended files and no secrets or generated build output.

Commit

Use a lowercase conventional prefix:

  • feat: new user-visible functionality
  • fix: corrected behavior
  • refactor: structural change without intended behavior change
  • chore: tooling, dependencies, CI, or repository configuration
  • docs: prose or agent guidance
  • test: test-only changes

Keep the subject under 72 characters and focused on why. Add a body when the motivation or non-obvious behavior needs explanation. Use plain ASCII in commit messages. Never add co-author, generated-by, or agent attribution.

Push

After all requested commits succeed, always push the current branch:

git push

If the branch has no upstream:

git push -u origin HEAD

Do not wait for a separate push request and do not ask whether to push. The only exception is an explicit instruction not to push or to keep the commit local.

Never force-push. If the remote advanced, fetch and inspect the divergence. Do not rebase, pull, reset, or stash shared work without explicit coordination.

Report the commit hashes, subjects, validation run, and push result.

04 同仓库更多 Skills