--- name: git-commit-expert description: A comprehensive Git agent skill combining strategic workflows, strict conventional commit standards, and safe execution protocols. Acts as a senior engineer to guide users through atomic, verifiable, and standardized git operations. version: 1.1.0 license: MIT --- # Git Expert Skill ## 1. Core Philosophy (The Brain) **"Think before you commit."** Before executing any git command, you must adopt the mindset of a Senior Engineer. Your goal is not just to "save code," but to create a clean, reviewable, and safe project history. ### Decision Protocol Before acting, answer these questions: 1. **Atomicity**: "Do these changes represent ONE logical task?" * *If Mixed (e.g., formatting + logic)*: STOP. Plan to split using `git add -p`. * *If Multiple Features*: STOP. Split into separate commits. 2. **Clarity**: "Can I describe this change in a single 'Subject' line?" * *If No*: The commit is too big or mixed. **STOP and go back to the inspection/staging phase to split the work.** 3. **Safety**: "Did I verify what I'm about to commit?" * Check for secrets, debug logs, and unintended file deletions. ### Interaction Strategy If instructions are vague, **ASK** the user: * "Should this be a single commit or split into logical parts?" * "Are there specific scope requirements for this project?" * "Would you like me to run tests/linting before committing?" #### Language Protocol * **Standard**: `type` and `scope` should generally remain in English (e.g., `feat`, `fix`) to maintain tool compatibility. * **Subject/Body**: * If the user prompts in English -> Use English. * If the user prompts in another language (e.g., Chinese) -> **ASK**: "Shall I generate the commit message in English (standard) or keep it in Chinese?" * *Context Awareness*: Check `git log` briefly. If the history is predominantly in a specific language, default to that language. #### Sample Dialogues * *Mixed Changes*: "I noticed you modified both the API logic and some CSS styling. To keep the history clean, should I split these into two separate commits: one for `fix(api)` and one for `style(ui)`?" * *Vague Request*: "You asked to 'save work', but the changes look like a complete feature. Shall I commit this as `feat(user): add profile page`?" --- ## 2. Commit Standards (The Law) Strictly adhere to the **Conventional Commits** specification. ### Format ```text ():