원클릭으로
merge-queue
Process open PRs — merge when CI passes, handle rebases, file issues for failures. Run in a dedicated window.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Process open PRs — merge when CI passes, handle rebases, file issues for failures. Run in a dedicated window.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
Single entry point for all implementation work. Triages tasks, manages beads issues, delegates to implementer skill, runs reviewers, creates PRs.
Pure development workflow with test-first development and coverage review. Used by coordinator as a subagent. Commits to its own worktree branch, but never pushes, manages beads issues, or opens PRs.
Review PR diff for bugs, error handling gaps, security issues, and API contract mismatches. Spawned by coordinator before PR creation.
Review PR test quality — meaningful coverage, edge cases, integration tests, and test accuracy. Spawned by coordinator before PR creation.
Day-2 training tutor for the agent-friendly-project exercise. Answers student questions about the process, the exercise, the workflow, the concepts from the training, or anything about this repo. Invoked via /tutorial.
Writing, running, and debugging Playwright E2E tests in coding-tool.
| name | merge-queue |
| description | Process open PRs — merge when CI passes, handle rebases, file issues for failures. Run in a dedicated window. |
Process all open PRs. Merge what's ready, rebase what's behind, file issues for failures.
Run this in a dedicated terminal window. Invoke periodically with /merge while other windows do /work.
# Check CI status on main — failing main blocks the entire queue
gh run list --branch main --limit 1 --json status,conclusion
# List open PRs. Drafts are excluded — `isDraft: true` is an explicit
# author signal of "not ready for merge", and some long-lived draft PRs
# may exist as deploy targets that must never be merged or rebased by this skill.
gh pr list --json number,title,headRefName,statusCheckRollup,mergeable,body,reviewRequests,reviews,labels,isDraft \
--jq 'map(select(.isDraft | not))'
If main CI is failing: file a P0 beads issue (if one doesn't already exist), report prominently, and stop. Nothing can merge until main is green.
bd create "CI failing on main: <summary>" -t bug -p 0 --json
For each PR, determine its state:
| State | Action |
|---|---|
CI passing, mergeable, no pending review, no needs-human-review label | Merge |
CI passing, mergeable, needs-human-review label, not approved | Skip, report "awaiting human review" |
| CI passing, mergeable, review requested but not approved | Skip, report |
| CI passing, mergeable, review approved | Merge |
| CI pending | Skip, report status |
| CI failing | File issue, report |
| Not mergeable (behind main) | Attempt rebase |
When multiple PRs are ready, use judgment to balance:
Before merging each PR, inspect its commits to decide how to merge:
gh pr view <number> --json commits --jq '.commits[] | "\(.oid[:8]) \(.messageHeadline)"'
Pick one of three strategies:
| Strategy | When to use | Command |
|---|---|---|
| Squash | All commits serve a single logical change, OR commits are messy/WIP (fixups, "wip", "try again", etc.) | gh pr merge <number> --squash |
| Merge | Commits represent distinct, well-structured concerns (e.g. "add handler" + "add tests" + "update docs") that are valuable to preserve individually | gh pr merge <number> --merge |
| Rebase cleanup | Commits mix good structure with noise — some are worth preserving but others should be squashed together. Use sparingly — only when clearly beneficial. | Rebase in worktree, force-push, wait for CI, then gh pr merge <number> --merge |
Decision guide:
When in doubt, squash. A clean single commit is always better than a messy multi-commit history.
For each mergeable PR (in priority order), using the chosen strategy:
gh pr merge <number> --squash|--merge # per Step 4
After each merge:
Beads: id1, id2 line)bd close <id> --reason "Merged in PR #<number>" --json
Closes #<number> lines — GitHub auto-closes those issues on merge. Include them in the summary.git worktree remove ../<project>-<branch-name> 2>/dev/null
git branch -d feature/<branch-name> 2>/dev/null
git pull origin main
Important: after each merge, re-check remaining PRs — merging one PR may make others unmergeable (need rebase) or may resolve conflicts.
When a PR is not mergeable (behind main):
Locate or create a worktree for the PR branch:
# Use existing worktree if present, otherwise create one
git worktree add ../<project>-rebase-<number> <branch>
Try fast-path rebase first (inline bash — no subagent):
cd ../<project>-rebase-<number>
git fetch origin main
git rebase origin/main && echo "REBASE: OK"
If fast-path succeeds: force-push and proceed to CI polling.
git push --force-with-lease
If fast-path fails (conflict): abort and spawn the rebase subagent:
git rebase --abort
Then spawn with context:
ROLE: Rebase Agent (Conflict Resolution)
SKILL: Read and follow .claude/skills/rebase/SKILL.md
SOURCE: <branch>
TARGET: origin/main
WORKTREE: ../<project>-rebase-<number>
CLEANUP: false
PR_NUMBER: <number>
On RESULT: PASS: force-push the rebased branch, then wait for CI to finish and merge (see below).
cd ../<project>-rebase-<number>
git push --force-with-lease
On RESULT: FAIL: file a beads issue describing the conflict using details from the sub-agent output, and report to the user.
bd create "Rebase conflict on PR #<number>: <summary>" -t bug -p 1 --json
Include in the issue body: which files conflicted, why the conflict is ambiguous, and the PR reference.
After a clean rebase, poll CI and merge when it passes. Don't just report "rebased, CI re-running" and stop — unmerged PRs accumulate conflicts. Poll every 60 seconds until CI completes:
# Poll until all checks finish
gh pr checks <number> --watch
# Then merge (using strategy from Step 4)
gh pr merge <number> --squash|--merge
If CI fails after the rebase, follow Step 7 (file an issue). But if it passes, merge immediately — don't wait for the user to re-run /merge.
Test failures are real. Never rerun. Never ignore.
When CI fails on a PR:
gh pr checks <number>
gh run view <run-id> --log-failed
bd create "CI failure on PR #<number>: <summary>" -t bug -p 1 --json
After processing all PRs, output a summary:
Merge Queue Summary:
- PR #12: Merged (closed bd-abc, bd-def, GitHub #45)
- PR #15: CI passing, awaiting your review
- PR #18: Rebased, CI re-running
- PR #20: CI failing — filed bd-xyz
- PR #22: CI pending (2/3 checks done)
Action needed:
- bd-xyz: Test failure on PR #20, needs /work bd-xyz
- PR #15: Awaiting your review on GitHub
Always include beads issue IDs so the user can dispatch /work for fixes.
If there are no open PRs, report "No open PRs."
/work instead)