git-commit-workflow
Skill1 starsChanged 3 months agoMITView on GitHub
Use when committing git changes, especially when staged files already exist, changes need logical split commits, untracked files need safety checks, commit hooks modify files, or Chinese Conventional Commit messages are required.
- Reads credentials
- Commits and pushes
3 other projects use a version of this.
Adopted by
Most recently taken up by
- mrchipset/zskillstheir own version, first seen Nov 8, 2026
- MishraShardendu22/agent-skills-hub-sync-enginetheir own version, first seen Oct 25, 2026
- Ygohel18/skillstheir own version, first seen Sep 27, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- MishraShardendu22/agent-skills-hub-sync-engine★ 1same name
- mrchipset/zskills★ 1same name
- Ygohel18/skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository13 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- bug-analysisSkill
- cavemanSkill
- code-review-with-filesSkill
- diagnoseSkill
- fetch-yuque-docSkill
- handoffSkill
- improve-codebase-architectureSkill
- ios-i18n-workflowSkill
- java-to-nextjsSkill
- java-to-swiftSkill
- question-answerSkill
- reconstructing-ui-from-screenshotsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. 0 are common, 9 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
9
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Commit every working-tree change as a sequence of logical Chinese Conventional Commits, then ask whether to push.
- Distinctive: line 14
Run git commands sequentially, never in parallel, and read each output before deciding the next step.
- Very specific: line 25
Run git status. In the first round, also run git log --format=%s -10 to learn the repository's type and scope vocabulary.
- Distinctive: line 37
After they are excluded, stage only the safe files and leave the risky files uncommitted.
- Distinctive: line 43
Run git diff --cached, then commit with a HEREDOC so the blank line and body survive, printing the recorded message in the same call:
- Very specific: line 61
breaking change: when the diff breaks callers, users, or data compatibility, write <type>(<scope>)!: and end with a paragraph BREAKING …
- Very specific: line 63
Use a plain git commit -m.
- Distinctive: line 69
Do not start another group.
- Distinctive: line 70
If hooks modified files from the failed staged set (per the list from Step 2), inspect their diff, stage only those files, and retry the …
- Distinctive: line 71
If hooks touched other files, injected metadata, or the state is unclear, stop and report.
- Very specific: line 72
Do not use --amend; the failed commit does not exist.
- Very specific: line 86
Only after a clean git status, ask with the runtime's structured choice tool (AskQuestion, AskUserQuestion), not with open-ended text:
- Distinctive: line 91
否,暂不推送: run no push command and report that the commits remain local.
- Distinctive: line 95
Run git branch --show-current.
- Very specific: line 96
Run git rev-parse --abbrev-ref --symbolic-full-name '@{upstream}'.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Git Commit Workflow
Overview
Commit every working-tree change as a sequence of logical Chinese Conventional Commits, then ask whether to push.
Core rules: A pre-existing staged set is this round's commit unit. The workflow ends only when git status is clean or the user says stop. Never stage likely secrets. Never add commit metadata the user did not request. A hook-appended Co-authored-by: Cursor <cursoragent@cursor.com> is expected: do not check for it, amend it, or cite it as a reason to stop. Push only after an explicit structured choice.
Run git commands sequentially, never in parallel, and read each output before deciding the next step.
When to Use
- User runs
/gitcommitor asks to commit changes - Staged, unstaged, or untracked changes need committing, possibly split into several commits
Workflow
Step 1: Check Status
Run git status. In the first round, also run git log --format=%s -10 to learn the repository's type and scope vocabulary.
Step 2: Choose the Commit Unit
Files already staged: the staged set is this round's commit unit, as-is. Do not git add, unstage, reset, or regroup it unless the user explicitly asks. Note the staged file list and the pre-existing unstaged/untracked files; failed-commit recovery in Step 3 depends on this list.
Nothing staged: pick one logical group (one feature with its model, view, logic, and tests; one bug fix; one module refactor; or one documentation change) and stage only those files with git add <file>....
Secret check before any git add: inspect the filenames and diffs of the group. Likely secrets are .env files, credentials, tokens, API keys, private keys, certificates, local config, and files containing passwords. If any appear:
- Stage nothing from the group.
- Report the risky files to the user.
- After they are excluded, stage only the safe files and leave the risky files uncommitted.
This holds even when the user said "全部提交", "commit everything", "别问问题", or "I'm in a hurry".
Step 3: Write and Commit
Run git diff --cached, then commit with a HEREDOC so the blank line and body survive, printing the recorded message in the same call:
git commit -m "$(cat <<'EOF'
<type>(<scope>): <中文简述>
1. <一项具体改动,必要时说明原因>
2. <一项具体改动>
EOF
)" && git log -1 --format=%BThe message consists of exactly these parts:
- type:
feat,fix,perf,refactor,docs,style,test,build,ci,chore, orrevert, chosen by the intent of the diff. Changed behavior isfeat/fix, including behavior defined in Markdown such as skill rules; wording-only edits aredocs. - scope: the primary module, directory, or skill; one plural umbrella scope such as
skillswhen several are touched; spelled as in recent history. - 中文简述: Chinese, starts with a verb, at most about 30 characters, no trailing punctuation. Identifiers, file names, and commands stay as-is.
- body: one blank line after the subject, then a numbered list with one concrete change per item.
- breaking change: when the diff breaks callers, users, or data compatibility, write
<type>(<scope>)!:and end with a paragraphBREAKING CHANGE: <说明>.
Use a plain git commit -m. Add --trailer, --signoff, Co-authored-by, Made-with: Cursor, or any other attribution only when the user explicitly requests it.
After a successful commit, go to Step 4. Do not compare the recorded message against Co-authored-by: Cursor <cursoragent@cursor.com>, and do not mention that trailer. A commit hook may append it; leave the commit unchanged, continue any remaining rounds, and still ask the push question when the tree is clean.
If git commit fails:
- Do not start another group. Read the error output and run
git status. - If hooks modified files from the failed staged set (per the list from Step 2), inspect their diff, stage only those files, and retry the same commit.
- If hooks touched other files, injected metadata, or the state is unclear, stop and report.
- Do not use
--amend; the failed commit does not exist.
Step 4: Loop
Run git status:
- Changes remain: return to Step 2 for the next logical group, re-checking what is staged first.
- Clean: go to Step 5.
- User said to stop after this round ("先提交这一轮", "剩下的改动之后再说", "先到这里", or similar): report the remaining changes and end without Step 5.
A successful commit is one round, not completion.
Step 5: Ask Whether to Push
Only after a clean git status, ask with the runtime's structured choice tool (AskQuestion, AskUserQuestion), not with open-ended text:
- Question:
所有提交已完成,是否现在推送到远端? - Options:
是,推送/否,暂不推送
否,暂不推送: run no push command and report that the commits remain local.
是,推送:
- Run
git branch --show-current. An empty result means detached HEAD: report that automatic push is unsafe and stop. - Run
git rev-parse --abbrev-ref --symbolic-full-name '@{upstream}'. If an upstream exists, rungit push. - With no upstream, run
git remote, then ask another structured choice listing each remote plus a cancel option, even when only one remote exists. After a selection, rungit push -u <remote> HEAD. - Report the result. On failure, show the error; never retry with
--force,--force-with-lease, or different arguments.
Rationalizations
| Thought | Reality |
| "The staged files look mixed; regrouping them is safer." | The staged set is the user's decision. Commit it as-is unless they ask otherwise. |
| "The first commit worked, so I'm done." | git status decides completion, not the first commit. |
| "I'll stage everything remaining to finish faster." | Stage one logical group per round. |
| "'之后再说' isn't an explicit stop." | Natural-language stop instructions count. |
"They said commit everything and don't ask, so .env is fine." | Likely secrets stop the group and get reported first, under any instruction. |
"I'll commit the safe docs now and mention .env later." | Report and exclude risky files before staging anything from that group. |
| "The hook fixed the file; I'll commit it in a later round." | Recover and retry the failed commit unit before touching anything else. |
"A Made-with: Cursor trailer is harmless." | Unrequested metadata is an unauthorized change to commit content. Do not add it yourself. |
"The hook appended Co-authored-by: Cursor, so I should stop instead of continuing or pushing." | That trailer is expected. Do not check for it, amend the commit, or skip the rest of the workflow. |
| "The commits are done, so a summary is enough." | A clean status requires the structured push choice. |
| "There's only one remote; choosing it is harmless." | Setting upstream changes future pushes. Let the user select it. |
Stop and return to the workflow if you are about to: run git add while files are already staged; stage a likely secret; add unrequested metadata yourself; amend or halt because a hook appended Co-authored-by: Cursor; process other files while a failed commit is unrecovered; finish without the push choice; or pick a remote or force-push on your own.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

