docs(agents): add rebase-pr skill for rebasing and restacking PRs (#102178)
### What?
This PR adds a `rebase-pr` skill (`.agents/skills/rebase-pr/SKILL.md`)
for rebasing a Next.js PR onto canary or restacking dependent PRs. It
covers:
- fetching canary with an explicit refspec and deepening shallow clones;
- checking that canary is green before rebasing onto it;
- listing all conflicts before classifying them;
- what to re-verify after a clean rebase: new lint rules, compile
errors, snapshots, `pnpm-lock.yaml`, generated files;
- force-pushing with the lease pinned to the inspected SHA;
- restacking bottom-up with `git rebase --onto`;
- how `gh stack` behaves in this repository.
`create-pr` now links to the new skill. In the root `AGENTS.md`, the
skill is listed under Specialized Skills, and a redundant
cross-reference line is removed, so the root does not grow.
### Why?
Rebasing Next.js PRs kept going wrong in the same ways:
- plain rebases in shallow clones produced thousands of add/add
conflicts;
- PRs were rebased onto a canary that didn't compile;
- conflict lists were truncated, so source conflicts were missed;
- old PR code failed newly added lint rules after a "clean" rebase;
- lockfiles drifted;
- one middle stack layer broke formatting for every layer above it.
The vendored `gh-stack` skill covers generic commands; this skill adds
what is specific to this repository.
### How?
The root `AGENTS.md` shrinks from 550 to 549 lines. The vendored
`gh-stack` skill is unchanged.
| Theme | Where it went |
| --- | --- |
| Refetch canary with an explicit refspec, deepen shallow clones |
"Before rebasing" |
| Check that canary compiles and is green first | "Before rebasing" |
| New lint rules, lockfile, snapshots, generated files after a clean
rebase | "Verify" |
| Lease-pinned force-push, never overwrite others' commits | "Push
safely" |
| `rebase --onto` for children, fmt and lint on every layer, ancestry
checks | "Restack dependent PRs" |
| `gh stack link` / `submit` / `view` behavior, PR Stack CI Gate | "`gh
stack` in vercel/next.js" |
| Dropped: tool-environment-specific push mechanics | Not specific to
this repository |
| Dropped: squash-rebasing as a default | History rewrites now need the
PR owner's approval |
Related draft PRs from the same pass: CI reading in `pr-status-triage`,
`run-tests`, and `rust-turbopack`. This PR has no dependency on them.
### Verification
- Prettier 3.6.2 `--check` and alex 9.1.0 on the new skill file
- Root `AGENTS.md`: 549 lines vs. 550 on canary
- Not run: rebase commands against live branches (documentation-only
change)
<!-- NEXT_JS_LLM -->
<!-- fleet ecad2aa1-2fed-4a45-9391-10cce92387cc -->
---------
Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>