--- name: driving-prs-to-merge description: Owns the entire post-open PR lifecycle in a multi-agent GitHub repo — enabling and re-arming auto-merge, reading mergeStateStatus correctly, triaging CI failures from per-job logs, classifying transient vs real failures, resolving bot and human review threads (including the async-bot orphan trap), rescuing DIRTY/conflicted PRs, operating merge queues, handling pre-existing red CI, and dispatching fresh-context peer review. Use whenever a PR has been opened and must reach merge, a PR is stuck (green-but-not-merging, BLOCKED, DIRTY, booted from a merge queue), CI on a PR is red, auto-merge "mysteriously dropped", review threads need handling, or any agent encounters failing CI — even if the user only says "why isn't my PR merging", "CI is red", "fix this PR", or "the queue looks broken". --- # Driving PRs to Merge After opening any PR, the opener owns driving it to merge. No waiting for a human nudge. The loop exit condition: all required checks green AND every review thread resolved — auto-merge then fires on its own. Everything below exists to get to that state cheaply and honestly. ## Project bindings This skill is project-agnostic. The adopting project defines these in its own CLAUDE.md; refer to them by placeholder throughout. | Placeholder | Meaning | |---|---| | `/` | GitHub repository slug | | `` | Branch PRs target (may differ from the repo default branch — see "After merge") | | `` | Allowed strategy flag (`--squash`, `--merge`, `--rebase`) — and whether a **merge queue** is enabled (changes the command, see below) | | `` | The full local verification command CI will mirror (lint + typecheck + tests), ideally scoped to changed packages + dependents | | `` | Where feature branches live on disk (see the dispatching-subagents skill) | | `` | AI review bot identity (if any), whether it reviews sync or async, and whether the ruleset enables `required_review_thread_resolution` | | `` | Names of merge-gating CI checks | | `` | Location of the failure-pattern catalog (maps check-name → likely cause → fix recipe → evidence PR#) | | `` | Where known-flaky jobs are tracked (e.g. a scheduled workflow posting to a pinned issue); absent → degrade to "retry twice on same SHA" | | `` | Per-PR preview-environment workflow, if any, and its **path filter** | | `` | Acknowledgment labels/annotations that breaking-change gates honor | | `` | Generated files (lockfiles, operation manifests) + their regeneration commands | | `` | Shared append-only files (changelogs, learnings logs) that conflict trivially | | `` | The human-only AI-action mention string (e.g. `@claude`), if the repo has one | | `` | Who may force-push feature branches (some environments permission-block sub-agents; orchestrator performs with operator authorization) | | `` | Commit message format; see the dispatching-subagents skill for the canonical definition | ## The PR-open ritual Run all three immediately after opening, as one atomic ritual: ```bash gh pr create --base --title "" \ --body "<... Closes #N ...>" \ --assignee "$(gh api user --jq .login)" gh pr view --json assignees,labels # verify assignee landed gh pr merge --auto # merge queue active? OMIT the strategy flag — see below ``` If the assignee or required labels did not land, repair via the REST API: ```bash gh api -X POST repos///issues//assignees -f "assignees[]=" gh api -X POST repos///issues//labels -f "labels[]=