---
name: modernise-a-stale-pull-request
description: "Decides whether an old pull request can be brought onto today's base branch, needs a rework, or should be closed, and does the work when it can. Use when an open pull request has gone stale after weeks of base branch changes and someone must decide to update, rework, or close it. Do not use for writing a new pull request or reviewing an active one. Related topics: coding, devops."
---

# Modernise a Stale Pull Request

Decides whether an old pull request can be brought onto today's base branch, needs a rework, or should be closed, and does the work when it can.

## When to use

Use this skill when an open pull request has gone stale after weeks of base branch changes and someone must decide to update, rework, or close it. Do not use it for writing a new pull request or reviewing an active one.

## Workflow

1. Ask the user for each input listed below in a single message, skipping any they have already given. Where options are listed, offer them, but accept other answers too.
2. Check whether the base branch already delivered the goal or removed the affected code.
3. List the conflicts, changed APIs, and dependency drift between the PR and the current base.
4. Estimate how much of the diff needs rewriting and choose Update, Rework, or Close.
5. For an update, merge the base, resolve conflicts keeping intent, adapt changed calls, and rerun the tests.
6. Write a comment for the original author that explains the decision.

## Inputs

- **Pull request** (free text, e.g. "Link or number")
- **Age and original goal** (longer free text)
- **Current base branch** (free text, e.g. "main")
- **Known conflicts or failures** (longer free text)
- **Original author available** (choose one: Yes, No)
- **Preferred outcome** (choose one: Update it, Rework it, Close it, Decide for me)

## Output

A decision of Update, Rework, or Close with evidence, a summary of changes made if updated, the test result, and a comment for the author.

## Prompt template

Fill the inputs into this template and follow it as the full instruction.

### Modernise a Stale Pull Request

Assess an old pull request and bring it up to date if it is worth saving.

- Pull request: {{Pull request}}
- Age and original goal: {{Age and original goal}}
- Current base branch: {{Current base branch}}
- Known conflicts or failures: {{Known conflicts or failures}}
- Original author available: {{Original author available}}
- Preferred outcome: {{Preferred outcome}}

Start with relevance. Check whether the base branch already solved the problem, changed the area, or removed the code. If the goal is already met, recommend closing and say which commit did it. Otherwise compare the PR against the current base and list conflicts, API changes, and dependency drift. Rebase or merge the base in, resolve conflicts keeping the original intent, update code that calls changed APIs, and rerun the tests. If more than about half the diff needs rewriting, recommend a rework as a new branch rather than patching. Give a decision of Update, Rework, or Close with the evidence, describe what changed in the update, and write a short comment for the original author explaining the outcome.

## Pitfalls

- Resolving conflicts mechanically and keeping code the base branch deliberately removed.
- Updating a PR whose goal was already met by another commit.
- Leaving the author without an explanation when closing.
