generate-commit

Generate standardized git commit messages from git diff output.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/CloudyWing/ai-dotfiles --skill generate-commit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: generate-commit
Source: https://github.com/CloudyWing/ai-dotfiles/tree/main/skills/generate-commit
Command: npx skills add https://github.com/CloudyWing/ai-dotfiles --skill generate-commit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

本技能確保每次建立 git commit 時的標題與說明完全根據實際的 git diff 輸出,避免憑對話上下文或記憶推測變更內容,並提供過渡檔案過濾與拆分建議以維持 atomic commit 原則。

Core Features & Use Cases

  • 強制從 git diff(staged 與 unstaged)擷取變更細節以撰寫 Subject 與 Body,保證描述與實際變更 100% 一致。
  • 自動偵測典型過渡或暫存檔(如 .bak、.tmp、CONTEXT.local.md)並提示是否需要 unstage;分析是否建議拆分為多個 commit(檔案級或 hunk 級)並產生拆分計畫。
  • 支援自動執行 commit 流程(單一 commit 或依檔案級拆分依序 stage → commit),對於 hunk 級拆分則產出明確行範圍與 git add -p 指示,等待使用者完成 staging 後繼續執行。

Quick Start

請根據目前 repository 的 staged 或 unstaged 變更檢索 git diff,產生符合專案 commit 規範的 commit 訊息並執行相應的 commit 操作。

Frequently Asked Questions about generate-commit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate git commit messages from staged and unstaged diffs?

To generate git commit messages from diffs, the Skill reads actual git diff --cached and git diff outputs to produce standardized headers and bodies, ensuring descriptions match real repository changes. It enforces commit message rules and detects temporary files before committing.

What is the best way to split unrelated git changes into atomic commits?

The best way to split unrelated changes into atomic commits is using file-level or hunk-level split plans. The Skill analyzes git diff outputs, detects unrelated changes, and generates specific staging instructions using git add -p for precise hunk-level separation.

Can I automatically execute file-level commit splitting without manual staging?

Yes, you can automatically execute file-level commit splitting. The Skill sequentially stages and commits files according to the generated split plan, handling the entire workflow automatically for file-level separations while providing instructions for hunk-level splits.

How does temporary file detection work during git staging?

Temporary file detection during git staging works by scanning staged changes for typical transient files like .bak, .tmp, and CONTEXT.local.md. The Skill identifies these files and prompts whether they should be unstaged before generating the final commit message.

Why should commit messages be generated from actual git diff output instead of context?

Commit messages should be generated from actual git diff output to avoid hallucinated changes based on conversation context. Reading real diff outputs guarantees that the subject and body descriptions match the staged or unstaged repository changes with complete accuracy.