PR Squash Message Generator
Writes a single Conventional Commits squash message from the net base...head diff of a PR, validates it with commitlint, syncs the PR title and copies only the description.
Dev & CodingIntermediate★ 941⑂ 110AI score 9/10Last updated: Oct 9, 2026
What it does
- Resolves the PR's real base branch with
gh(never hardcodingmainordevelop) and reads onlygit diff origin/BASE...HEAD— the destination, not the branch's journey. - Picks the commit type (
feat/fix/test/docs/chore) from the net effect on the repo's users, then composes a one-line header, a short body (max ~12 lines, wrapped at 72 columns), optional extra changelog entries, and a footer (Closes #n, the---------separator,Co-authored-bylines). - Collects and de-duplicates co-authors from commit authors, committers and existing trailers, never inventing identities.
- Writes the message to a temp file and validates it with
npx --no-install commitlint --verbose, plus line-length and body-length shape checks. - Updates the PR title to match the header via
gh api PATCH, copies only the description to the clipboard (pbcopy/wl-copy/xclip), and always prints title and description in separate code blocks. - Treats forks and outside authors as untrusted: it refuses to run branch code (tests, commitlint, installs) without asking first.
Who it's for
- Teams on GitHub squash merges with Conventional Commits and commitlint enforcement.
- Projects using release-please or similar automation where commit messages drive the changelog and version bumps.
- Maintainers who want consistent squash messages across many contributors.
Examples
- "Write the squash message for this PR" → detects base
develop, reads the diff, and producesfeat(api): add pagination to search endpointwith a few tight bullets. - A branch full of self-inflicted fixups gets no
fixlines, because those commits are invisible from the base branch. - A PR that ships a feature plus a CI workflow change gets a separate
ci(github): ...paragraph so release-please logs two changelog entries. - A stray
.env.localin the diff is flagged outside the message so you can drop it before merging.
· · · Install guide · · ·
Try it now, no install
Paste this into Claude to use the skill without installing anything.
Read the instructions in this file and follow them to help me: https://raw.githubusercontent.com/scenario-labs/skills/HEAD/.agents/skills/pr-squash-message/SKILL.md What I want: (describe your task here)
If Claude can't open the link, open it yourself and paste the contents instead.
↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on Claude Skill Mart. Copy the .agents/skills/pr-squash-message folder from the GitHub repo scenario-labs/skills into my ~/.claude/skills/pr-squash-message/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/scenario-labs/skills.git /tmp/sl-skills && mkdir -p ~/.claude/skills && cp -r /tmp/sl-skills/.agents/skills/pr-squash-message ~/.claude/skills/⚠ This is a third-party skill. Check the source repository before installing.
- Clone the repository:
git clone https://github.com/scenario-labs/skills.git /tmp/sl-skills - Create the skills folder:
mkdir -p ~/.claude/skills - Copy just this skill:
cp -r /tmp/sl-skills/.agents/skills/pr-squash-message ~/.claude/skills/ - Verify prerequisites:
git --version,gh --version(GitHub CLI), andgh auth statusto confirm you are logged in. - Check whether the target repo has a commitlint config (
commitlint.config.*); without it the validation step is skipped. - Make sure a clipboard tool exists:
pbcopyon macOS, or installwl-copy/xclipon Linux. - Restart Claude Code, check out the PR branch, and ask: "generate the squash message for this PR".
View source on GitHub ↗License: MIT