Safely merges pull requests to develop while validating CI status.
Install
mkdir -p .claude/skills/merge && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/18148" && unzip -o skill.zip -d .claude/skills/merge && rm skill.zipInstalls to .claude/skills/merge
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Merges an open pull request targeting `develop` after CI passes. Trigger on: "merge this", "merge the PR", "merge it", "merge PR #N", or any phrase combining "merge" with a branch or PR reference. Also called as an optional final stage from inside commit-and-pr. Accepts an optional PR number argument (e.g., `/merge 42`). Never merges to `main` — use `/merge-main` for releases.Key capabilities
- →Find an open pull request
- →Verify the PR target is `develop`
- →Check CI status for failures or in-progress runs
- →Wait for in-progress CI to complete
- →Request explicit user confirmation for merge
- →Perform a squash merge and delete the branch
How it works
The skill finds a pull request, verifies its target branch and CI status, and then, after user confirmation, performs a squash merge and deletes the feature branch.
Inputs & outputs
When to use merge
- →Merge feature PR
- →Automate branch consolidation
- →Verify CI status before merge
About this skill
Merge Skill
Announce at start: "Running merge skill."
HARD CONSTRAINTS — READ THIS FIRST
- Never merge to
main. If the PR targetsmain, abort immediately and redirect the user to/merge-main. - Never merge when any CI check is failing. If CI has failures, stop and
hand off to
r-implement. - Always require explicit user confirmation before executing the merge.
- Cannot write or edit
.Rsource files or test files.
Step 1 — Find the PR
gh pr view --json number,title,baseRefName,headRefName,url,statusCheckRollup
- If an explicit PR number was passed (e.g.,
/merge 42), use:gh pr view 42 --json number,title,baseRefName,headRefName,url,statusCheckRollup - If no PR exists for the current branch, report:
"No open PR found for this branch. Open a PR first (e.g., with
/commit-and-pr), then re-invoke/merge." Stop.
Store: prNumber, prTitle, baseRefName, prUrl, statusCheckRollup.
Step 2 — Verify target is develop
If baseRefName != "develop":
"PR #N targets
{baseRefName}, notdevelop. This skill only merges feature branches todevelop. For releases, use/merge-main."
Stop immediately.
Step 3 — Check CI status
Inspect statusCheckRollup from Step 1:
| Check state | Action |
|---|---|
All checks SUCCESS | Proceed to Step 4 |
Any check IN_PROGRESS or QUEUED | Wait — see below |
Any check FAILURE | Show failure summary, stop — see CI failure block below |
| No checks (empty rollup) | Warn user that CI has not run yet; ask whether to proceed or wait |
Waiting for in-progress CI:
Find the run ID from the rollup (or via gh run list --branch <branch> --limit 1)
and watch it:
gh run watch <run-id> --exit-status
This blocks until the run completes. If it exits non-zero, treat as FAILURE.
CI failure handoff block:
CI check failed for PR #N.
Failed check: <check-name>
Run URL: <run-url>
Invoke `/r-implement` to diagnose and fix the failure, then re-invoke
`/merge` after the fix is pushed and CI passes.
Stop.
Step 4 — Confirmation gate
Show and wait for explicit user approval:
"CI passed. PR #N (
{headRefName}→develop): {prTitle}Squash-merge this PR?"
Do NOT proceed until the user says yes (or equivalent affirmative). If the user says no or asks to cancel, stop and report: "Merge cancelled."
Step 5 — Squash merge
gh pr merge <prNumber> --squash --delete-branch
If the command fails, report the error verbatim and stop.
Step 6 — Done
Report:
"Merged: {prUrl}"
Then check whether an implementation plan exists in plans/. If one is
found, locate the first remaining - [ ] section and report:
"Next section:
{branch-name}— {description}. Start a new session with/r-implementto continue."
If no plan is found, report done with no next-step suggestion.
When not to use it
- →When the user wants to merge to `main`
- →When any CI check is failing
- →When explicit user confirmation for merge is not provided
Limitations
- →The skill never merges to `main`
- →The skill never merges when any CI check is failing
- →The skill cannot write or edit `.R` source files or test files
How it compares
This skill automates the merge process with built-in checks for target branch and CI status, and requires explicit user approval, providing a controlled and standardized merge workflow.
Compared to similar skills
merge side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| merge (this skill) | 0 | 4mo | Review | Intermediate |
| github-workflow-automation | 11 | 2mo | Review | Advanced |
| testing-workflow | 16 | 9mo | Review | Intermediate |
| github-actions-templates | 7 | 3mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
github-workflow-automation
ruvnet
Advanced GitHub Actions workflow automation with AI swarm coordination, intelligent CI/CD pipelines, and comprehensive repository management
testing-workflow
amo-tech-ai
Comprehensive testing workflow for E2E, integration, and unit tests. Use when testing applications layer-by-layer, validating user journeys, or running test suites.
github-actions-templates
wshobson
Create production-ready GitHub Actions workflows for automated testing, building, and deploying applications. Use when setting up CI/CD with GitHub Actions, automating development workflows, or creating reusable workflow templates.
glab
NikiforovAll
Expert guidance for using the GitLab CLI (glab) to manage GitLab issues, merge requests, CI/CD pipelines, repositories, and other GitLab operations from the command line. Use this skill when the user needs to interact with GitLab resources or perform GitLab workflows.
create-pr
n8n-io
Creates GitHub pull requests with properly formatted titles that pass the check-pr-title CI validation. Use when creating PRs, submitting changes for review, or when the user says /pr or asks to create a pull request.
gh-fix-ci
openai
Use when a user asks to debug or fix failing GitHub PR checks that run in GitHub Actions; use `gh` to inspect checks and logs, summarize failure context, draft a fix plan, and implement only after explicit approval. Treat external providers (for example Buildkite) as out of scope and report only the details URL.