Skip to content

Instantly share code, notes, and snippets.

@DMontgomery40
Created March 13, 2026 09:27
Show Gist options
  • Select an option

  • Save DMontgomery40/e47f410b8b6a2536b3313eb4212f1d0b to your computer and use it in GitHub Desktop.

Select an option

Save DMontgomery40/e47f410b8b6a2536b3313eb4212f1d0b to your computer and use it in GitHub Desktop.
PR loop skill bundle
interface:
display_name: "PR Loop"
short_description: "Run the full PR review and merge loop"
default_prompt: "Use $pr-loop to open or update the current branch PR, loop on review and CI until clear, then merge and verify deploy."
policy:
allow_implicit_invocation: false

Use the $pr-loop skill for the current repository and current branch.

Stay in the loop until the PR is merged and the 3-minute post-merge verification is complete, unless a real blocker requires user input.

name description
pr-loop
Run the full GitHub pull request loop for the current branch, including review waits, fix and amend cycles, merge, and post-merge verification.

PR Loop

Overview

Run the whole PR lifecycle without dropping the follow-through steps. Use this skill when the user wants a repeatable "open PR, wait, inspect review, fix, recheck, merge, verify deploy" loop for the current branch.

Prerequisites

  • The repo must be hosted on GitHub and gh must be available.
  • If gh auth status shows the user is not logged in, stop and ask them to authenticate before continuing.

Workflow

  1. Inspect the current state first.

    • Confirm the current branch, remote, and whether a PR already exists for the branch.
    • Respect unrelated dirty-worktree changes. Do not revert user work.
  2. Publish or update the PR.

    • If no PR exists, create one against main.
    • As soon as the PR exists, show the PR URL to the user.
    • If there are changes to commit, use a commit message that includes @codex review.
    • If the loop later requires more fixes, amend the existing commit when practical and keep @codex review in the amended commit message.
  3. Turn on merge automation when possible.

    • Prefer auto-merge if the repository allows it.
    • If auto-merge cannot be enabled yet because review or checks are still pending, retry after each clean update.
  4. Wait before checking review results.

    • After opening the PR, or after any amended push, use a real 5-minute wait (sleep 300 or equivalent).
    • Do not short-circuit this into rapid polling unless the user explicitly asks for a faster loop.
  5. Read the blockers, not just the summary.

    • Inspect Codex review output, PR review comments, inline comments, and gh pr checks.
    • Treat review-identified bugs and failing required checks as blockers.
    • If comments or checks imply a concrete fix, implement it rather than stopping at a report.
    • Use gh directly, or bring in $gh-address-comments or $gh-fix-ci if that is the fastest way to clear the blockers.
  6. Fix, verify, amend, and push.

    • Apply the smallest safe fix that clears the blocker.
    • Run the narrowest relevant local verification before pushing.
    • Amend the existing commit when practical so the PR stays as one evolving change.
    • Preserve @codex review in the amended commit message.
    • After amending, push with --force-with-lease.
  7. Repeat until the PR is truly clear.

    • Continue the loop until all of these are true:
      • no unresolved Codex review bugs remain
      • no required PR checks are failing or pending
      • the PR is mergeable or already queued for auto-merge
  8. Merge and verify after merge.

    • Merge once the PR is clear, or confirm that auto-merge actually completed.
    • After the PR merges, wait 3 minutes (sleep 180 or equivalent).
    • Re-check the merged PR status plus any available GitHub build or deploy signal.
    • If the post-merge build or deploy failed, report that clearly and continue with remediation instead of declaring success.

Operating Rules

  • Keep going autonomously inside the same turn until the PR is merged or a real blocker appears.
  • Do not create extra commits for tiny review fixes when an amend is sufficient.
  • Do not claim success while review, CI, auto-merge, merge completion, or post-merge health is still unresolved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment