merge-pr

Squash-merge prepared GitHub pull requests and clean up worktrees.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/carlooss-pm/agents --skill merge-pr-carlooss-pm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: merge-pr
Source: https://github.com/carlooss-pm/agents/tree/main/projects/openclaw/skills/merge-pr
Command: npx skills add https://github.com/carlooss-pm/agents --skill merge-pr-carlooss-pm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Merge prepared GitHub pull requests using squash and ensure the PR ends in MERGED state, with worktrees cleaned up after success.

Core Features & Use Cases

  • Squash-merge PRs via gh pr merge --squash and automatically delete the branch
  • Validate PR is not a draft, checks pass, and is not behind main
  • Clean up temporary worktrees only after a successful merge

Quick Start

Prepare a PR and run this skill to merge it and tidy up the workspace.

Frequently Asked Questions about merge-pr

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I squash-merge a GitHub pull request using the gh CLI?

You can squash-merge a pull request by running gh pr merge --squash with the --delete-branch flag. The skill validates checks and non-draft status, ensures a MERGED state, and cleans up the worktree after success.

Can I automatically delete a git branch after squash-merging a PR?

Yes, automatically deleting a branch after squash-merging is supported by passing the --delete-branch flag to gh pr merge. The skill ensures the branch is removed only after the PR successfully reaches the MERGED state.

What checks are required before merging a pull request to the main branch?

Before merging a pull request, the PR must not be a draft, all checks must pass, and it cannot be behind main. Guardrails are applied to prevent pushing directly to main during the squash merge process.

How do I clean up temporary git worktrees after a successful PR merge?

To clean up temporary git worktrees, the skill automatically removes them only after the squash merge is successful and the PR reaches the MERGED state. This ensures your workspace is tidy without risking unmerged changes.

Do I need the gh CLI installed to squash-merge pull requests from the command line?

Yes, you need the gh CLI, Git, and repository access installed to verify the PR state and perform a squash merge. These dependencies are required to execute the merge and clean up worktrees.

Why does my pull request fail to merge when it is behind the main branch?

A pull request fails to merge when behind main because the skill validates that the PR is up to date with the base branch. You must update your branch with main before the squash merge can proceed.