agentleFS
birdsighbirdsigh/Skills/commit-and-push/SKILL.md

commit-and-push

Skill3 starsChanged 3 months agoMITView on GitHub

Safely review, verify, commit, and push intended repository changes to an established upstream branch, with sensitive-content gates. Use when the user invokes /commit-and-push, asks to commit and push current work, or requests publishing completed changes without creating a pull request.

  • Commits and pushes

12 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use skill-builder and frontend-design.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • BlockSkill

    skill-builder

    Create, edit, or inspect Berd skills stored as skill folders with SKILL.md files. Use when the user wants to build a new skill, update an existing skill, convert a workflow into a reusable skill, or decide whether instructions, scripts, references, or assets belong in a skill.

    Also in 3 projects that use this

  • BlockSkill

    frontend-design

    Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

    Also in 5 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

73 rules. 0 are common, 63 are distinctive, and 10 are very specific to this project.

  • 0

    Common

    Most of the 8 edited versions we read keep these.

  • 63

    Distinctive

    This author's own choices. Worth a look.

  • 10

    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:

    Read and follow all applicable repository instructions before acting.

    line 14
  2. Distinctive:

    Never assume every worktree change belongs to the current task.

    line 15
  3. Distinctive:

    Never discard, reset, restore, stash, overwrite, or otherwise alter unrelated changes.

    line 16
  4. Distinctive:

    Treat the existing index as user-owned state.

    line 17
  5. Very specific:

    Never bypass Git hooks or verification with --no-verify.

    line 18
  6. Distinctive:

    Never pull, merge, rebase, amend, reset, force-push, or retry a rejected push as part of this workflow.

    line 19
  7. Distinctive:

    Treat any in-progress merge, rebase, cherry-pick, or revert as an absolute stop.

    line 20
  8. Distinctive:

    Never infer or create an upstream branch.

    line 21
  9. Distinctive:

    Never expose secret values when describing files or failures.

    line 22
  10. Distinctive:

    Treat the original invocation as permission to prepare a commit, not permission to push.

    line 23
  11. Very specific:

    Use <skill-dir>/scripts/check-sensitive-content.py to block routable IP address literals, likely credentials or private keys, oversized …

    line 28
  12. Very specific:

    After reading repository instructions, run <skill-dir>/scripts/git-review.py gate as the first repository command.

    line 39
  13. Very specific:

    If operations reports a merge or rebase, or conflicts is non-empty, immediately:

    line 43
  14. Very specific:

    Do not inspect or edit conflicted files, suggest resolutions, fetch, stage, commit, run hooks, or invoke merge --continue, merge --abort, …

    line 50
  15. Distinctive:

    When no upstream is configured, report the current branch and available remote names without printing potentially credential-bearing URLs.

    line 58
  16. Very specific:

    After the gate passes, run <skill-dir>/scripts/check-sensitive-content.py --worktree.

    line 60
  17. Very specific:

    Run <skill-dir>/scripts/check-hooks.py.

    line 64
  18. Distinctive:

    Use its evidence with repository instructions, setup documentation, package scripts, and manager configuration to determine how hooks are …

    line 66
  19. Very specific:

    Treat only verified-active as confirmed active.

    line 68
  20. Distinctive:

    ask whether to continue.

    line 73
  21. Distinctive:

    Wait for explicit confirmation before continuing.

    line 75
  22. Distinctive:

    If fetch fails, stop and report that the outgoing range cannot be verified reliably.

    line 81
  23. Distinctive:

    If HEAD and the upstream have diverged, stop and report both counts.

    line 85
  24. Distinctive:

    If HEAD is only behind the upstream, stop and report that synchronization is required.

    line 86
  25. Distinctive:

    Do not pull, merge, or rebase to reconcile either state.

    line 87
  26. Distinctive:

    Before doing any other work, identify every commit and file already waiting to be pushed from that report.

    line 89
  27. Distinctive:

    If existing outgoing commits are present, show:

    line 91
  28. Distinctive:

    every outgoing commit SHA and subject.

    line 94
  29. Distinctive:

    every changed file when the outgoing range contains 50 files or fewer.

    line 95
  30. Distinctive:

    Ask whether those existing commits should be included.

    line 99
  31. Distinctive:

    If the existing outgoing range contains more than 50 files, use the large-change gate below instead of printing every filename.

    line 101
  32. Distinctive:

    If the worktree is clean and outgoing commits exist, skip commit preparation and proceed to the final outgoing-range review.

    line 103
  33. Distinctive:

    When the count exceeds 50, stop and show:

    line 109
  34. Distinctive:

    Ask whether to continue reviewing that large change set.

    line 117
  35. Distinctive:

    Treat paths staged before this workflow as user-owned staging.

    line 123
  36. Distinctive:

    If any path would be left uncommitted, show:

    line 130
  37. Distinctive:

    Ask whether to leave those paths out, include them, or revise the selection.

    line 137
  38. Distinctive:

    Do not mention ordinary ignored files unless they are suspiciously relevant to the requested work.

    line 139
  39. Distinctive:

    Run the smallest relevant verification required by repository instructions or clearly implied by the changed files.

    line 145
  40. Distinctive:

    Prefer focused tests, lint, or typechecks over repository-wide suites.

    line 147
  41. Distinctive:

    Do not duplicate checks that repository instructions explicitly assign to commit hooks.

    line 148
  42. Distinctive:

    If no separate verification is appropriate, state that none was run.

    line 149
  43. Distinctive:

    If verification fails, stop before committing and report the useful failure output.

    line 150
  44. Distinctive:

    Do not change code merely to silence an unrelated failure.

    line 151
  45. Distinctive:

    every staged change belongs to the intended work.

    line 159
  46. Distinctive:

    no confirmed exclusion is staged.

    line 160
  47. Distinctive:

    no credential, secret, suspicious large file, or unrelated generated artifact is included.

    line 161
  48. Distinctive:

    Run the staged sensitive-content gate.

    line 164
  49. Distinctive:

    If the staged scope differs materially from the confirmed scope, stop and explain the difference.

    line 166
  50. Distinctive:

    use an imperative subject.

    line 172
  51. Distinctive:

    keep the subject at most 72 characters with no trailing period.

    line 173
  52. Distinctive:

    use a short body only when it adds useful context.

    line 175
  53. Distinctive:

    Commit normally so all configured Git hooks run.

    line 177
  54. Distinctive:

    If verification, git commit, or a Git hook fails:

    line 179
  55. Distinctive:

    leave staged and unstaged changes intact.

    line 185
  56. Very specific:

    do not retry with --no-verify.

    line 186
  57. Distinctive:

    do not proceed to push.

    line 187
  58. Very specific:

    Run the final sensitive-content gate immediately after the fetch and before displaying outgoing metadata.

    line 193
  59. Distinctive:

    Use the report to determine:

    line 197
  60. Distinctive:

    every file added, modified, deleted, or renamed by the complete outgoing range.

    line 200
  61. Distinctive:

    If the complete outgoing range now exceeds 50 files and that exact breadth was not already approved, apply the large-change gate again.

    line 205
  62. Distinctive:

    Before every push, show a concise summary containing:

    line 209
  63. Distinctive:

    every changed filename when there are 50 files or fewer.

    line 213
  64. Distinctive:

    every path deliberately left uncommitted and what it appears to concern.

    line 217
  65. Distinctive:

    If the destination is the detected remote default branch, display a prominent warning that the push goes directly to the default branch.

    line 220
  66. Distinctive:

    Ask: Push these changes? Wait for an explicit affirmative response.

    line 222
  67. Distinctive:

    If confirmation is declined, leave the commit local and report that nothing was pushed.

    line 224
  68. Distinctive:

    After explicit confirmation, run the previously displayed push command against the configured upstream.

    line 228
  69. Distinctive:

    If the push fails or is rejected:

    line 230
  70. Distinctive:

    leave local commits intact.

    line 234
  71. Distinctive:

    do not pull, merge, rebase, reset, amend, retry, or force-push.

    line 235
  72. Distinctive:

    If the push succeeds, report:

    line 238
  73. Distinctive:

    commit SHA and subject for each pushed commit.

    line 241

