Takeover pr

From gittower/git-flow-next · View interactive version

Takeover pr is an AI agent skill from the GitHub repository gittower/git-flow-next. Take over a stale PR — supersede it with requested changes applied, crediting the original author

How to use this skill

Skill file

Takeover PR

Execute the review response window policy from CONTRIBUTING.md: when a

contributor has not responded to requested changes within 7 days, close

their PR and land a successor PR based on their work with the requested

changes applied on top — crediting them. All public actions (push, new PR,

closing comment) wait for user confirmation.

Arguments

/takeover-pr <pr-number>

Instructions

1. Verify Eligibility — Strictly

Fetch the PR, its reviews, comments, and commits. The takeover is only

legitimate if all of these hold:

changes in its body)

review replies after the review's timestamp. Any author activity — even

"I need more time" — resets the window per CONTRIBUTING.md

If any condition fails, stop and report why (including the exact dates).

Do not proceed on a technicality; when the situation is ambiguous (e.g., the

author reacted with an emoji, or pushed to a different branch), surface it

to the user instead of deciding alone.

2. Preserve the Contributor's Work

git fetch origin pull/<number>/head:takeover/pr-<number>
git checkout main && git pull
git worktree add -b feature/<slug> ../git-flow-next.worktrees/<slug> main
cd ../git-flow-next.worktrees/<slug>

Derive <slug> from the linked issue or PR title, following the usual

branch naming; the worktree uses the sibling-root convention (see

DEV_WORKFLOW.md §3). Then bring in the

contributor's commits:

branch unchanged — original authorship is preserved automatically

COMMIT_GUIDELINES.md): add Co-authored-by: <name> <email> trailers to

every commit that contains their work. Get name/email from

git log --format='%an <%ae>' on their commits

3. Apply the Requested Changes

Use the review-feedback machinery rather than improvising:

  1. Evaluate the review comments exactly as /address-review does (read

.claude/skills/address-review/SKILL.md, steps 4–6): verdict + severity

per comment, written to .ai/pr-<number>/review-plan-<sha>.md

  1. Implement the accepted items on the new branch
  2. Run go build ./... and go test ./...
  3. Commit per COMMIT_GUIDELINES.md — takeover fixes are your commits;

the contributor's credit stays on their preserved commits

4. Local Review

Run /code-review (read the skill) on the new branch vs main. Fix any

must-fix findings before proceeding.

5. Draft the Public Actions

Prepare, but do not execute:

  1. Successor PR title and body (per /pr-summary format), including a

credit paragraph: `This PR supersedes #<number> by @<author>, whose

commits are included <unchanged | with Co-authored-by attribution>. It

adds the changes requested in review. plus Closes #<issue>` for the

underlying issue

  1. Closing comment for the original PR: courteous and factual — thank

the author, link the successor PR, reference the CONTRIBUTING.md

response window policy, invite them to review the successor

  1. Whether CONTRIBUTORS.md needs the author added (check if they're

already listed)

6. Confirmation Gate

Present to the user:

preserved authorship

Ask: "Push, open the successor PR, and close the original?"

7. Execute

After confirmation:

  1. Push the branch with an explicit refspec and set tracking explicitly (a

worktree branch mis-tracks with git push -u, e.g. to main):

```bash

git push origin feature/<slug>:refs/heads/feature/<slug>

git branch --set-upstream-to=origin/feature/<slug> feature/<slug>

```

  1. Confirm the successor PR body passes the /pr-summary Validate Format

checklist, then create the PR (mcp__github__create_pull_request)

  1. Post the closing comment on the original PR

(mcp__github__add_issue_comment), then close it:

gh pr close <number>

  1. Update CONTRIBUTORS.md if drafted in step 5 (commit on the new branch

or main per project practice)

8. Report

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.