--- name: git-commit 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. 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` MUST remain in English. - **Subject/Body**: - **Instruction**: ALWAYS write the `subject` and `body` in **Chinese**. - **Tone**: Professional, direct, and concise. #### 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 ():