“Common” is measured: kept by at least 6 in 10 of the 8 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.

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

Commit and push

Review, verify, commit, and push the intended changes. Preserve unrelated work and require explicit approval before every push.

Resolve <skill-dir> as the directory containing this SKILL.md. Invoke every bundled script by its absolute <skill-dir>/scripts/... path while keeping the target repository as the working directory. Never resolve scripts/... against the target repository or PATH. The scripts are read-only and never fetch, stage, commit, or push. Keep scope decisions, verification selection, commit-message judgment, and approvals in this workflow.

Safety rules

  • Read and follow all applicable repository instructions before acting.
  • Never assume every worktree change belongs to the current task.
  • Never discard, reset, restore, stash, overwrite, or otherwise alter unrelated changes.
  • Treat the existing index as user-owned state. Never alter pre-existing staging without explicit confirmation.
  • Never bypass Git hooks or verification with --no-verify.
  • Never pull, merge, rebase, amend, reset, force-push, or retry a rejected push as part of this workflow.
  • Treat any in-progress merge, rebase, cherry-pick, or revert as an absolute stop. Never resolve conflicts or run continue, skip, or abort commands for the user.
  • Never infer or create an upstream branch.
  • Never expose secret values when describing files or failures.
  • Treat the original invocation as permission to prepare a commit, not permission to push.
  • Require explicit confirmation immediately before every push.

