Skip to content

Add a merge skill#31

Open
koomen wants to merge 2 commits into
mainfrom
merge-queue-skill
Open

Add a merge skill#31
koomen wants to merge 2 commits into
mainfrom
merge-queue-skill

Conversation

@koomen

@koomen koomen commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Adds .claude/skills/merge/SKILL.md/merge 28, or /merge for the current branch's PR.

  1. Rebase onto latest main in a worktree, force-push with lease. Rebase, never merge-from-main — a merge commit would mean fable reviewed a tree that never existed. Conflicts that aren't mechanical get handed back rather than guessed at.
  2. Adversarial review — two parallel claude-fable-5 subagents, one on defects (correctness, security, regressions), one on AGENTS.md invariant conformance. Both are told to hunt for reasons not to land it. The driver writes the fixes; the reviewers are a different model, because a model reviewing its own fixes is not an adversarial review.
  3. Triage, then fix — findings are confirmed against real control flow before acting, since adversarial reviewers over-report. Fix, bun run ci, push, re-review. Three rounds, then it stops and reports.
  4. Merge once ci is green on the pushed head.

Asks for approval once up front, then runs through to the merge without further prompting.

No labels, no queue, no CI credentials — it runs in your session with the auth you already have.

🤖 Generated with Claude Code

@koomen koomen changed the title Add a merge-queue skill Add a merge queue that runs in GitHub Actions Jul 24, 2026
Lands one PR: rebase onto latest main, review it adversarially with two
fable subagents (defects, and AGENTS.md invariant conformance), triage
and fix the findings, gate on `ci`, merge.

Rebase rather than merge-from-main, so the tree fable reviews is the tree
that lands. The driver writes the fixes and the reviewers run on fable —
a model reviewing its own fixes is not an adversarial review. Findings
are confirmed against real control flow before acting, since adversarial
reviewers over-report. Three fix rounds, then it stops and reports.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@koomen
koomen force-pushed the merge-queue-skill branch from 7ed4c2d to d9ef2df Compare July 24, 2026 19:23
@koomen koomen changed the title Add a merge queue that runs in GitHub Actions Add a merge skill Jul 24, 2026
Round-1 adversarial review found the runbook would fail in practice.
Fixed, in order of severity:

- Pin the reviewed SHA and merge with `--match-head-commit`, so a commit
  pushed after the review cannot land unreviewed. Re-check that main has
  not moved before merging.
- Reorder cleanup: a branch checked out in a worktree cannot be deleted,
  so `--delete-branch` failed on every run. Remove the worktree first,
  then delete the branch explicitly.
- Fetch the PR branch, not just main; `git worktree add` needs the ref.
- `bun install` in the worktree before `bun run ci` — a fresh worktree
  has no node_modules.
- Give the reviewers the checkout directory. A subagent starts in the
  session cwd, so a reviewer that is not told where to look diffs the
  wrong tree and reports nothing.
- Handle the branch already being checked out, including in the primary
  checkout, where `git worktree add` refuses outright.
- Require the PR base to be main; rebasing a stacked PR onto main would
  rewrite it and split the review target from the merge destination.
- Only remove a worktree this skill created; a reused one may be a
  long-lived checkout the user is sitting in.
- Derive the worktree path from the repo root instead of hardcoding a
  home directory into a shared repo file.
- Use the `fable` model alias; the Agent tool takes sonnet|opus|haiku|fable,
  not a full model ID.
- Defer to the check-invariants skill instead of restating it, per the
  standing rule against duplication that can drift.
- Note that `gh pr checks` errors rather than waits before a run registers.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant