auto-merge
БесплатноБез исполняемых скриптовНе проверенAutomatically merge open PRs that have passing CI, no blocking reviews, and no conflicts
от aeonfun★ 801 звезда на GitHubОб этом скилле
${var} — Repo (owner/repo) to target. If empty, uses every repo in memory/watched-repos.md. Env:
AUTO_MERGE_DRY_RUN=1logs intent without merging.MAX_AUTO_MERGE=Ncaps merges per run (default 3).
Merge open PRs that are fully green and pass an explicit safety policy. The policy exists because this skill runs autonomously with write access — a bug in the gate is a bug that ships to main.
Read memory/MEMORY.md and memory/watched-repos.md for repos to target. Read the last 2 days of memory/logs/ to avoid re-logging PRs already merged.
Safety policy
A PR merges only when every one of the following holds:
- Author allowlist:
author.loginis one ofdependabot[bot],renovate[bot],github-actions[bot], OR appears under a## Trusted Authorssection in memory/watched-repos.md. No allowlist → only the three bot logins are eligible. - Size cap:
additions + deletions ≤ 500. Override by applying the labelauto-merge-largeon the PR. - Base branch:
baseRefNameismainormaster. Refuse any other target. - Not a fork:
isCrossRepository == false(fork CI can be tampered with). - Not draft:
isDraft == false. - Not already queued:
autoMergeRequest == null(avoid fighting GitHub's native auto-merge if a human enabled it) and the PR is not already in a merge queue (mergeQueueEntry == null, checked in step 2b). - No opt-out label: none of {
do-not-merge,wip,hold,needs-review,blocked} present. - Mergeable state:
mergeStateStatus == "CLEAN"(this is stricter thanmergeable == "MERGEABLE"— CLEAN additionally requires branch-protection gates to be satisfied). - Reviews:
reviewDecision != "CHANGES_REQUESTED". - Checks: every entry in
statusCheckRolluphasconclusionin{SUCCESS, NEUTRAL, SKIPPED}. AnyFAILURE,TIMED_OUT,CANCELLED,PENDING, ornullconclusion disqualifies the PR. - Retry cap: this PR has been attempted fewer than 3 times. A PR that has hit
MERGE_FAILthree times across runs is paused — repeated failure on a CLEAN-looking PR usually means something subtle (a required check that didn't surface, branch-protection drift, token scope drift). Surface it and stop looping.
Steps
Bootstrap state — per-PR retry counter lives in
memory/topics/auto-merge-state.json:mkdir -p memory/topicsThen check for
memory/topics/auto-merge-state.jsonwith Glob; if it is missing, create it with the Write tool holding{"prs":{},"last_run":null}(a[ -f ] ||test and anecho ... > fileredirect are both refused in this run). Schema:{ "last_run": "2026-05-23T08:00:00Z", "prs": { "owner/repo#123": { "first_seen": "2026-05-21T10:00:00Z", "last_attempt": "2026-05-23T08:00:00Z", "attempts": 2, "last_outcome": "merge_failed", "last_error": "Pull Request is in unstable state" } } }PR keys are
<owner>/<repo>#<number>so state survives multi-repo runs. Cap to 50 most-recent entries (LRU bylast_attempt). Validate withjq emptyafter write; restore from.bakon failure.List open PRs for each watched repo with the full field set:
gh pr list -R owner/repo --state open --json number,title,author,isDraft,mergeable,mergeStateStatus,reviewDecision,statusCheckRollup,autoMergeRequest,isCrossRepository,labels,additions,deletions,baseRefNameHandle UNKNOWN state — GitHub computes
mergeStateStatuslazily. If a PR returnsUNKNOWN, sleep 3 seconds and re-query once:sleep 3 && gh pr view NUMBER -R owner/repo --json mergeStateStatus,mergeable,statusCheckRollupIf still UNKNOWN after the retry, skip the PR with reason
UNKNOWN-persistentand let the next run retry.2b. Skip PRs already in a merge queue. A PR this skill queued on an earlier run is still open, so it would be merged again, bump
attempts, and hit the retry cap while it waits.gh pr listdoes not expose the queue, so ask GraphQL per PR:gh api graphql -f query='query($o:String!,$r:String!,$n:Int!){repository(owner:$o,name:$r){pullRequest(number:$n){mergeQueueEntry{state}}}}' \ -f o=owner -f r=repo -F n=NUMBER --jq '.data.repository.pullRequest.mergeQueueEntry.state // ""'A non-empty state (e.g.
QUEUED,AWAITING_CHECKS,MERGEABLE) skips the PR asSKIP:already-queued:<state>. A failed lookup skips it asSKIP:merge-queue-unknown. Neither counts as an attempt: do not touch itsattempts, and leave its state entry as is.Apply the safety policy to each PR. Record a verdict for every PR: either
MERGEorSKIP:<specific-reason>. Reasons must name the failing gate — e.g. `SKIP:au
Установить auto-merge в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл auto-merge?
Automatically merge open PRs that have passing CI, no blocking reviews, and no conflicts
Как установить скилл auto-merge?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл auto-merge запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
ci-review
The scan that the plugin's GitHub Action runs.
от Anthropicazure-static-web-apps
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
от GitHubai-ready
Make any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
от GitHubaws-cdk-python-setup
Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…
от GitHub