Sensitive-content gate

Use <skill-dir>/scripts/check-sensitive-content.py to block routable IP address literals, likely credentials or private keys, oversized files, archives, sensitive filenames, and common generated artifacts. Scan at all four checkpoints:

  1. Worktree before displaying changed paths: <skill-dir>/scripts/check-sensitive-content.py --worktree.
  2. Existing outgoing commits: <skill-dir>/scripts/check-sensitive-content.py --range '@{upstream}..HEAD'.
  3. Staged content before committing: <skill-dir>/scripts/check-sensitive-content.py --staged.
  4. Refreshed final outgoing range: <skill-dir>/scripts/check-sensitive-content.py --range '@{upstream}..HEAD'.

The scanner checks every complete resulting blob for path, size, archive, filename, and artifact risks. Textual blobs additionally receive IP-address and credential-pattern scanning. Binary classification never bypasses universal checks. Its default size limit is 20 MiB. It reports only a redacted path, category, and line number; never print the matched value. Any match is blocking, including matches in documentation, examples, and tests. Loopback, unspecified, private, link-local, and RFC documentation addresses are allowed, as are version strings such as v1.2.3.4 and recognised browser User-Agent versions such as Chrome/124.0.0.0; every other public address stays blocking. Stop and ask the user to remove the content or exclude the path. Never commit or push a flagged match. If the scanner cannot run or inspect a blob, stop rather than treating the scan as clean.

1. Inspect the repository

After reading repository instructions, run <skill-dir>/scripts/git-review.py gate as the first repository command. Do not scan the worktree, inspect status or hooks, fetch, review diffs, stage, commit, or push before this gate passes.

The gate reports repository root, branch, upstream, remote names, detached state, in-progress operations, and conflicts without collecting general worktree status. Apply every stop rule below to this report.

If operations reports a merge or rebase, or conflicts is non-empty, immediately:

  • warn that the repository is in the middle of that operation;
  • report the operation type and conflicted paths when safe;
  • state that the user must resolve, continue, skip, or abort it separately;
  • stop the workflow.

Do not inspect or edit conflicted files, suggest resolutions, fetch, stage, commit, run hooks, or invoke merge --continue, merge --abort, rebase --continue, rebase --skip, or rebase --abort. A request to commit and push never authorizes finishing or cancelling an existing operation.

Also stop immediately when:

  • HEAD is detached;
  • another in-progress Git operation exists, including cherry-pick or revert;
  • the current branch has no configured upstream;

When no upstream is configured, report the current branch and available remote names without printing potentially credential-bearing URLs. Do not run git push -u or create a remote branch.

After the gate passes, run <skill-dir>/scripts/check-sensitive-content.py --worktree. Only after that passes, run <skill-dir>/scripts/git-review.py inspect. Its JSON provides redacted changed paths, rename-aware worktree counts, and top-level grouping. Stop if intended change ownership cannot be determined safely.

