SuperAPI AI Directory

git-commit

Coding & development

View repository

Updated 10-15 20:09

About this skill

Git code commit

Standalone tool skill. Anyone can call it. When to commit, which files to commit, and the key points of the commit message are given by the caller; this skill is only responsible for how to commit.

Goal

Complete the Git commit according to the mode. In interactive mode, you may ask again whether to push; in auto mode, only do a local commit.

Mode

  • Interactive(default): the user explicitly requests a commit or push.
  • auto: the caller specifies auto. Local git add + git commit,push prohibited, do not ask whether to push.

Unified tool definition

  • 交互式提问: a type of tool built into most Agents, a tool by which the Agent asks the user questions and provides options and custom input; its name varies across different Agents, and it may be called AskUserQuestion or AskQuestion , etc. In auto mode, do not use it to ask whether to push.

Interactive mode

  1. Check git status / git diff / git log, understand the intent of the changes.
  2. Determine whether it contains secrets or content that should not be committed, and use the 交互式提问 tool to confirm with the user.
  3. Organize the changes into one or more logical commits; do not cram unrelated changes into one commit.
  4. Follow the commit specification to write the Chinese commit message.
  5. After confirming it is safe, git add and git commit. Do not --no-verify。
  6. use the 交互式提问 tool to ask whether to push; only if needed git push。

auto mode

  1. git status: no tracked changes and no new files that should be committed → report "no commit", end.
  2. If .env, secrets, credentials, or files that clearly should not be committed are found → stop, do not commit, list them to the user. Do not ask a question to pass the risk by.
  3. Staging scope: if the caller specifies paths, stage only those paths; if not specified, stage only the files that should be committed in this round. Do not casually include unrelated dirty files. Do not force-add paths that are already gitignored.
  4. One logical commit; follow the commit specification to write the Chinese message. If the caller provides key points for the commit message, use them; otherwise write according to the actual diff.
  5. git add specified path + git commit. Do not --no-verify. Do not git push。
  6. Report the commit hash, and state clearly that it has not been pushed.

Commit specification

<类型>(<范围>)!: <描述>

[可选的正文]

[可选的脚注]

Core specification

  • Commit messages must be written in Chinese

Title

  • Use the imperative mood or a concise verb phrase
  • Describe "what was done", avoid vague descriptions
  • Try to keep it within 50 characters

Body

  • Explain why it was changed, not just what was changed
  • Explain important implementation trade-offs
  • Mention behavior changes, compatibility impacts, and migration matters
  • Try to keep each line within 72 characters

Footer

For breaking changes use:

破坏性变更: <描述破坏性变更的内容>

Commit type

Type Description
feat New feature
fix Bug fix
docs Documentation changes
style Code formatting changes, no logic impact
refactor Refactoring, no new features and no bug fixes
perf Performance optimization
test Test-related
build Build system or dependency changes
ci CI/CD configuration changes
chore Routine maintenance, miscellaneous
revert Revert commit