SuperAPI AI Directory

commit-msg

Coding & development

View repository

Updated 11-08 12:57

About this skill

commit-msg

Determine scope → summarize the message by change type, one line of Chinese per type → confirmation dialog → git commit. The message is an intent summary, not a file-by-file listing; a multi-line message is still used for the same single commit.

Call

Case Behavior
Default (semantic trigger,/commit-msg, invoked by another skill) Full flow
"Message only" (including wording such as "write / generate commit message" and "write a commit message") Output only the message text, one line per type, without modifying the repository
A message is already provided (e.g. "commit with fix: xxx") Skip generation, still check the commit scope, and commit according to the confirmation rules

For interaction, use tools available in the current environment and permitted for that purpose (e.g. AskUserQuestion / request_user_input_async); if no suitable tool exists, ask in the conversation. An unanswered asynchronous question does not count as confirmation. Do not repeatedly ask for the same scope and operation already explicitly authorized in the current session; merely providing a message does not authorize staging all changes.

Final state

For the user and the caller (e.g. create-pr) to verify.create-pr only when COMMITTED and it is verified that HEAD has advanced andgit diff --cached is empty.

Final state Meaning
COMMITTED Success; include the SHA and file list; HEAD has advanced and the staging area is cleared
CANCELLED User canceled; verify and report whether HEAD changed and the actual state of the staging area/working tree. Staging operations already agreed to may have completed; keep their results and do not automatically undo them
FAILED Staging, commit, or post-commit verification failed; include the original error text or the failed checks, as well as the HEAD and index/working tree state at that time. Hooks may leave partial changes; do not falsely claim they have been restored

Flow

For "message only", branch off first: read-only analysis of git status --short and git diff --cached; if there is staged content, use the staging area as the basis; otherwise read the working tree diff and the contents of untracked files. If there are no changes, explain and stop; if there are changes, complete steps 2–3 and then output only the message, skipping all staging, confirmation, and commit steps.

  1. Read the staging area: record git rev-parse HEAD, read git status --short + git diff --cached; do not rely only on filenames.
    • Staging area is not empty: commit only the staged content; do not git add other unstaged changes.
    • Staging area is empty and there are working tree changes:CHECKPOINT — staging scope: show the file list and confirm "stage all changes and continue to preview the commit message" (git add -A) / "cancel, do not commit". Do not git addbefore agreement. Cancel → CANCELLED. Staging fails → FAILED, stop; after success, re-read the staged diff and file list.
    • Both empty: report that there are no changes to commit and stop; do not return COMMITTED。
  2. Align the style:git log -10 --format='%h%n%B', read the complete message to preserve multi-line information. Follow repository conventions; do not force Conventional Commits; for new commits, prioritize type: subject。
  3. Summarize semantics by type: inspect all changes in the selected range and classify them by actual intent. For a single type, generate a one-line Chinese message; when feat, fix, refactor, and other types coexist, each type takes one line, changes of the same type are merged and summarized, and the same change is not listed under multiple types.
  4. CHECKPOINT — Commit confirmation: show the complete message (preserving line breaks) + file list, with "Confirm commit" / "Cancel". Any other input is treated as modifying the message, and the result is shown and confirmed again; the modification itself is not treated as commit confirmation. Do not git commitwithout explicit authorization covering the current range and message. Cancel → CANCELLED。
  5. Commit and verification:
    • Before committing, re-read HEAD and the staged diff, and confirm the staging area is non-empty and the range and content match the confirmed version; if changed, re-summarize and confirm again; if already empty, report that there are no changes to commit and stop.
    • Record HEAD before committing, write the complete message with actual line breaks to a temporary file, then git commit -F <文件>; delete the temporary file whether it succeeds or fails.Do not use git commit -m "..."(backticks / $() / quotes will break the shell).
    • Then use git rev-parse HEAD、git diff --cached and git status --short to verify; return COMMITTEDonly if the command succeeds, HEAD has advanced, and the staging area is empty, attaching the SHA and the actual committed file list obtained from git show --format= --name-only HEAD If the command or verification fails → FAILED(original error text or check result + actual git status), state clearly whether a commit was created, do not hide it, and do not retry automatically.
  6. Do not push。

Message conventions

Each line uses <type>: <subject> or <type>(<scope>): <subject>. Omit if there is no clear scope (most Yakit changes have no scope).

  • Keep a single type on one line; separate multiple types with line breaks, one line per type, with the main change on the first line.
  • Imperative mood (add / fix / update / optimize), primarily Chinese, with terms/component names kept in English.
  • No periods at the end of each line; keep it ≤72 characters where possible (count Chinese as 2).
  • Do not use WIP, misc, update files, 修改, 调整; do not manually write (#PR号)(GitHub adds it automatically when merging PRs).
type Purpose
feat New feature / page / option
fix User-visible behavior fix
perf Performance
refactor Refactor (behavior unchanged)
style Style / UI (no logic change)
docs Documentation (including AGENTS.md, README, comments)
test Tests
build Build / dependencies / Vite / electron-builder
ci CI
chore Scripts, engineering, version number

scope examples:webfuzz、agents、renderer、electron、aiAgent、License。

Examples

Single-line message examples (each line represents one commit):

feat: 添加支持多子Agent的配置选项
fix: 暗色主题下关闭记事本时内容区闪白
docs(agents): 完善启动指南的依赖检查与用户决策弹框交互
build(renderer): 将主渲染端与 Link 从 CRA/Vite6 迁移至 Vite 8

When the same commit contains multiple types:

feat: 添加 AI 会话连接取消与重试功能
fix: 修复关闭会话时丢失排队消息的问题
refactor: 提取共享的会话启动逻辑