git-squash

git-squash is a skill for Claude Code, Codex from PaulRBerg/agent-skills. It costs 27 tokens per session (892 once invoked), scanned A, original, MIT.

A procedure for combining all changes on a feature branch into one Git commit before creating a pull request.

In plain words
What is it for?
Use it to squash a feature branch relative to its merge base, optionally choosing the base branch and exact commit subject.
Why use it?
It produces a shorter, cleaner commit history that represents the branch's final result instead of every intermediate change.

Skill for Claude CodeCodex

Written for Claude Code and Codex: disable-model-invocation in frontmatter, but also agents/openai.yaml present.

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.

agentmods
npx agentmods add skills/paulrberg/agent-skills/git-squash
Any agent
npx skills add PaulRBerg/agent-skills --skill git-squash
Clone the repo
git clone --depth 1 https://github.com/PaulRBerg/agent-skills

Made for: Claude Code, Codex.

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 git-squash

README.md
[![agentmods](https://agentmods.dev/badge/skills/paulrberg/agent-skills/git-squash.svg)](https://agentmods.dev/skills/paulrberg/agent-skills/git-squash)
Your own site
<a href="https://agentmods.dev/skills/paulrberg/agent-skills/git-squash"><img src="https://agentmods.dev/badge/skills/paulrberg/agent-skills/git-squash.svg" alt="Measured on agentmods" height="20"></a>
Per session 27 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 892 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00027 $0.00892
Opus 5 $0.00014 $0.00446
Sonnet 5 $0.00005 $0.00178
Haiku 4.5 $0.00003 $0.00089

Measured 6d ago against content hash 71c910ed1441, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

git-squash 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 6d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/git-squash.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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/git-squash/SKILL.md · 80 lines

How it starts

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

Git Squash

If these instructions are already present in the conversation from a slash or dollar invocation, follow them directly; do not invoke this skill again through a skill tool.

Squash the current feature branch into one commit representing its net change relative to the resolved default branch.

Arguments

  • --subject <line>: require this exact first line in the replacement commit message.
  • --base <branch>: override default-branch detection.

Without --subject, the agent writes a conventional-commit subject from the surviving net diff. Without --base, the helper resolves origin/HEAD, then origin's advertised head, then local/remote main, master, or trunk.

Plan Interface

Resolve the helper from this SKILL.md. Write its JSON to a scratch path outside the repository so preflight remains clean:

uv run "<skill-dir>/scripts/git-squash.py" plan \
  [--cwd <repo>] [--base <branch>] [--subject <line>] > <plan.json>

plan is read-only. It verifies the Git worktree, attached branch, clean tree/index, resolved base, non-default current branch, merge base, positive ahead count, and remote facts. It returns schemaVersion: 1, the immutable original HEAD, merge base, base ref, commits in chronological order, unique authors, tree/remote state, and rollback facts. A failed precondition exits without changing history.

Show the branch, base ref, merge base, commits replaced, tree state, remote state, and rollback HEAD in a compact plain table before mutation.

Agent-Owned Commit Message

Inspect the plan's commits and the net diff from mergeBase..originalHead. The net diff is authoritative; intermediate commits supply intent and attribution only. Inspect targeted hunks when the summary is ambiguous.

Use --subject exactly when supplied. Otherwise choose the conventional type from the surviving outcome: feat, fix, refactor, docs, test, build, ci, chore(deps), style, perf, ai, or chore. Do not call the change chore merely because it is a squash.

Read the full file on GitHub · 80 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 6d ago First seen · 80 lines · 27 tokens per session scan A 71c910ed1441

Subscribe to this mod's changes

git-squash is a skill published in the GitHub repository PaulRBerg/agent-skills (70 stars, last pushed yesterday), licensed MIT. It adds 27 tokens to every session and 892 once invoked, about $0.0001 per session on Opus 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-08-30.