Agent skill
merge
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.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/merge-jdenn0514-surveycore
SKILL.md
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:bashgh 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.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?