2. Check repository hook setup

Run <skill-dir>/scripts/check-hooks.py. It reports the effective hooks directory, repository hook-manager configuration, expected hooks, missing expected hooks, non-sample hook files, executable state, and a conservative status without executing hooks.

Use its evidence with repository instructions, setup documentation, package scripts, and manager configuration to determine how hooks are intended to be activated. Run an additional non-mutating manager status command only when needed. Do not execute hook payloads merely to test setup.

Treat only verified-active as confirmed active. If repository hook sources or configuration exist but the intended hooks appear inactive, missing, misconfigured, or cannot be verified as active:

  • show the hook files or configuration found;
  • show the concise evidence that setup is absent, broken, or uncertain;
  • warn that committing without active project hooks may skip required checks;
  • ask whether to continue.

Wait for explicit confirmation before continuing. This confirmation permits the workflow to continue without verified hooks; it does not authorize a push. Do not install, repair, copy, or reconfigure hooks unless the user separately requests it.

3. Fetch and inspect existing outgoing commits

Fetch the configured upstream remote before calculating outgoing commits. Fetch only: do not pull, merge, rebase, or prune.

If fetch fails, stop and report that the outgoing range cannot be verified reliably. Do not rely silently on stale remote-tracking refs.

Immediately run <skill-dir>/scripts/check-sensitive-content.py --range '@{upstream}..HEAD' after the fetch. It also scans outgoing commit metadata. Only after it passes, run <skill-dir>/scripts/git-review.py outgoing. Use that script's JSON for ahead/behind state, commits, rename-aware files, aggregate diff statistics, top-level grouping, default-branch detection, and the exact push command.

  • If HEAD and the upstream have diverged, stop and report both counts.
  • If HEAD is only behind the upstream, stop and report that synchronization is required.
  • Do not pull, merge, or rebase to reconcile either state.

Before doing any other work, identify every commit and file already waiting to be pushed from that report.

If existing outgoing commits are present, show:

  • the upstream destination;
  • every outgoing commit SHA and subject;
  • every changed file when the outgoing range contains 50 files or fewer;
  • aggregate insertion and deletion counts;
  • a warning that these commits will be included in any later push.

Ask whether those existing commits should be included. Wait for confirmation. This confirmation permits the workflow to continue; it does not authorize a push.

If the existing outgoing range contains more than 50 files, use the large-change gate below instead of printing every filename.

If the worktree is clean and outgoing commits exist, skip commit preparation and proceed to the final outgoing-range review. If the worktree is clean and there are no outgoing commits, stop and report that there is nothing to commit or push.

4. Apply the large-change gate

Apply this gate separately to each changed-path set reviewed by the workflow: the existing outgoing range, the worktree, and the final outgoing range. Use git-review.py's logical path count, status counts, and top-level groups; a rename is already counted as one path.

When the count exceeds 50, stop and show:

  • which changed-path set triggered the gate;
  • total path count;
  • counts of added/untracked, modified, deleted, and renamed paths;
  • counts grouped by top-level directory or another concise, coherent area;
  • whether the breadth appears consistent with one change.

Ask whether to continue reviewing that large change set. For the worktree gate, wait for confirmation before staging or running potentially expensive verification. Approval of any large-change gate does not authorize a push.

5. Resolve the commit scope

Account for every changed and untracked path. Inspect enough of each diff or file to determine what it appears to concern.

Treat paths staged before this workflow as user-owned staging. If a pre-staged path would be excluded or its ownership is ambiguous, stop and ask whether to keep it included or explicitly unstage it. Never change pre-existing staging silently.

Separate paths into:

  • intended changes to commit;
  • changes that appear unrelated, local-only, generated unexpectedly, suspicious, or otherwise unsuitable to commit.

If any path would be left uncommitted, show:

  • each excluded path;
  • its status;
  • a brief, non-sensitive description of what it appears to concern;
  • why it appears separate from the intended commit.

Ask whether to leave those paths out, include them, or revise the selection. Wait for confirmation before staging.

Do not mention ordinary ignored files unless they are suspiciously relevant to the requested work.

