clean-merge-push
Skill4 starsChanged 6 months agoMITView on GitHub
Use when the user asks to run owner-clean on your work, commit the bounded work, merge develop or the current branch into main/master, run pnpm verify or the repository's release gate, push main/master plus develop/current branch to remote, and end back on develop when available. Applies across software repositories. Requires a clean worktree after the owned commit before branch switching, merging, verifying release, or pushing. Keeps unrelated work out of the commit, prefers fast-forward merges, allows normal merge commits when the repo's branch history requires them, verifies before/after commit, and reports exact branch/push state.
- Commits and pushes
In this repository10 other files it gives its agents.
- clean-commitSkill
- cleanSkill
- evolutionary-5-stepSkill
- investigate-fixSkill
- owner-checkSkill
- owner-cleanSkill
- stateful-planning-protocolSkill
- technical-design-dossierSkill
- tty-designSkill
- writing-ticksSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
44 rules. About 0 are common, 30 are distinctive, and 14 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈30
Distinctive · estimate
This author's own choices. Worth a look.
14
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 10
Run an owner-clean finishing pass, turn a bounded local software change into an intentional commit, carry it through the repository's …
- Very specific: line 15
Start from the completed work, not a whole-tree cleanup.
- Distinctive: line 16
After the owned commit, require a clean worktree before continuing.
- Distinctive: line 19
Do not rebase, force-push, reset, checkout files, or delete changes without explicit user approval.
- Distinctive: line 20
Verify the smallest meaningful test lane first, then broaden when the change touches shared contracts or the user asks for a full gate.
- Distinctive: line 21
Treat toolchain drift separately from the commit slice.
- Distinctive: line 31
If available, run the project or user clean-commit inspector.
- Distinctive: line 33
Run the owner-clean pass:
- Very specific: line 34
If $owner-clean is installed, read and follow it for one bounded pass over the current work before staging.
- Distinctive: line 36
Treat cleanup edits as part of the owned commit slice.
- Very specific: line 37
If $owner-clean is unavailable or ownership is irrelevant, state that as an assumption and continue without inventing a replacement …
- Very specific: line 43
If develop exists and the source branch is not develop, merge source into develop first.
- Distinctive: line 44
If both main and master exist and the target is ambiguous, inspect upstream/default branch evidence before choosing.
- Distinctive: line 49
If staged changes already exist before this workflow, stop and ask how to handle them.
- Distinctive: line 51
Leave unrelated untracked files alone.
- Distinctive: line 54
Run focused tests for touched code.
- Very specific: line 55
Run typecheck/build/lint when the project treats them as correctness gates or the change crosses shared boundaries.
- Distinctive: line 56
Run git diff --check before staging or git diff --cached --check after staging.
- Distinctive: line 57
If a needed command is blocked by sandbox permissions, rerun with escalation rather than silently skipping it.
- Distinctive: line 60
Use Conventional Commits when the repo does not specify another format.
- Distinctive: line 61
Keep the subject under 72 characters where practical.
- Very specific: line 62
Write non-trivial messages to a temporary file and commit with git commit -F <file>.
- Very specific: line 63
Verify the commit with git show --stat --summary --format=fuller -1.
- Distinctive: line 64
Run git status --short immediately after committing.
- Distinctive: line 67
Before every branch switch, merge, release verification, and push, confirm git status --short is empty.
- Distinctive: line 69
Check every branch that will be touched against its upstream before merging:
- Very specific: line 73
If any touched branch cannot fast-forward from upstream, stop and report the divergence.
- Distinctive: line 74
Ensure the source branch contains the intended commit after the upstream check.
- Very specific: line 75
If develop exists and source is not develop, switch to develop after syncing it from upstream and fast-forward only: git merge --ff-only …
- Distinctive: line 76
Only after the integration branch contains the commit, switch to the release branch after syncing it from upstream: git switch main or git …
- Distinctive: line 78
If the commit was created directly on the release branch, switch back to the source/integration branch and fast-forward it from the release …
- Distinctive: line 80
Verify the release branch:
- Distinctive: line 81
After switching to main or master and merging the intended source/integration branch, run the repository's release gate before pushing.
- Very specific: line 82
If the user specifically asked for pnpm verify and the repository has pnpm metadata, run pnpm verify.
- Very specific: line 83
If pnpm verify is absent, run the closest documented verification command and report the substitution as an assumption.
- Distinctive: line 84
If verification fails because of the current work, switch back to the owning branch when needed, fix the owned slice, recommit, repeat the …
- Distinctive: line 85
If verification fails for unrelated or pre-existing reasons, stop before pushing release branches and report the exact blocker.
- Distinctive: line 89
If an integration branch exists: git push origin develop
- Very specific: line 90
Always attempt the release push after the integration branch is updated: git push origin <release-branch>.
- Distinctive: line 91
If a hook blocks the release push, do not retry or bypass.
- Very specific: line 95
If develop exists, end by switching back to it: git switch develop.
- Very specific: line 96
If there is no develop, switch back to the original source branch.
- Distinctive: line 97
If switching back is blocked by local changes or hooks, report the exact blocker and the branch you are still on.
- Distinctive: line 107
Commit hash and subject.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Clean Merge Push
Goal
Run an owner-clean finishing pass, turn a bounded local software change into an intentional commit, carry it through the repository's established integration path, verify the release branch, and push the branches that policy allows.
Principles
- Preserve unrelated user work. Never stage unrequested files, generated churn, local lockfiles, logs, or editor metadata unless they are part of the requested change.
- Start from the completed work, not a whole-tree cleanup. Use
$owner-cleanfirst when available, then commit only the owned slice. - After the owned commit, require a clean worktree before continuing. Do not switch branches, merge, run the release verification gate, or push while
git status --shortshows staged, unstaged, or untracked entries. - Prefer fast-forward merges when the branch graph allows them. Normal merge commits are allowed for integration or release branch merges when the repository's existing branch history requires them, or when the user explicitly approves them. Never use merge commits to paper over unrelated dirty work, stale upstream refs, or unresolved branch divergence.
- Honor the repository's branch flow before generic defaults. If the repo uses
develop, the normal path isfeature -> develop -> main/master; never skip directly from feature tomainormasterunless the user explicitly asks. - Do not rebase, force-push, reset, checkout files, or delete changes without explicit user approval.
- Verify the smallest meaningful test lane first, then broaden when the change touches shared contracts or the user asks for a full gate.
- Treat toolchain drift separately from the commit slice. Report stale global tools or pre-existing lint failures without mixing broad cleanup into the commit.
Workflow
- Inspect the repository:
git status --short --branchgit log --oneline --decorate -5git remote -vgit branch --show-currentgit branch --list main master develop- If available, run the project or user clean-commit inspector.
- Run the owner-clean pass:
- If
$owner-cleanis installed, read and follow it for one bounded pass over the current work before staging. - Record the owner decision, any cleanup performed, and any unrelated changes intentionally left alone.
- Treat cleanup edits as part of the owned commit slice. Do not continue to branch synchronization or merging until those edits are committed.
- If
$owner-cleanis unavailable or ownership is irrelevant, state that as an assumption and continue without inventing a replacement workflow.
- If
- Identify the source, integration, and release branches:
- Source branch is usually the current branch.
- Integration branch is
developwhen it exists, unless repo evidence clearly says otherwise. - Release branch is
mainif it exists, otherwisemaster. - If
developexists and the source branch is notdevelop, merge source intodevelopfirst. Only afterdevelopcontains the source commit may you mergedevelopintomainormaster. - If both
mainandmasterexist and the target is ambiguous, inspect upstream/default branch evidence before choosing. Ask only if evidence is unclear. - The intended endpoint is a pushed release branch. After the source has reached
developwhen applicable, mergedevelopintomainormasterand attempt to push the release branch. If hooks or branch protection block that push, report the exact blocker and the required manual/PR step. Do not bypass the hook.
- Bound the commit slice:
- Review unstaged, staged, and untracked files.
- If staged changes already exist before this workflow, stop and ask how to handle them.
- Stage only intended paths with
git add -- <paths>. - Leave unrelated untracked files alone.
- Verify before committing:
- Run focused tests for touched code.
- Run typecheck/build/lint when the project treats them as correctness gates or the change crosses shared boundaries.
- Run
git diff --checkbefore staging orgit diff --cached --checkafter staging. - If a needed command is blocked by sandbox permissions, rerun with escalation rather than silently skipping it.
- Commit:
- Use Conventional Commits when the repo does not specify another format.
- Keep the subject under 72 characters where practical.
- Write non-trivial messages to a temporary file and commit with
git commit -F <file>. - Verify the commit with
git show --stat --summary --format=fuller -1. - Run
git status --shortimmediately after committing. If anything remains, stop before branch switching or merging. Commit owned residue when it belongs to the current work; otherwise report the unrelated dirty state and ask before continuing.
- Sync and merge:
- Before every branch switch, merge, release verification, and push, confirm
git status --shortis empty. Stop on any staged, unstaged, or untracked entry; do not stash, discard, or sweep it into the commit without explicit approval. - Fetch the remote before merging:
git fetch origin. If fetch is unavailable, stop before touching integration/release branches unless the user explicitly accepts stale remote knowledge. - Check every branch that will be touched against its upstream before merging:
- Source: if
origin/<source-branch>exists and local source is behind or diverged, fast-forward/pull only when clean and safe; never rebase or force. - Integration: before merging into
develop, switch todevelopand fast-forward fromorigin/developfirst:git merge --ff-only origin/develop. - Release: before merging into
mainormaster, switch to the release branch and fast-forward fromorigin/<release-branch>first:git merge --ff-only origin/<release-branch>.
- Source: if
- If any touched branch cannot fast-forward from upstream, stop and report the divergence; do not publish until the user chooses a merge/rebase/PR strategy.
- Ensure the source branch contains the intended commit after the upstream check.
- If
developexists and source is notdevelop, switch todevelopafter syncing it from upstream and fast-forward only:git merge --ff-only <source-branch>. - Only after the integration branch contains the commit, switch to the release branch after syncing it from upstream:
git switch mainorgit switch master. - Merge from the integration branch when it exists: first try
git merge --ff-only develop; if that fails because the release branch already has prior integration merge commits and the user has approved normal merge commits, use a regulargit merge develop. If there is no integration branch, apply the same rule to the source branch. - If the commit was created directly on the release branch, switch back to the source/integration branch and fast-forward it from the release branch when the user asked to push both.
- Before every branch switch, merge, release verification, and push, confirm
- Verify the release branch:
- After switching to
mainormasterand merging the intended source/integration branch, run the repository's release gate before pushing. - If the user specifically asked for
pnpm verifyand the repository has pnpm metadata, runpnpm verify. - If
pnpm verifyis absent, run the closest documented verification command and report the substitution as an assumption. - If verification fails because of the current work, switch back to the owning branch when needed, fix the owned slice, recommit, repeat the integration path, and rerun verification.
- If verification fails for unrelated or pre-existing reasons, stop before pushing release branches and report the exact blocker.
- After switching to
- Push branches in policy order:
git push origin <source-branch>- If an integration branch exists:
git push origin develop - Always attempt the release push after the integration branch is updated:
git push origin <release-branch>. - If a hook blocks the release push, do not retry or bypass; report the exact hook message and the PR/manual step needed.
- Confirm with
git rev-parse HEAD <source-branch> <integration-branch-if-any> <release-branch> origin/<source-branch> origin/<integration-branch-if-any> origin/<release-branch>.
- Return to the working branch:
- If
developexists, end by switching back to it:git switch develop. - If there is no
develop, switch back to the original source branch. - If switching back is blocked by local changes or hooks, report the exact blocker and the branch you are still on.
- Final status:
- Run
git status --short --branch. - Report any remaining untracked or unstaged files separately from the published work.
Reporting
Include:
- Commit hash and subject.
- Source, integration, and release branch state. Say explicitly whether the release branch was pushed, blocked, or needs PR/manual approval.
- Verification commands that passed.
- Checks that could not run and exact reason.
- Remaining local changes or untracked files.
- Current checked-out branch.
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.

