chore: automate existing PR fixes through repository skills (#15018)

Extract the existing PR review-and-fix workflow into a repository skill and
invoke it from the git-wt hook. Commit and push verified fixes automatically,
then reuse the pull-requests skill to follow CI and review rounds to completion.
Preserve the existing PR status and leave merging to the maintainer.

Move the shared conflict-resolution script into the pull-requests skill.
This commit is contained in:
Zoltan Kochan authored and GitHub committed 2026-09-17 14:33:43 +02:00
1 parent aa8d0ab9af
commit 40677ef2e9
5 files changed
+60 -14

No files matched your search

+1 -1
View File
@@ -125,7 +125,7 @@ check it each time round the loop: `gh pr view <pr> --json mergeable,mergeStateS
is what you see right after a push, so ask again rather than reading it as a
verdict. `BLOCKED` is about required checks and reviews, not conflicts.
Rebase with `./shell/resolve-pr-conflicts.sh <pr>` (documented under "Resolving
Rebase with `./.agents/skills/pull-requests/scripts/resolve-pr-conflicts.sh <pr>` (documented under "Resolving
Conflicts in GitHub PRs" in `AGENTS.md`); it resolves a `pnpm-lock.yaml` conflict
by reinstalling and stops with the file list when a conflict needs you.
@@ -2,8 +2,8 @@
# Resolves merge conflicts for a GitHub PR by rebasing onto the latest base branch.
#
# Usage:
# ./shell/resolve-pr-conflicts.sh <PR_NUMBER> # full run
# ./shell/resolve-pr-conflicts.sh <PR_NUMBER> --continue # finish after manual resolution
# ./.agents/skills/pull-requests/scripts/resolve-pr-conflicts.sh <PR_NUMBER> # full run
# ./.agents/skills/pull-requests/scripts/resolve-pr-conflicts.sh <PR_NUMBER> --continue # finish after manual resolution
#
# Prerequisites:
# - gh CLI authenticated with access to pnpm/pnpm
+54
View File
@@ -0,0 +1,54 @@
---
name: review-and-fix-pr
description: Review and fix an existing pnpm pull request, rebase it, commit and push fixes, then follow CI and review to completion. Use when asked to review and fix a PR or launched by the git-wt PR hook.
---
# Review and fix an existing PR
The supplied PR already exists. Work on its branch, commit and push the fixes,
and follow it until checks are green and the applicable review is complete. Do not pause for the user's review of local fixes.
Read the [pull-requests skill](../pull-requests/SKILL.md) and use its workflow
from "After every push" onward, including its guidance for failing checks,
conflicts, PR descriptions, and review replies. Skip PR creation and draft
management; preserve the existing PR's draft or ready status. This workflow
does not authorize merging the PR.
## Review and fix
1. Use `gh` to read the PR description, full diff, issue comments, review bodies,
and inline review threads. Understand the change's intent and verify each
finding before acting on it.
2. Rebase onto the latest base branch with
`./.agents/skills/pull-requests/scripts/resolve-pr-conflicts.sh <pr>`. Run this even if GitHub reports no
conflicts. The script force-fetches the base and pushes the rebased branch.
If it reports `MANUAL_RESOLUTION_NEEDED`, resolve and stage the listed files,
then run `./.agents/skills/pull-requests/scripts/resolve-pr-conflicts.sh <pr> --continue`. Re-read the diff
after rebasing. A `git-wt` checkout may be named `pr-<pr>`; the script can
switch it to the PR's actual head branch.
3. Address verified review findings and review the full change against
[REVIEW_GUIDE.md](../../../REVIEW_GUIDE.md), with security first and
performance second. Apply the repository and relevant product instructions
and style guides. Check version coverage and changeset requirements.
4. Use the [testing-changes skill](../testing-changes/SKILL.md) to select and
run the checks covering your fixes. Investigate and fix failures.
5. Ensure the repository's git hooks are installed as required by `AGENTS.md`.
Commit your fixes with a Conventional Commit message and push to the PR's
head branch. Preserve any unrelated local changes.
## Finish the existing PR
Every push, including the rebase script's push, starts another CI and review
round. Follow the pull-requests skill's loop, verify new findings, commit and
push corrections, and reply to and resolve review threads after the fixes are
on the remote branch. Keep the PR title and description accurate and sign
agent-authored GitHub content as required by that skill.
For ready PRs, finish only when the checks are green and the reviewers have
reported on the current head with nothing left to act on. For draft PRs,
preserve draft status and finish when checks are green and your own review is
complete. Before finishing, post a signed GitHub PR comment describing the
actual external review status and explaining that draft status was preserved
without starting a new automated review round. List any remaining work, or
confirm that none remains within the requested scope. If an external prerequisite prevents completion, report it concretely. Summarize the fixes, conflicts resolved,
findings declined and why, validation, and final CI and review status.
+1 -9
View File
@@ -15,15 +15,7 @@ esac
command -v "$AGENT_CLI" >/dev/null 2>&1 || exit 0
PROMPT="Review and fix PR #$PR_NUMBER. Steps:
1. Use gh to read the PR description, diff, and all review comments (both PR-level and inline).
2. Understand the intent of the PR and what each change does.
3. Resolve any conflicts with the base branch by running './shell/resolve-pr-conflicts.sh $PR_NUMBER'. This force-fetches the base branch (avoiding stale refs), rebases, and auto-resolves lockfile conflicts. If it prints MANUAL_RESOLUTION_NEEDED, read the listed conflicted files, resolve the conflict markers, run 'git add' on each resolved file, then run './shell/resolve-pr-conflicts.sh $PR_NUMBER --continue' to finish the rebase and push. Do NOT skip this step. Do NOT assume the branch is up to date.
4. Address every review comment — fix the code as requested or as appropriate.
5. Review the changed code with the framework in REVIEW_GUIDE.md (security first, performance second, then correctness) and the documented code conventions for the relevant stack — AGENTS.md and CONTRIBUTING.md for the TypeScript CLI, pnpm/AGENTS.md and pnpm/CODE_STYLE_GUIDE.md or pnpr/AGENTS.md for the Rust stacks. Fix any issues you find in the changed code.
6. Run the relevant tests to verify your fixes work.
7. Give me a summary of what you found and what you changed, including any conflicts you resolved.
Do NOT push. Leave all non-merge changes unstaged for me to review."
PROMPT="Use the review-and-fix-pr skill in .agents/skills/review-and-fix-pr/SKILL.md to review and fix PR $PR_NUMBER. Commit and push the fixes, then follow the existing PR through CI and review using the pull-requests skill."
case "$AGENT_CLI" in
claude)
+2 -2
View File
@@ -374,10 +374,10 @@ checks, and working the review rounds. Two rules hold whether or not it is loade
## Resolving Conflicts in GitHub PRs
Use `shell/resolve-pr-conflicts.sh` to resolve PR conflicts:
Use `.agents/skills/pull-requests/scripts/resolve-pr-conflicts.sh` to resolve PR conflicts:
```bash
./shell/resolve-pr-conflicts.sh <PR_NUMBER>
./.agents/skills/pull-requests/scripts/resolve-pr-conflicts.sh <PR_NUMBER>
```
The script force-fetches the base branch (avoiding stale refs), rebases, auto-resolves `pnpm-lock.yaml` conflicts via `pnpm install`, force-pushes, and verifies GitHub sees the PR as mergeable. For non-lockfile conflicts it will pause and list the files that need manual resolution.