Commit Push
Purpose
Take the current repository state and turn it into a clean end-of-task git result:
- one or more logical commits
- good commit messages
- one final push if requested
This is an end-of-task workflow for local repository changes that are already implemented.
Use when
Use this skill when the user wants any of the following:
- commit current work
- split the diff into logical commits
- write proper commit messages
- commit and push
- just push, when local changes may still need to be committed first
Typical trigger phrases:
- "закоммить"
- "разбей на коммиты"
- "сделай нормальные commit messages"
- "запушь"
- "коммит+пуш"
- "commit"
- "push"
- "commit and push"
Do not use when
Do not use this skill for:
- rebase / interactive rebase
- merge conflict resolution
- cherry-pick
- revert
- stash workflows
- release tagging / version bump releases
- PR title or PR description writing
- history rewriting of existing commits unless the user explicitly asks
If the user asks for any of the above, handle that directly instead of using this skill.
Inputs
Expected inputs:
- current git repository
- local working tree and index state
- the user's intent:
- commit only
- push only
- commit and push
Optional inputs:
- repository commit message convention
- branch policy from project docs
AGENTS.md repo conventions
Outputs
Always produce:
- a short commit plan
- the actual commits created, with SHAs and messages
- push result, if push was requested
- any skipped files or blocked actions
Constraints
- Read the nearest repo-local
AGENTS.md, README, or workflow docs before changing history behavior.
- Use non-interactive git commands by default.
- Stage precisely; do not sweep unrelated dirty files into a commit.
- Respect existing user changes and do not rewrite history unless explicitly requested.
- Prefer exact staging by file or hunk over blunt "add everything" flows.
- If push target is ambiguous or high-risk, stop and report instead of guessing.
Procedure
Inspect repository state first.
Run the narrowest commands needed to understand the current state, typically:
git status --short --branch
git diff --stat
git diff
git diff --cached
git log --oneline -n 20
Infer the commit message convention.
- Look at recent commit messages.
- If the repo clearly uses a convention such as Conventional Commits, follow it.
- Otherwise use concise, precise, imperative commit subjects.
- Prefer messages that describe the actual behavior or code change, not vague phrases like "fix stuff".
Build a commit slicing plan before staging.
Split the changes into the smallest reasonable set of coherent commits.
A good commit should represent one logical unit, for example:
- one bug fix
- one refactor
- one feature slice
- one test addition tied to the same behavior change
Follow these slicing rules.
- Keep tests with the behavior change they validate.
- Keep docs with the code change only when the docs directly describe that same change.
- Do not create micro-commits with no independent value.
- Do not mix unrelated changes into one commit just because they touch nearby files.
- If unrelated dirty files exist, leave them out unless the user clearly asked to include everything.
Stage precisely.
- Prefer exact staging by file or hunk.
- Use patch-based staging when needed.
- Verify the staged diff before every commit.
Create commits one by one.
For each logical group:
- stage only the intended hunks/files
- verify staged diff
- write a strong commit message
- commit
- continue until the plan is complete
Handle push based on user intent.
- If the user asked only to commit, stop after commits are created.
- If the user asked to push, push once at the end, not after every commit.
- If the working tree is already clean and the branch is ahead, just push.
- If there is nothing to commit and nothing to push, report a no-op.
Push safety rules.
- Prefer pushing the currently checked out branch.
- If upstream is configured, use the normal push flow.
- If upstream is missing and there is exactly one obvious remote/branch target, set upstream and push.
- If the target is ambiguous, stop and report the exact command that should be run next.
- Do not push directly to protected or high-risk branches such as
main, master, release, or prod
unless the user explicitly asked for that branch.
Verification before finishing.
Before finalizing, check:
- working tree state after commits
- branch ahead/behind status
- created commit list
- push result, if requested
Decision rules
If the user says only "push"
Interpret this as:
- if there are uncommitted local changes, first organize them into logical commits, then push
- if the tree is clean and local commits are ahead, push
- if nothing needs pushing, report that clearly
If there are multiple plausible ways to split the diff
Choose the cleanest minimal plan that preserves semantic coherence.
Bias toward fewer strong commits over many weak commits.
If tests are available
Run the narrowest relevant tests when cheap and obvious.
If tests are not run, say that explicitly in the final report.
Definition of done
- The repository state was inspected before staging.
- The commit slicing plan is coherent and reflects the actual diff.
- Created commits have clear messages and are semantically grouped.
- Push was performed once at the end if requested, or clearly skipped/blocked.
- The final report includes SHAs, messages, push result, and any skipped files or blocked actions.
Final response format
Return a compact summary in this structure:
- Intent: commit / commit+push / push
- Commit plan:
- commit 1: ...
- commit 2: ...
- Created commits:
<sha> — <message>
<sha> — <message>
- Push:
- pushed / not requested / blocked / no-op
- Notes:
- skipped files
- ambiguity handled
- tests run or not run
Positive examples
Use this skill for prompts like:
- "Закоммить изменения"
- "Разбей это на логичные коммиты"
- "Сделай нормальные commit messages и запушь"
- "Commit and push this branch"
- "Подготовь коммиты и потом push"
Negative examples
Do not use this skill for prompts like:
- "Сделай rebase на origin/main"
- "Resolve merge conflicts"
- "Откати последний коммит"
- "Сделай cherry-pick этого коммита"
- "Напиши PR description"
1---2name: commit-push3description: Finalize local git changes into one or more logical commits and optionally push the current branch. Trigger when the user asks to commit, split changes into commits, prepare commit messages, push, or commit+push, including phrases like "закоммить", "закомить", "разбей на коммиты", "сделай коммиты", "подготовь коммиты", "запушь", "коммит+пуш", "commit", "push", "commit and push", or similar. Inspect the working tree, split changes into coherent commit groups, follow the repository's existing commit message style, create the commits, and push once at the end if the user asked to push. Do not use for rebase, merge conflict resolution, revert, cherry-pick, stash management, release tagging, branch renaming, or PR writing.4---56# Commit Push78## Purpose910Take the current repository state and turn it into a clean end-of-task git result:11- one or more logical commits12- good commit messages13- one final push if requested1415This is an end-of-task workflow for local repository changes that are already implemented.1617## Use when1819Use this skill when the user wants any of the following:20- commit current work21- split the diff into logical commits22- write proper commit messages23- commit and push24- just push, when local changes may still need to be committed first2526Typical trigger phrases:27- "закоммить"28- "разбей на коммиты"29- "сделай нормальные commit messages"30- "запушь"31- "коммит+пуш"32- "commit"33- "push"34- "commit and push"3536## Do not use when3738Do not use this skill for:39- rebase / interactive rebase40- merge conflict resolution41- cherry-pick42- revert43- stash workflows44- release tagging / version bump releases45- PR title or PR description writing46- history rewriting of existing commits unless the user explicitly asks4748If the user asks for any of the above, handle that directly instead of using this skill.4950## Inputs5152Expected inputs:53- current git repository54- local working tree and index state55- the user's intent:56 - commit only57 - push only58 - commit and push5960Optional inputs:61- repository commit message convention62- branch policy from project docs63- `AGENTS.md` repo conventions6465## Outputs6667Always produce:681. a short commit plan692. the actual commits created, with SHAs and messages703. push result, if push was requested714. any skipped files or blocked actions7273## Constraints7475- Read the nearest repo-local `AGENTS.md`, `README`, or workflow docs before changing history behavior.76- Use non-interactive git commands by default.77- Stage precisely; do not sweep unrelated dirty files into a commit.78- Respect existing user changes and do not rewrite history unless explicitly requested.79- Prefer exact staging by file or hunk over blunt "add everything" flows.80- If push target is ambiguous or high-risk, stop and report instead of guessing.8182## Procedure83841. Inspect repository state first.85 Run the narrowest commands needed to understand the current state, typically:86 - `git status --short --branch`87 - `git diff --stat`88 - `git diff`89 - `git diff --cached`90 - `git log --oneline -n 20`91922. Infer the commit message convention.93 - Look at recent commit messages.94 - If the repo clearly uses a convention such as Conventional Commits, follow it.95 - Otherwise use concise, precise, imperative commit subjects.96 - Prefer messages that describe the actual behavior or code change, not vague phrases like "fix stuff".97983. Build a commit slicing plan before staging.99 Split the changes into the smallest reasonable set of coherent commits.100 A good commit should represent one logical unit, for example:101 - one bug fix102 - one refactor103 - one feature slice104 - one test addition tied to the same behavior change1051064. Follow these slicing rules.107 - Keep tests with the behavior change they validate.108 - Keep docs with the code change only when the docs directly describe that same change.109 - Do not create micro-commits with no independent value.110 - Do not mix unrelated changes into one commit just because they touch nearby files.111 - If unrelated dirty files exist, leave them out unless the user clearly asked to include everything.1121135. Stage precisely.114 - Prefer exact staging by file or hunk.115 - Use patch-based staging when needed.116 - Verify the staged diff before every commit.1171186. Create commits one by one.119 For each logical group:120 - stage only the intended hunks/files121 - verify staged diff122 - write a strong commit message123 - commit124 - continue until the plan is complete1251267. Handle push based on user intent.127 - If the user asked only to commit, stop after commits are created.128 - If the user asked to push, push once at the end, not after every commit.129 - If the working tree is already clean and the branch is ahead, just push.130 - If there is nothing to commit and nothing to push, report a no-op.1311328. Push safety rules.133 - Prefer pushing the currently checked out branch.134 - If upstream is configured, use the normal push flow.135 - If upstream is missing and there is exactly one obvious remote/branch target, set upstream and push.136 - If the target is ambiguous, stop and report the exact command that should be run next.137 - Do not push directly to protected or high-risk branches such as `main`, `master`, `release`, or `prod`138 unless the user explicitly asked for that branch.1391409. Verification before finishing.141 Before finalizing, check:142 - working tree state after commits143 - branch ahead/behind status144 - created commit list145 - push result, if requested146147## Decision rules148149### If the user says only "push"150151Interpret this as:152- if there are uncommitted local changes, first organize them into logical commits, then push153- if the tree is clean and local commits are ahead, push154- if nothing needs pushing, report that clearly155156### If there are multiple plausible ways to split the diff157158Choose the cleanest minimal plan that preserves semantic coherence.159Bias toward fewer strong commits over many weak commits.160161### If tests are available162163Run the narrowest relevant tests when cheap and obvious.164If tests are not run, say that explicitly in the final report.165166## Definition of done167168- The repository state was inspected before staging.169- The commit slicing plan is coherent and reflects the actual diff.170- Created commits have clear messages and are semantically grouped.171- Push was performed once at the end if requested, or clearly skipped/blocked.172- The final report includes SHAs, messages, push result, and any skipped files or blocked actions.173174## Final response format175176Return a compact summary in this structure:177178- Intent: commit / commit+push / push179- Commit plan:180 - commit 1: ...181 - commit 2: ...182- Created commits:183 - `<sha>` — `<message>`184 - `<sha>` — `<message>`185- Push:186 - pushed / not requested / blocked / no-op187- Notes:188 - skipped files189 - ambiguity handled190 - tests run or not run191192## Positive examples193194Use this skill for prompts like:195- "Закоммить изменения"196- "Разбей это на логичные коммиты"197- "Сделай нормальные commit messages и запушь"198- "Commit and push this branch"199- "Подготовь коммиты и потом push"200201## Negative examples202203Do not use this skill for prompts like:204- "Сделай rebase на origin/main"205- "Resolve merge conflicts"206- "Откати последний коммит"207- "Сделай cherry-pick этого коммита"208- "Напиши PR description"