Files
git/skills/commit/SKILL.md
2026-08-21 13:08:43 +08:00

41 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: commit
description: Group all pending file changes by conventional type and feature, then commit each group as {type}({scope}): {message}. Message style is full (What/Why/How/Who), brief (one line from git diff), or custom, chosen via decision tree. Use whenever changes must be committed; not for push or PR creation.
---
# commit — 分組認可檔案變更
## 步驟
1. 追蹤所有檔案變更:先 `git status --porcelain` 檢視全部變更,再逐組 `git add`(不可盲目 `git add -A` 後一次 commit)。
2. 依「同類型 + 同需求/功能」將檔案變更分組,一組一個 commit。
3. 每組依格式認可:`{類型}({需求 or 功能}): {訊息}`。
## 類型表
| 類型 | 用途 |
| --- | --- |
| feat | 新增/修改功能 |
| fix | 修補 bug |
| docs | 文件 |
| style | 格式(不影響程式碼運行的變動) |
| refactor | 重構(既不是新增功能,也不是修補 bug 的程式碼變動) |
| perf | 改善效能 |
| test | 增加測試 |
| chore | 建構程序或輔助工具的變動 |
| revert | 撤銷回覆先前的 commit |
## 訊息格式(三選一)
依 `jsc-ask:ask` 規則詢問使用者;問詢紀錄或本 session 已有慣例就不再問。
1. **完整版**:包含做什麼(What)、為什麼做(Why)、怎麼做(How)、哪個功能做(Who)。
2. **簡易版**:根據 `git diff` 總結出一句描述。
3. **自訂**:使用者自行輸入訊息。
## 規則
1. 分組與訊息草擬的細節**必須以 sub agent 執行**,主 agent 只確認分組結果與執行 commit。
2. 訊息一律 UTF-8 繁體中文(類型與 scope 除外)。
3. 不可 push;push 與 PR 由 `jsc-git:pr` 負責。