用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/core-nexus/claude-prod --skill pr-merge-main命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | pr-merge-main |
| description | Merge origin's default branch into the current branch (or a PR branch), resolving conflicts thoughtfully |
| disable-model-invocation | true |
| argument-hint | [PR-number-or-branch] |
Merge the latest default-branch tip (origin/main, origin/master, etc.) into a working branch. If a PR number or branch name is provided as $ARGUMENTS, use that. Otherwise, use the current branch.
Determine the default and target branches.
DEFAULT_BRANCH="$(gh repo view --json defaultBranchRef --jq .defaultBranchRef.name)"
$ARGUMENTS is a PR number (digits only): look up the PR's head branch with gh pr view <num> --json headRefName --jq .headRefName.$ARGUMENTS is a branch name: use it directly.$ARGUMENTS is empty: use the current branch (git branch --show-current).$DEFAULT_BRANCH, stop and tell the user — merging the default branch into itself is a no-op.Decide: worktree or in-place.
git worktree list to check if worktrees are supported and the repo is a full checkout (not already inside a worktree or a bare clone with no working tree).git fetch origin "$DEFAULT_BRANCH"
git fetch origin <target-branch>
git worktree add /tmp/merge-main-<branch> <target-branch>
cd /tmp/merge-main-<branch>
git fetch origin "$DEFAULT_BRANCH"
git checkout <target-branch> # if not already on it
Perform the merge.
git merge "origin/$DEFAULT_BRANCH" --no-edit --no-verify
--no-verify skips local pre-commit hooks (husky / lint-staged / etc.) on the merge commit. The files coming in from the default branch were already linted when they landed there, so re-running hooks on them only blocks the merge for issues that already exist on the default branch — not for anything this merge introduces.
If there are conflicts, resolve them thoughtfully:
Merge origin/<default-branch> into <branch>.Push the result.
git push origin <target-branch>
If push fails due to network errors, retry up to 4 times with exponential backoff (2s, 4s, 8s, 16s).
If push fails due to permissions (not a network error — e.g. branch protection, insufficient access):
git checkout -b <target-branch>-merge-maingit push -u origin <target-branch>-merge-mainClean up (if a worktree was used):
cd <original-directory>
git worktree remove /tmp/merge-main-<branch>
Report what happened: which branch was updated, how many commits were merged, whether conflicts were resolved, and the final push status.