squash-branch

squash-branch is a skill for Claude Code from jcottam/agent-resources. It costs 66 tokens per session (881 once invoked), scanned A, original, MIT.

A Git history-cleanup workflow that combines related commits into a smaller, readable sequence without changing the final code. Git history is the record of how changes were saved over time.

In plain words
What is it for?
Use it to organize a feature branch, a date range, or recent commits before review or sharing.
Why use it?
It removes work-in-progress clutter and makes a branch easier to review. It also checks the rebuilt result against the original and runs tests and the build.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the agent-resources plugin — 11 skills shipped together

Good fit Use it to organize a feature branch, a date range, or recent commits before review or sharing.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jcottam/agent-resources/squash-branch
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add jcottam/agent-resources --skill squash-branch
Clone the repo
git clone --depth 1 https://github.com/jcottam/agent-resources

Made for: Claude Code.

Or install agent-resources, the plugin that ships this one along with the rest of its 11 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for squash-branch

README.md
[![agentmods](https://agentmods.dev/badge/skills/jcottam/agent-resources/squash-branch/github.svg)](https://agentmods.dev/skills/jcottam/agent-resources/squash-branch)
Your own site
<a href="https://agentmods.dev/skills/jcottam/agent-resources/squash-branch"><img src="https://agentmods.dev/badge/skills/jcottam/agent-resources/squash-branch/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for squash-branch

Your own site · 80×15
<a href="https://agentmods.dev/skills/jcottam/agent-resources/squash-branch"><img src="https://agentmods.dev/badge/skills/jcottam/agent-resources/squash-branch.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 66 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 881 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00066 $0.00881
Opus 5.5 $0.00026 $0.00352
Sonnet 5.5 $0.00013 $0.00176
Haiku 4.5 $0.00007 $0.00088

Measured 26d ago against content hash b8ad3cfa108f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

squash-branch scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 26d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/engineering/squash-branch/SKILL.md · 143 lines

How it starts

The opening of the file, as written. The whole thing — 143 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Squash Branch

Turn noisy Git history into a small, reviewable commit stack without changing the final code.

Workflow

  1. Define the commit range.
  2. Review each commit's purpose and files.
  3. Group related commits.
  4. Create a backup branch.
  5. Rebuild the commits.
  6. Compare the rebuilt tree with the backup.
  7. Run the project's tests and build.
  8. Push with --force-with-lease.

1. Define the range

Use the range named by the user:

  • Feature branch: <base>..HEAD
  • Since a commit or tag: <ref>..HEAD
  • Today's work: commits since local midnight
  • Recent work: the requested number of commits

Confirm the current branch, working tree, remote, and selected base before changing history.

If there are uncommitted changes, commit them only when the user asks. Otherwise, ask whether to commit or stash them.

2. Review the commits

Read the log, messages, and file statistics:

git log <range> --reverse --format="%H %s%n%b---"
git diff <base>...HEAD --stat
git show --stat <sha>

Group commits by purpose. Combine fixups, tests, documentation, and polish with the change they support. Keep unrelated features, infrastructure changes, and reverts separate.

Prefer a few clear commits, but do not force unrelated work into an arbitrary commit count.

3. Create a backup

git branch backup/<branch>-<date> HEAD

Record the original tip and base commit. The backup protects the exact tree while history is rebuilt.

4. Rebuild the history

Reset to the base only after the backup exists:

git reset --hard <base>

For contiguous groups, restore the tree at each group's tip:

git read-tree -u --reset <group-tip>
git commit -m "<clear subject>" -m "<why this group exists>"

For non-contiguous groups, apply the selected commits without committing, then create one new commit:

git cherry-pick -n <sha-1> <sha-2> <sha-3>
git commit -m "<clear subject>" -m "<why this group exists>"

Keep commits in their original order unless reordering is required to form a logical group. Stop and report conflicts rather than guessing how to resolve them.

Read the full file on GitHub · 143 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 26d ago First seen · 143 lines · 66 tokens per session scan A b8ad3cfa108f

Subscribe to this mod's changes

squash-branch is a skill published in the GitHub repository jcottam/agent-resources (29 stars, last pushed 8d ago), licensed MIT. It adds 66 tokens to every session and 881 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-21.

Related

Other skills, from other repositories

loom-git-workflow

Git operations guidance including branching strategies, commit conventions, merge workflows, conflict resolution, and worktree management.

cosmix/loom · 27 tokens

conventional-commit

Generer conventional commit-meldinger med Nav-relevante scopes og breaking change-format.

navikt/copilot · 22 tokens

configure-git-repository

Configure a Git repository with proper .gitignore, branch strategy, commit conventions, hooks, and remote setup. Covers initial setup and common patterns for R, Node.js, and Python projects. Use when initializing version control for a new project, adding a .gitignore for a specific language or framework, setting up…

pjt222/agent-almanac · 78 tokens

commit-changes

Stage, commit, and amend changes with conventional commit messages. Covers reviewing changes, selective staging, writing descriptive commit messages using HEREDOC format, and verifying commit history. Use when saving a logical unit of work to version control, creating a commit with a conventional message, amending the…

pjt222/agent-almanac · 72 tokens

spec-apply

Implement an OpenSpec change's tasks in parallel - read the task queue, plan file-disjoint waves, dispatch one agent per task into its own worktree, verify, tick the checkbox, commit, repeat. Use when the user says "apply the change", "implement the change", "run the tasks", "work the tasks in parallel", "fan out the…

pivoshenko/pivoshenko.ai · 188 tokens

spec-propose

Draft the OpenSpec change artifacts - proposal.md, the specs/ delta, design.md, tasks.md - on a fresh branch, install the wave rules that make tasks.md parallel-safe, validate, and commit. Use when the user says "propose this", "write the proposal", "spec this out", "/spec-propose", "turn this into an OpenSpec…

pivoshenko/pivoshenko.ai · 229 tokens