create-and-merge-pr

Creates a GitHub pull request, squash merges it, closes the linked issue, and syncs local main.

Updated Jul 7, 2026
One-click install
npx skills add https://github.com/bbenefield89/skills --skill create-and-merge-pr-bbenefield89
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-and-merge-pr
Source: https://github.com/bbenefield89/skills/tree/main/skills/create-and-merge-pr
Command: npx skills add https://github.com/bbenefield89/skills --skill create-and-merge-pr-bbenefield89

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Completing a feature branch involves many error-prone manual steps: pushing the branch, opening a PR with the right title and closing reference, waiting for checks, squash merging, closing the ticket, and syncing local main. This Skill automates that entire GitHub workflow with verification at every step. ## Core Features & Use Cases - End-to-end PR lifecycle: Publishes the current branch, creates or reuses a PR with a Conventional Commit title and Closes #issue line, then squash merges after verifying checks and mergeability. - Issue resolution and closure: Resolves the linked ticket from the branch name or conversation context, confirms it against the diff, and closes it as completed after the merge. - Safe local synchronization: Switches to main, fast-forwards it to the remote, and preserves uncommitted work or local-only commits instead of discarding them. - Use Case: After finishing work on feature/SP-101-claw-movement, ask the agent to run the full workflow; it pushes the branch, opens a PR closing issue #101, squash merges once checks pass, and leaves your local main up to date. ## Quick Start Create a PR from my current branch, squash merge it into main, close the linked ticket, and sync my local main.

Frequently Asked Questions about create-and-merge-pr

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

FAQPage Schema
How do I create and merge a GitHub PR from the command line?

Use gh pr create with explicit --repo, --base, --head, --title, and --body-file arguments, then merge with gh pr merge --squash --match-head-commit to verify the exact head commit. This Skill automates both steps with verification readbacks.

How do I automatically close a GitHub issue when merging a PR?

Include a standalone Closes #issue line in the PR body; GitHub closes the issue automatically when the PR merges into the default branch. For merges into other branches, this Skill closes the issue manually with gh issue close --reason completed.

What happens if the PR has merge conflicts or failing checks?

The workflow stops before merging and reports the PR URL with its conflict or check status. It leaves the PR open and never bypasses repository protections, failed checks, or missing approvals.

Does this workflow handle uncommitted local changes?

It uses only committed changes from the current branch and reports uncommitted work before publishing. It never automatically commits, stashes, discards changes, force pushes, or deletes branches.

Can it reuse an existing PR instead of creating a duplicate?

Yes, it searches for an existing PR matching the exact source repository, source branch, base repository, and base branch, and reuses a matching open PR. It stops and asks when matches are ambiguous or a closed unmerged PR exists.