agentleFS
TrimVisTrimVis/skills/squash/SKILL.md

squash

Skill2 starsChanged 3 months agoMITView on GitHub

Rebase the current branch against its fork point (master/main) and squash the branch commits into a small, sensibly-grouped set. Larger restructuring is welcome — drop work that was later reverted, fold fixups into their parent. Commit messages follow the same category-prefixed terse style as /commit, authored as the user. Use when the user says "squash this branch", "clean up commits", "squash before merge", or invokes /squash.

  • Deletes or force-pushes
  • Commits and pushes

3 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions3 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 3

    1. aymericbeaumet/dotfiles★ 22same name
    2. TashanGKD/cc_plugins★ 4same name
    3. Pradnyeshp/Claude-Skills★ 2same 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 repository8 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. About 0 are common, 11 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    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. Very specific:

    All resulting commits in the user's name only.

    line 12
  2. Distinctive:

    Read the branch's commits and the cumulative diff.

    line 50
  3. Distinctive:

    Default to one commit: Only split when the branch genuinely does multiple independent things that a reviewer would want to evaluate …

    line 54
  4. Distinctive:

    Drop reverted work: If a feature was added and later removed within the branch, the final history should contain neither — not "add X" …

    line 55
  5. Distinctive:

    Respect the user's intent: If the branch clearly tells a story across 2–3 commits the user constructed deliberately, don't flatten it …

    line 58
  6. Distinctive:

    Wait for confirmation unless the user pre-authorized.

    line 70
  7. Very specific:

    Prefer the soft reset approach over rebase -i — it's mechanical, scriptable, and avoids editor interaction.

    line 74
  8. Very specific:

    If conflicts surface during a true rebase (only needed if you also want to land on top of updated <base>):

    line 90
  9. Distinctive:

    No bullet-list of folded commits.

    line 105
  10. Very specific:

    No emojis. No Co-Authored-By.

    line 106
  11. Distinctive:

    If non-empty, something was lost — reset to the backup ref and re-plan.

    line 121
  12. Distinctive:

    If the branch was previously pushed and the user wants it updated:

    line 125
  13. Very specific:

    Never plain --force. Never force-push to master/main.

    line 131
  14. Distinctive:

    No force-push without explicit confirmation.

    line 136
  15. Distinctive:

    No squashing on master/main.

    line 137
  16. Distinctive:

    No silent dropping of commits the user might want — surface the plan first.

    line 138

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

Squash

Collapse a feature branch into a clean, reviewable history before merge.

Authorship

All resulting commits in the user's name only. No Co-Authored-By: Claude. No --author. Preserve whatever the user already had; don't rewrite identity.

Step 1 — Find the fork point

Determine the base branch (usually master, sometimes main). Check what exists:

git rev-parse --verify master 2>/dev/null || git rev-parse --verify main

Find the actual fork point (not just master HEAD, which may have moved):

git merge-base HEAD <base>

Show the user the branch range before doing anything:

git log --oneline <base>..HEAD
git diff --stat <base>...HEAD

Step 2 — Safety check

Before rewriting history:

  • Working tree is clean (git status). If not, stop and ask.
  • Branch is not master/main itself.
  • Note whether the branch is pushed (git rev-parse @{u} succeeds). If yes, warn the user that this will require a force-push and confirm before proceeding.
  • Create a safety ref so the pre-squash state is recoverable:
    git branch backup/squash-<branch>-<shortsha>
    Tell the user the backup ref name.

Step 3 — Plan the squash

Read the branch's commits and the cumulative diff. Decide the final commit set.

Guiding principles:

  • Default to one commit. Only split when the branch genuinely does multiple independent things that a reviewer would want to evaluate separately (e.g. a backend change + an unrelated helm bump).
  • Drop reverted work. If a feature was added and later removed within the branch, the final history should contain neither — not "add X" followed by "remove X".
  • Fold fixups. "fix typo", "address review", "oops" → into their logical parent.
  • Restructure freely. This is the moment for it. The branch's intermediate history is throwaway.
  • Respect the user's intent. If the branch clearly tells a story across 2–3 commits the user constructed deliberately, don't flatten it without asking.

Present the plan to the user before rewriting:

Squashing 14 commits into 2:
  1. backend: <headline>   (folds: a1b2c3, d4e5f6, ...)
  2. frontend: <headline>  (folds: 7a8b9c, ...)
Dropping: "add experimental flag X" (reverted in same branch)
Backup: backup/squash-<branch>-<sha>

Wait for confirmation unless the user pre-authorized.

Step 4 — Execute

Prefer the soft reset approach over rebase -i — it's mechanical, scriptable, and avoids editor interaction.

For a single resulting commit:

git reset --soft $(git merge-base HEAD <base>)
git commit -m "$(cat <<'EOF'
<category>: <headline>

<optional short body>
EOF
)"

For multiple resulting commits, do it in passes: soft-reset to base, then stage and commit each logical group with explicit git add <paths>.

If conflicts surface during a true rebase (only needed if you also want to land on top of updated <base>):

git rebase <base>

Resolve them; never --skip past a conflict without understanding it. Never use destructive escapes (rebase --abort is fine and non-destructive; reset --hard to discard is not).

Step 5 — Commit message rules

Identical to /commit:

  • Headline ≤72 chars, <category>: <imperative summary>.
  • Categories from recent git log (backend:, frontend:, helm:, docs:, bugfix:, chore:, refactor:, ...).
  • Body optional, 1–3 short lines, high-level why.
  • No bullet-list of folded commits. No "squashed from N commits". The history itself shows that.
  • No emojis. No Co-Authored-By.

Step 6 — Verify

git log --oneline <base>..HEAD
git diff <base>...HEAD --stat

Confirm the cumulative diff is identical to before the squash:

git diff <pre-squash-backup>..HEAD   # should be empty

If non-empty, something was lost — reset to the backup ref and re-plan.

Step 7 — Push (only if asked)

If the branch was previously pushed and the user wants it updated:

git push --force-with-lease

Never plain --force. Never force-push to master/main. Confirm before pushing even with --force-with-lease if you haven't already.

Don'ts

  • No Co-Authored-By trailer.
  • No force-push without explicit confirmation.
  • No squashing on master/main.
  • No silent dropping of commits the user might want — surface the plan first.
  • No git push --force (use --force-with-lease).

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.