SuperAPI AI Directory

custom-skills-git-commit

Coding & development

View repository

Updated 10-16 04:41

About this skill

Git Commit Custom Skill

This Skill provides modular functionality for the Git commit workflow, for use by the git-commit command.


Module list

Module File Description
Shared utilities _utils.md Main branch detection (main/master), conflict handling, commit conventions
Sync sync.md Stash、Rebase/Merge、Stash Pop
Analyze analyze.md Define baseline, check changes
Commit commit.md Normal/Final mode commit
Push push.md Push to remote, handle divergence
Merge merge.md Multi-branch integration testing
PR pr.md Create Pull Request process
PR analysis pr-analyze.md PR-specific change analysis and summary generation

Usage

This Skill is invoked by the git-commit command,should not be used directly。

When invoked, read the corresponding module files according to the routing logic:

Prerequisites (required)

  1. Read _utils.md: obtain main branch name detection and shared functions

Routing logic

IF pr 子指令:
    → 讀取並執行 `pr.md`(內部調用 `pr-analyze.md`)
    → 結束

IF merge 子指令:
    → 讀取並執行 `merge.md`
    → 結束

IF 當前分支為主分支 (main/master):
    IF --direct:
        → 跳過同步,直接執行分析與提交
    ELSE:
        → 警告:「⚠️ 目前在主分支上,建議切換至開發分支。若要直接提交,請使用 --direct 參數。」
        → 中止流程

ELSE (開發分支):
    1. 讀取並執行 `sync.md`   — 環境同步
    2. 讀取並執行 `analyze.md` — 變更分析
    3. 讀取並執行 `commit.md`  — 執行提交
    4. IF --push:
        → 讀取並執行 `push.md` — 推送至遠端

pr mode routing

When using git-commit pr :

1. 讀取 `_utils.md`      — 取得主分支名稱
2. 讀取並執行 `pr.md`    — PR 主流程
   ├─ 前置檢查(分支、gh CLI)
   ├─ 範圍判定
   ├─ 讀取並執行 `pr-analyze.md` — 變更分析與摘要生成
   ├─ ⚠️ 檢查現有 PR(必須在 squash 前執行)
   │   ├─ 若 MERGED/CLOSED → 繼續建立新 PR
   │   └─ 若 OPEN → 詢問使用者:更新現有 PR / 建立新分支+新 PR / 中止
   ├─ 提交整理(除非 --no-squash)
   ├─ 推送
   └─ 建立 PR(預設草稿,--direct 為正式)

⚠️ Important: PR checks must be performed before squash. If the branch already has an OPEN PR, squash will overwrite all commits of that PR. Performing squash without user confirmation may cause irreversible problems.

--direct mode routing

When using --direct to commit on the main branch:

1. 讀取並執行 `analyze.md` — 變更分析
2. 讀取並執行 `commit.md`  — 執行提交
3. IF --push:
    → 讀取並執行 `push.md` — 推送至遠端

Role definition

When executing this Skill, you are a senior DevOps engineer and code review expert. Based on the parameters specified by the user, execute the corresponding commit process.