If no intended uncommitted changes remain but confirmed outgoing commits exist, skip verification, staging, and commit creation unless repository instructions require otherwise. Proceed to the final outgoing-range review. If neither intended changes nor outgoing commits remain, stop and report that there is nothing to commit or push.

6. Verify the intended changes

Run the smallest relevant verification required by repository instructions or clearly implied by the changed files.

  • Prefer focused tests, lint, or typechecks over repository-wide suites.
  • Do not duplicate checks that repository instructions explicitly assign to commit hooks.
  • If no separate verification is appropriate, state that none was run; configured Git hooks will still run.
  • If verification fails, stop before committing and report the useful failure output.
  • Do not change code merely to silence an unrelated failure.

7. Stage and review

Stage only the confirmed intended paths. Do not use blanket staging when unrelated changes exist.

Review the staged name/status summary and staged patch. Confirm that:

  • every staged change belongs to the intended work;
  • no confirmed exclusion is staged;
  • no credential, secret, suspicious large file, or unrelated generated artifact is included;
  • the staged change is coherent enough for one commit.

Run the staged sensitive-content gate. Do not commit when it reports a match or cannot complete.

If the staged scope differs materially from the confirmed scope, stop and explain the difference.

8. Generate and create the commit

Inspect recent commit subjects and follow the repository's established convention. Generate a concise message from the staged diff:

  • use an imperative subject;
  • keep the subject at most 72 characters with no trailing period;
  • capture the primary user-visible or developer-visible change;
  • use a short body only when it adds useful context.

Commit normally so all configured Git hooks run.

If verification, git commit, or a Git hook fails:

  • stop immediately;
  • report the hook or command that failed, when identifiable;
  • show useful error or test output without leaking secrets;
  • inspect and report whether a commit was created;
  • leave staged and unstaged changes intact;
  • do not retry with --no-verify;
  • do not proceed to push.

9. Recalculate the complete outgoing push

Fetch the configured upstream remote again immediately before calculating the final outgoing range. If the fetch fails, stop and report that the range cannot be verified reliably.

Run the final sensitive-content gate immediately after the fetch and before displaying outgoing metadata. Then run <skill-dir>/scripts/git-review.py outgoing. If its report shows the upstream is ahead or diverged, stop before presenting a push confirmation. Do not reconcile automatically.

Calculate the complete outgoing range. It must include pre-existing outgoing commits as well as any newly created commit.

Use the report to determine:

  • every outgoing commit;
  • every file added, modified, deleted, or renamed by the complete outgoing range;
  • aggregate insertion and deletion counts;
  • the exact destination remote and branch;
  • the exact non-force push command, expressed explicitly as git push <remote> HEAD:<remote-branch> rather than relying on push.default or other destination inference.

If the complete outgoing range now exceeds 50 files and that exact breadth was not already approved, apply the large-change gate again. Do not print an unbounded filename list; summarize it by status and coherent directory or area, then wait for confirmation to continue.

10. Present the push summary

Before every push, show a concise summary containing:

  • destination remote and branch;
  • every outgoing commit SHA and subject;
  • every changed filename when there are 50 files or fewer;
  • for each file, whether it is added, modified, deleted, or renamed;
  • aggregate file, insertion, and deletion counts;
  • verification performed;
  • every path deliberately left uncommitted and what it appears to concern;
  • the exact push command.

If the destination is the detected remote default branch, display a prominent warning that the push goes directly to the default branch.

Ask: Push these changes? Wait for an explicit affirmative response. Neither the original invocation nor any earlier scope confirmation authorizes the push.

If confirmation is declined, leave the commit local and report that nothing was pushed.

11. Push once

After explicit confirmation, run the previously displayed push command against the configured upstream. Never force-push.

If the push fails or is rejected:

  • stop immediately;
  • report the remote error and resulting repository state;
  • leave local commits intact;
  • do not pull, merge, rebase, reset, amend, retry, or force-push;
  • report that the attempted changes were not published.

If the push succeeds, report:

  • pushed branch and remote;
  • commit SHA and subject for each pushed commit;
  • verification performed;
  • any changes deliberately left uncommitted.

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.