Agent skill

Squash Commits

by Cybereason-Public in Cybereason-Public/owLSM

Squashes multiple commits on the current branch into a single commit with an auto-generated message, then pushes.

GPL-2.0Auto-check passedDevelopment

Install Squash Commits

skills CLI
$ npx skills add Cybereason-Public/owLSM --skill squash-commits -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Cybereason-Public/owLSM squash-commits --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Cybereason-Public/owLSM.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.cursor/skills/squash-commits .claude/skills/squash-commits && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
squash-commits
GitHub stars
280
Token cost
~2.2k tokens
SKILL.md length
644 words
Files
1
Skills in repo
9
Repo updated
First seen
Licence
GPL-2.0

At a glance

Squashes multiple commits on the current branch into a single commit with an auto-generated message, then pushes.

  • Works in 7 steps: Record Initial State → Determine Commits to Squash → Validate Commit Count → …
  • Development work in your project
  • SKILL.md covers Input Parameters, Modes, Pre-flight Checks (MUST ALL… and Critical Rule: Preserve…, plus 5 more sections
  • Calls git

What it does

Squash Commits is an agent skill from Cybereason-Public/owLSM. Squashes multiple commits on the current branch into a single commit with an auto-generated message, then pushes.

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development. It works with Git and Linux. The repository describes itself as: Sigma Rules Engine inside the Linux Kernel using eBPF. Focusing on prevention capabilities. The licence is GPL-2.0.

When your agent uses it

  • Development work in your project

Example prompts

  • “Use the squash-commits skill to squash multiple commits on the current branch into a single commit with an auto-generated message, then pushes”
  • “/squash-commits”

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. Record Initial State
  2. Determine Commits to Squash
  3. Validate Commit Count
  4. Generate Commit Message
  5. Perform the Squash
  6. Push Changes
  7. Report Success

What it can do on your machine

Read from SKILL.md and the folder at commit 8e541af. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Squash Commits loads about 2.2k tokens when it runs. Until then it costs about 32 tokens; SKILL.md has 644 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~32
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Cybereason-Public/owLSM at commit 8e541af, republished under its GPL-2.0 licence (© Cybereason-Public). 644 words, ~2,173 tokens.

Download SKILL.mdSave it as .claude/skills/squash-commits/SKILL.md (or your agent's skills folder).
name
squash-commits
description
Squashes multiple commits on the current branch into a single commit with an auto-generated message, then pushes.

Squash Commits

You are a Git workflow assistant that squashes commits on the current branch into a single commit.

Input Parameters

ParameterRequiredDefaultDescription
modeNosince-branchHow to determine which commits to squash
base_branchNomainFor since-branch mode: the branch we branched from
commit_countNo-For count mode: number of commits to squash
since_commitNo-For since-commit mode: squash all commits after this SHA

Modes

Mode 1: since-branch (Default)

Squash all commits since branching from a base branch.

Example invocations:

  • "squash my commits" → squashes all commits since branching from main
  • "squash commits since develop" → squashes all commits since branching from develop
  • "squash since feature/base" → squashes all commits since branching from feature/base
Mode 2: count

Squash a specific number of recent commits.

Example invocations:

  • "squash last 3 commits"
  • "squash the last 5 commits into one"
Mode 3: since-commit

Squash all commits after a specific commit SHA.

Example invocations:

  • "squash all commits after abc1234"
  • "squash commits since abc1234"

Pre-flight Checks (MUST ALL PASS before proceeding)

Before doing anything, verify ALL of the following. If ANY check fails, STOP and report the issue:

  1. Not on main/master/develop — Squashing protected branches is dangerous
  2. Not on a detached HEAD — Must be on a named branch
  3. No uncommitted changes — Working directory must be clean (or stash first)
  4. Commits exist to squash — At least 2 commits must be selected for squashing
  5. No ongoing rebase/merge — Check .git/rebase-merge, .git/MERGE_HEAD
  6. Remote exists — origin remote must be configured (for push)

Critical Rule: Preserve Original State on Any Error

If anything fails after we start modifying history:

  1. Use git rebase --abort if in rebase
  2. Use git reset --hard ORIG_HEAD to restore if reset was used
  3. Restore stash if created
  4. Report the error clearly

Workflow

Step 1: Record Initial State
bash
# Save current branch name
CURRENT_BRANCH=$(git branch --show-current)

# Verify not on protected branch
case "$CURRENT_BRANCH" in
    main|master|develop)
        echo "ERROR: Cannot squash commits on protected branch '$CURRENT_BRANCH'"
        exit 1
        ;;
esac

# Save current HEAD for recovery
ORIGINAL_HEAD=$(git rev-parse HEAD)

# Check for uncommitted changes
if ! git diff --cached --quiet || ! git diff --quiet; then
    echo "ERROR: You have uncommitted changes. Please commit or stash them first."
    exit 1
fi
Step 2: Determine Commits to Squash

For since-branch mode (default):

bash
BASE_BRANCH="${USER_SPECIFIED_BASE:-main}"

# Find the merge-base (where this branch diverged from base)
MERGE_BASE=$(git merge-base HEAD "$BASE_BRANCH" 2>/dev/null || \
             git merge-base HEAD "origin/$BASE_BRANCH" 2>/dev/null)

if [ -z "$MERGE_BASE" ]; then
    echo "ERROR: Cannot find common ancestor with '$BASE_BRANCH'"
    exit 1
fi

# Count commits to squash
COMMIT_COUNT=$(git rev-list --count "$MERGE_BASE"..HEAD)

For count mode:

bash
COMMIT_COUNT=$USER_SPECIFIED_COUNT

# Verify we have enough commits
TOTAL_COMMITS=$(git rev-list --count HEAD)
if [ "$COMMIT_COUNT" -gt "$TOTAL_COMMITS" ]; then
    echo "ERROR: Requested $COMMIT_COUNT commits but branch only has $TOTAL_COMMITS"
    exit 1
fi

# Calculate the base commit
MERGE_BASE=$(git rev-parse "HEAD~$COMMIT_COUNT")

For since-commit mode:

bash
SINCE_COMMIT=$USER_SPECIFIED_COMMIT

# Verify commit exists and is an ancestor
if ! git merge-base --is-ancestor "$SINCE_COMMIT" HEAD; then
    echo "ERROR: Commit '$SINCE_COMMIT' is not an ancestor of current HEAD"
    exit 1
fi

MERGE_BASE=$SINCE_COMMIT
COMMIT_COUNT=$(git rev-list --count "$MERGE_BASE"..HEAD)
Step 3: Validate Commit Count
bash
if [ "$COMMIT_COUNT" -lt 2 ]; then
    echo "ERROR: Need at least 2 commits to squash. Found: $COMMIT_COUNT"
    exit 1
fi

echo "Will squash $COMMIT_COUNT commits into one"
echo "Commits to be squashed:"
git log --oneline "$MERGE_BASE"..HEAD
Step 4: Generate Commit Message

Analyze all commits being squashed and create a meaningful message:

bash
# Collect all commit messages
ALL_MESSAGES=$(git log --format="%s%n%b" "$MERGE_BASE"..HEAD)

# Collect summary of files changed
FILES_CHANGED=$(git diff --stat "$MERGE_BASE"..HEAD)

# Get the branch name for context
BRANCH_CONTEXT=$(echo "$CURRENT_BRANCH" | sed 's/[-_]/ /g')

Generate a commit message that includes:

  1. A summary line describing the overall change (based on branch name and commits)
  2. A blank line
  3. "Squashed commits:" header
  4. List of original commit messages (indented)
  5. Optionally: files changed summary

Example generated message:

feat: Add user authentication flow

Squashed commits:
- Add login form component
- Implement JWT token handling  
- Add password validation
- Fix login redirect bug
- Update tests for auth flow

Files changed: 12 files, +450/-23 lines
Step 5: Perform the Squash

Method: Soft Reset + Commit (simpler than interactive rebase)

bash
# Soft reset to merge base - keeps all changes staged
git reset --soft "$MERGE_BASE"

# Commit with the generated message
git commit -m "$GENERATED_MESSAGE"

If this fails:

bash
# Restore original state
git reset --hard "$ORIGINAL_HEAD"
echo "ERROR: Squash failed. Original state restored."
exit 1
Show full SKILL.md (250 more words)Show less
Step 6: Push Changes
bash
# Force push with lease for safety
if ! git push --force-with-lease origin "$CURRENT_BRANCH"; then
    echo "WARNING: Push failed. Possible reasons:"
    echo "  - Someone else pushed to this branch"
    echo "  - Remote branch doesn't exist yet (try: git push -u origin $CURRENT_BRANCH)"
    echo ""
    echo "Local squash is intact. You can:"
    echo "  - Retry with: git push --force-with-lease origin $CURRENT_BRANCH"
    echo "  - Or undo with: git reset --hard $ORIGINAL_HEAD"
fi
Step 7: Report Success
bash
echo ""
echo "=== Squash Complete ==="
echo "Branch: $CURRENT_BRANCH"
echo "Commits squashed: $COMMIT_COUNT → 1"
echo "New commit: $(git rev-parse --short HEAD)"
echo ""
echo "Original HEAD was: $ORIGINAL_HEAD"
echo "To undo: git reset --hard $ORIGINAL_HEAD && git push --force-with-lease"

Error Handling Summary

ScenarioAction
On protected branch (main/master/develop)STOP immediately
Uncommitted changesSTOP: ask user to commit or stash
Base branch doesn't existSTOP: report and suggest alternatives
Less than 2 commitsSTOP: nothing to squash
Reset failsRestore with git reset --hard ORIG_HEAD
Push failsReport warning, keep local squash, provide recovery command

Output Format

Report the following:

  • Current branch: {branch_name}
  • Mode: {since-branch|count|since-commit}
  • Base reference: {branch_name|commit_sha}
  • Commits to squash: {count}
  • Commit list: (show git log --oneline of commits being squashed)
  • Generated message: (show the auto-generated commit message)
  • Squash result: {success|failed}
  • Push result: {success|failed|skipped}
  • Recovery command: (always show how to undo)

Safety Guarantees

  1. Protected branches — Refuses to squash main/master/develop
  2. Clean working directory — Requires no uncommitted changes
  3. Minimum commits — Requires at least 2 commits to squash
  4. Recovery info — Always shows original HEAD SHA and undo command
  5. Safe push — Uses --force-with-lease to prevent overwriting others' work
  6. Atomic operation — If squash fails, restores original state

Commit Message Generation Guidelines

When generating the commit message, the agent should:

  1. Analyze the branch name — Extract feature/fix/refactor context

    • feature/user-auth → "feat: User authentication"
    • fix/login-bug → "fix: Login bug"
    • refactor/api-cleanup → "refactor: API cleanup"
  2. Scan commit messages — Look for patterns and themes

    • Group related changes
    • Identify the main accomplishment
    • Note any bug fixes included
  3. Keep it concise — Summary line under 72 characters

  4. Preserve history — Include original commit messages in body

  5. Follow conventional commits — Use prefixes like feat:, fix:, refactor:, docs:, test:

© Cybereason-Public, GPL-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .cursor/skills/squash-commits of Cybereason-Public/owLSM.

Open the folder on GitHubat commit 8e541af

Compare with similar skills

Squash Commits next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Squash Commits compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Squash Commits this skillCybereason-Public/owLSM280—~2.2kAutomated safety check: PassGPL-2.0
Dirextalk DeployerYingSuiAI/dirextalk-deployer457—~7.2kAutomated safety check: PassMIT
Tk Impact Analysistonkeeper/tonkeeper-web444—~3.7kAutomated safety check: PassApache-2.0
Gridbash Panesjasonsuhari/gridbash134—~1.5kAutomated safety check: PassMIT
SetupProrise-cool/Claude-Code-Multi-Agent306—~3kAutomated safety check: NotesNone
Commitmanhpham90vn/Deskhub133—~978Automated safety check: PassMIT

Similar skills

  • Dirextalk Deployer

    YingSuiAI/dirextalk-deployer

    Deploy, resume, verify, update, recover, reset, or destroy production Dirextalk services and nodes on AWS, and wire local agent runtimes.

    457 GitHub stars~7.2k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Tk Impact Analysis

    tonkeeper/tonkeeper-web

    Analyze QA regression impact for Tonkeeper Web by comparing the current branch with the relevant release tag, reviewing sources/Web/regress.txt, and recommending test blocks, missing coverage, extra…

    444 GitHub stars~3.7k tokensUpdated 8 days ago
    DevelopmentAuto-check passed
  • Gridbash Panes

    jasonsuhari/gridbash

    Coordinate with sibling agent panes from inside a GridBash grid — list panes and their roles, read what a pane is currently doing, prompt one pane or every other pane, and rename pane titles so the…

    134 GitHub stars~1.5k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Setup

    Prorise-cool/Claude-Code-Multi-Agent

    Complete guide to installing Git and performing basic configuration across all platforms (Windows, macOS, Linux, WSL).

    306 GitHub stars~3k tokensUpdated 25 days ago
    DevelopmentAuto-check: notes
  • Commit

    manhpham90vn/Deskhub

    Write a Deskhub commit message. An agent skill from manhpham90vn/Deskhub.

    133 GitHub stars~978 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Git Config

    Prorise-cool/Claude-Code-Multi-Agent

    Comprehensive Git configuration guide covering global settings, aliases, performance tuning, credential management, maintenance, .gitattributes, clone shortcuts, and troubleshooting.

    306 GitHub stars~4.4k tokensUpdated 25 days ago
    DevelopmentAuto-check: notes

More from Cybereason-Public/owLSM

All 9 skills in this repo
  • K8s Security Policies

    Cybereason-Public/owLSM

    Comprehensive guide for implementing NetworkPolicy, PodSecurityPolicy, RBAC, and Pod Security Standards in Kubernetes.

    280 GitHub starsUsed in 12 repos~2k tokens
    Auto-check passed
  • Helm Chart Scaffolding

    Cybereason-Public/owLSM

    Comprehensive guidance for creating, organizing, and managing Helm charts for packaging and deploying Kubernetes applications.

    280 GitHub starsUsed in 13 repos~381 tokens
    Auto-check passed
  • Kubernetes Architect

    Cybereason-Public/owLSM

    Expert Kubernetes architect specializing in cloud-native infrastructure, advanced GitOps workflows (ArgoCD/Flux), and enterprise container orchestration.

    280 GitHub starsUsed in 9 repos~2.6k tokens
    Auto-check passed
  • K8s Manifest Generator

    Cybereason-Public/owLSM

    Step-by-step guidance for creating production-ready Kubernetes manifests including Deployments, Services, ConfigMaps, Secrets, and PersistentVolumeClaims.

    280 GitHub starsUsed in 12 repos~433 tokens
    Auto-check passed
  • Add Gitmcp

    Cybereason-Public/owLSM

    Adds a GitMCP URL for a GitHub repository to the project's MCP configuration (.cursor/mcp.json).

    280 GitHub stars~919 tokensUpdated 2 days ago
    Auto-check passed
  • GitHub Issues

    Cybereason-Public/owLSM

    Manage GitHub issues - create, edit, close, comment, assign, and delegate to Copilot.

    280 GitHub stars~1.8k tokensUpdated 2 days ago
    Auto-check passed

Works with

Categories

Questions about Squash Commits

What does Squash Commits do?

Squashes multiple commits on the current branch into a single commit with an auto-generated message, then pushes. Squash Commits is an agent skill from Cybereason-Public/owLSM. Squashes multiple commits on the current branch into a single commit with an auto-generated message, then pushes.

When should I use Squash Commits?

Squash Commits fits situations like: development work in your project.

How do I install Squash Commits in Claude Code?

Run `npx skills add Cybereason-Public/owLSM --skill squash-commits -a claude-code`. Or copy the skill folder (.cursor/skills/squash-commits in Cybereason-Public/owLSM) into .claude/skills/squash-commits in your project. Claude Code loads it when a task matches its description.

How do I install Squash Commits in Codex?

Run `npx skills add Cybereason-Public/owLSM --skill squash-commits -a codex`. Or copy the skill folder (.cursor/skills/squash-commits in Cybereason-Public/owLSM) into .agents/skills/squash-commits in your project. Codex loads it when a task matches its description.

Can I use Squash Commits in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Cybereason-Public/owLSM --skill squash-commits -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/squash-commits, .gemini/skills/squash-commits, .github/skills/squash-commits and .opencode/skills/squash-commits in your project.

What does Squash Commits need to run?

Going by SKILL.md and its folder, Squash Commits needs the command-line tools its instructions call (git).

Does Squash Commits access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Squash Commits safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Squash Commits use?

Squash Commits is published under the GPL-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Squash Commits use?

About 2.2k tokens (SKILL.md is roughly 8.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Squash Commits?

Skills that share tags, products or a category with Squash Commits: Dirextalk Deployer (YingSuiAI/dirextalk-deployer, 457 stars), Tk Impact Analysis (tonkeeper/tonkeeper-web, 444 stars), Gridbash Panes (jasonsuhari/gridbash, 134 stars) and Setup (Prorise-cool/Claude-Code-Multi-Agent, 306 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Squash Commits?

Cybereason-Public (a GitHub organization) maintains it in Cybereason-Public/owLSM, which has 280 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on October 8, 2026.

Source: Cybereason-Public/owLSM on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.