agentleFS
mauroepcemauroepce/claude-workspace/skills/safe-push/SKILL.md

safe-push

Skill1 starsChanged 3 months agoMITView on GitHub

Pre-push safety net. Runs full-branch security review, executes tests if available, summarizes what's about to land remote, and pushes only after explicit user confirmation. Refuses to push to main/master without an extra confirmation.

  • Commits and pushes

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. JetBrains/intellij-community★ 21ksame name
    2. DetachHead/rebased★ 6.5ksame 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 repository17 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. About 0 are common, 13 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    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
  1. Distinctive:

    If there are 0 commits to push, tell the user: "Branch is up to date with upstream.

    line 33
  2. Distinctive:

    If the current branch is main or master, ask explicitly:

    line 37
  3. Distinctive:

    If user says yes, proceed but note: "Pushing to main without PR — logged for awareness."

    line 41
  4. Very specific:

    If they say no, stop and suggest: "Create a feature branch with git checkout -b feat/<name> and re-stage from there."

    line 43
  5. Very specific:

    Use the built-in security-review skill against the full diff of the branch (vs upstream).

    line 49
  6. Distinctive:

    Test files that were modified — were they made to pass artificially?

    line 54
  7. Very specific:

    If a test script exists, ask: "Run tests before push?

    line 71
  8. Distinctive:

    If user says yes, run:

    line 73
  9. Distinctive:

    If tests fail, stop and surface failures.

    line 79
  10. Distinctive:

    If user says skip, log: "Tests skipped at user request."

    line 81
  11. Distinctive:

    Ask: "Proceed with push? (yes/no)"

    line 98
  12. Distinctive:

    Don't push to main/master without the explicit confirmation in Phase 2.

    line 121
  13. Very specific:

    Don't bypass hooks (--no-verify) or force-push (--force, -f) unless explicitly authorized.

    line 122
  14. Distinctive:

    Don't push if tests failed and the user didn't explicitly accept that risk.

    line 123
  15. Distinctive:

    Don't push if security blockers exist.

    line 124
  16. Distinctive:

    Don't open the PR. That's a separate, explicit action.

    line 125
  17. Distinctive:

    Don't auto-merge. Ever.

    line 126

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

/safe-push — Reviewed push

You are Claude. The user is about to push commits to a remote. Your job is to make sure nothing dangerous goes out.

Phase 1 — Inspect what's about to be pushed

Run, in order:

git rev-parse --abbrev-ref HEAD       # current branch
git rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo "no upstream"
git log --oneline @{upstream}..HEAD 2>/dev/null || git log --oneline -10
git diff --stat @{upstream}..HEAD 2>/dev/null

Present:

BRANCH: <current branch>
UPSTREAM: <upstream branch or "none">
COMMITS TO PUSH: <count>

<list commits>

DIFF STAT:
<file change summary>

If there are 0 commits to push, tell the user: "Branch is up to date with upstream. Nothing to push." Stop.

Phase 2 — Branch protection check

If the current branch is main or master, ask explicitly:

"⚠️ You're about to push directly to <branch>. This bypasses PR review. Are you sure? (yes/no)"

If user says yes, proceed but note: "Pushing to main without PR — logged for awareness."

If they say no, stop and suggest: "Create a feature branch with git checkout -b feat/<name> and re-stage from there."

For any other branch, proceed.

Phase 3 — Full-branch security review

Use the built-in security-review skill against the full diff of the branch (vs upstream). Same checklist as /safe-commit but over ALL commits being pushed, not just the most recent.

Pay extra attention to:

  • Files staged then removed across commits — sometimes secrets leak then "deleted" but remain in history
  • Test files that were modified — were they made to pass artificially?
  • Migration files — are they reversible?
  • Config files (vercel.json, next.config.ts, env vars in workflows)

Present findings in same format as /safe-commit. Same rule: blockers stop the push.

Phase 4 — Tests (if available)

Detect the test setup:

# Check package.json for a test script
jq -r '.scripts.test // empty' package.json 2>/dev/null
# Check for common test runners
ls -la jest.config* vitest.config* playwright.config* 2>/dev/null

If a test script exists, ask: "Run tests before push? (recommended, but slow if it's E2E)"

If user says yes, run:

npm test  # or whatever the script is

If tests fail, stop and surface failures. Don't push failing tests.

If user says skip, log: "Tests skipped at user request."

Phase 5 — Summary

Output:

READY TO PUSH
Branch: <branch> → <upstream>
Commits: <count>
Files changed: <count>
Security review: <pass/warnings/blockers>
Tests: <passed/skipped/failed>

Will run: git push <remote> <branch>

Ask: "Proceed with push? (yes/no)"

If yes:

git push origin "$(git rev-parse --abbrev-ref HEAD)"

Never use --force or --no-verify unless the user explicitly requested it AND you've warned them about the consequences.

Phase 6 — Confirmation

After push succeeds:

git rev-parse HEAD
git log --oneline -3

Tell the user the commit landed remote. If the project has a CI integration (.github/workflows/), remind them: "CI will pick this up shortly — watch for Vercel/Actions/etc."

What NOT to do

  • Don't push to main/master without the explicit confirmation in Phase 2.
  • Don't bypass hooks (--no-verify) or force-push (--force, -f) unless explicitly authorized.
  • Don't push if tests failed and the user didn't explicitly accept that risk.
  • Don't push if security blockers exist.
  • Don't open the PR. That's a separate, explicit action.
  • Don't auto-merge. Ever.

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.