agentleFS
randommoniclerandommonicle/claude-skills/confirm-before-push/SKILL.md

confirm-before-push

Skill27 starsChanged 18 days agoApache-2.0View on GitHub

Always ask explicitly before pushing to a remote or fast-forwarding a protected branch. Per-action authorisation, not standing approval. Triggers on any git push, merge, or branch fast-forward operation, regardless of whether previous pushes in the same session were approved.

  • Commits and pushes

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always ask before pushing to a remote, merging to a protected branch, or fast-forwarding a protected branch.

    line 8
  2. Distinctive:

    After committing locally, summarise what's on the branch and ask before pushing.

    line 24
  3. Distinctive:

    Wait for explicit confirmation.

    line 29
  4. Very specific:

    Do not push with --force or rewrite published history without explicit per-action approval that names the force operation specifically.

    line 31
  5. Distinctive:

    When a multi-step push is authorised, the canonical sequence is:

    line 35
  6. Very specific:

    Verify the push landed (check git log --oneline <remote>/<branch>)

    line 38
  7. Distinctive:

    If a protected branch fast-forward is part of the authorisation, perform it as a separate step

    line 39
  8. Very specific:

    Verify the protected branch tip with git log --oneline <remote>/<protected-branch>

    line 40
  9. Distinctive:

    If any step fails, stop and report rather than continuing to the next.

    line 42

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Confirm before push or merge

Always ask before pushing to a remote, merging to a protected branch, or fast-forwarding a protected branch. Each action needs its own explicit authorisation. Past approvals in the same session do not extend to future ones.

When this applies

This skill fires on:

  • Any git push to a remote
  • Any git merge into main, master, or another protected branch
  • Any fast-forward of a protected branch (git push origin HEAD:main)
  • Any history-rewriting push (--force, --force-with-lease)
  • Any merge or rebase that lands work on a protected branch

This skill applies even when the project's convention is direct-to-main solo shipping. The convention defines where work lands; this skill defines the per-action authorisation gate before it lands.

How to apply

After committing locally, summarise what's on the branch and ask before pushing. Examples:

  • "Committed locally as <sha> <message>. Three files, plus one migration. Ready to push to origin?"
  • "Worktree branch has two commits ahead of main. Push the branch first, then fast-forward main?"

Wait for explicit confirmation. Words like "yes", "push it", "go ahead", "proceed" are clear authorisations. Ambiguous responses ("looks good", "nice") are not.

Do not push with --force or rewrite published history without explicit per-action approval that names the force operation specifically.

Standard push order

When a multi-step push is authorised, the canonical sequence is:

  1. Push the local working branch to its remote tracking branch
  2. Verify the push landed (check git log --oneline <remote>/<branch>)
  3. If a protected branch fast-forward is part of the authorisation, perform it as a separate step
  4. Verify the protected branch tip with git log --oneline <remote>/<protected-branch>

If any step fails, stop and report rather than continuing to the next.

What this skill does not do

Local commits do not require this gate. Commit freely; the gate is on the moment work leaves the machine or lands on a protected branch.

Branch creation, worktree setup, and similar local operations are not push events and do not trigger this skill.

Why

Pushing is visible to others and hard to reverse. CI runs, deploy webhooks, and anyone watching the repository all consume pushes the moment they land. Even on a solo direct-to-main project, every push is the moment a commit becomes off-machine durable and shared. Per-action authorisation prevents the case where standing approval from earlier in a session is used to push work the user has not yet reviewed.

Remote branch deletion (added 2026-07-23)

The gate extends to deleting any remote branch, including --delete-branch on a merge. Deleting a branch an open PR points at closes the PR unrecoverably (a fresh PR gets a new number; one deletion left the work's only surviving copy in a local object store). Before any branch delete, run the mechanical preflight:

gh pr list --head <branch> --state all
gh pr list --base <branch>
git log main..<branch>

In a squash-merge repo, "merged" is a PR fact, never an ancestry fact — git branch --merged lies in both directions. Judge a stale branch by the diff it would apply to main today. Redundancy means content-on-main AND no open PR — never a name or someone's say-so.

Merge mechanics (added 2026-07-23)

  • Diff a branch with git diff $(git merge-base main branch) branch, not main..branch — the symmetric diff misleads for branches forked before a main-side hotfix. After merging onto a hotfixed base, grep the queries the branch introduced (see blast-radius-grep).
  • gh pr merge from a worktree can error on the local step while the remote merge succeeded: verify the real outcome with gh pr view --json state,mergedAt and sync main separately with git -C.

Enforcement note: the push-gate hook (hooks/push-gate.mjs) mechanises this gate by forcing the permission prompt on pushes, PR merges, and remote ref deletion. The hook is the control; this skill is the policy and the preflight.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.