Automated summary
Monitors CI status for a pull request, automatically fixes failures, and squash-merges the PR once all checks pass.
Strengths
- Fully automates the squash-merge workflow
- Handles branch switching and restoration of original state
- Intelligently consolidates commit messages for a clean history
- Attempts to auto-fix CI failures before retrying
Limitations
- Requires the 'gh' CLI to be installed and configured
- Automatic CI failure fixes may not always be sufficient without human intervention
- Only works for the current branch's PR or a specified PR number
When you want to reliably merge a PR after ensuring all CI checks pass, avoiding repetitive manual merges.
When you need a complex merge commit or manual code review before merging, or if you lack permissions to push to the remote branch.
Security analysis
CautionThe skill uses git and gh CLI to push and merge changes, which are powerful operations but for legitimate PR management. No destructive or exfiltrating commands are instructed. Potential risk from automated code fixing lies in the AI's interpretation, not the skill itself.
No concerns found
How this analysis is madeExamples
/merge-pr/merge-pr 42name: merge-pr description: | Watch CI checks, auto-fix failures, and squash-merge the PR when all checks pass.
Merge PR When CI Passes
Wait for CI checks to pass, then merge the specified PR with squash.
Usage
/merge-pr <pr-number>
If no PR number is provided, use the current branch's PR.
Instructions
-
Determine target PR and branch:
- Record the current branch:
git branch --show-current - If
$ARGUMENTSis provided (PR number specified):- Get the PR's head branch:
gh pr view <pr-number> --json headRefName -q .headRefName - Compare with current branch
- If different branch:
- Stash all local changes (including untracked):
git stash push -u -m "merge-pr: stashing for PR #<pr-number>" - Switch to PR branch:
git checkout <pr-branch> - Set
SWITCHED_BRANCH=trueandORIGINAL_BRANCH=<current-branch>
- Stash all local changes (including untracked):
- Get the PR's head branch:
- If no
$ARGUMENTS, use the current branch's PR
- Record the current branch:
-
Check uncommitted changes: Run
git statusto check for uncommitted changes:- If there are uncommitted changes, inform the user and ask if they want to commit
- If yes, invoke the
commit-changesskill to create a proper commit
-
Check unpushed commits: Run
git log origin/<branch>..HEAD --onelineto check for unpushed commits:- If there are unpushed commits, inform the user and push them:
git push
- If there are unpushed commits, inform the user and push them:
-
Check for existing PR: Run
gh pr view --json number,url -q '.number' 2>/dev/nullto check if a PR exists for the current branch:- If no PR exists and no
$ARGUMENTSprovided, ask the user if they want to create a PR - If yes, invoke the
pr-pushskill to create the PR, then continue - If no, inform the user that a PR is required and stop
- If no PR exists and no
-
Get PR number: If
$ARGUMENTSis provided, use it as the PR number. Otherwise, get the PR for the current branch:gh pr view --json number -q .number -
Watch CI status: Monitor the CI checks for the PR:
gh pr checks <pr-number> --watch -
Handle CI failures: If any check fails:
- Get the failed check details:
gh pr checks <pr-number> - For each failed check, fetch the logs to understand the error:
gh run view <run-id> --log-failed - Analyze the error and attempt to fix it
- Push the fix and repeat from step 6
- Get the failed check details:
-
Prepare commit message: Before merging, consolidate commit messages:
- Get all commits in the PR:
gh pr view <pr-number> --json commits -q '.commits[].messageHeadline' - Create a consolidated commit message that:
- Uses the PR title as the main message
- Removes duplicate/redundant commit messages
- Keeps unique meaningful changes as bullet points in the body
- Get all commits in the PR:
-
Merge the PR: Once all checks pass, merge with squash:
gh pr merge <pr-number> --squash --delete-branch --body "<consolidated-message>" -
Restore original state or switch to main:
- If
SWITCHED_BRANCH=true(was working on a different branch):- Switch back to original branch:
git checkout <ORIGINAL_BRANCH> - Restore stashed changes:
git stash pop - Inform the user that original branch and changes have been restored
- Switch back to original branch:
- If
SWITCHED_BRANCH=false(was on the PR branch itself):- The PR branch has been deleted, switch to main and pull:
git checkout main && git pull
- The PR branch has been deleted, switch to main and pull:
- If
-
Report result: Show the merge commit and confirm success.
Commit Messages Examples
Example 1: Feature Commit
feat: add JWT token refresh mechanism
Changes:
- Implement automatic token refresh before expiration
- Add refresh token storage in secure cookie
- Include retry logic for failed refresh attempts
Example 2: Bug Fix Commit
fix: prevent null pointer on empty response
Changes:
Handle case where API returns empty body instead of
throwing unhandled exception in response parser.
Example 3: Refactor Commit
refactor: extract common mock to shared helper
Changes:
- Move mockGRPCStreamClient to mock_query.go
- Consolidate 4 duplicate mock implementations
- Reduce test file coupling
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/merge-pr-when-ci-passes-mmio71co/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/merge-pr-when-ci-passes-mmio71co' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/merge-pr-when-ci-passes-mmio71co/download' --output '.skill-downloads/merge-pr-when-ci-passes-mmio71co/SKILL.md.part' && mv '.skill-downloads/merge-pr-when-ci-passes-mmio71co/SKILL.md.part' '.skill-downloads/merge-pr-when-ci-passes-mmio71co/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/merge-pr-when-ci-passes-mmio71co/SKILL.md' && test -s '.skill-downloads/merge-pr-when-ci-passes-mmio71co/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/merge-pr' && cp -R '.skill-downloads/merge-pr-when-ci-passes-mmio71co' '.claude/skills/merge-pr'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/merge-pr-when-ci-passes-mmio71co'openskills read 'merge-pr-when-ci-passes-mmio71co'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/merge-pr-when-ci-passes-mmio71co/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.