Backport de PR vers branche release Next.js

VérifiéPrudence

Backport d'une PR Next.js fusionnée de canary vers une branche release via git cherry-pick et création d'une PR avec la bonne base.

Spar Skills Guide Bot
DeveloppementIntermédiaire
29/08/2026
Claude Code
#backport#cherry-pick#git#release-branches#pull-requests

Recommandé pour

Synthèse automatique

Automatise le backport d'une pull request Next.js déjà fusionnée depuis canary vers une branche de release plus ancienne, en cherry-piquant le commit et en ouvrant la PR de backport.

Points forts

  • Décrit un workflow git complet et ordonné : vérification du worktree, fetch, identification du commit de merge, création de branche, cherry-pick avec -x, validation, ouverture de PR
  • Traite explicitement la sécurité de l'état git de l'utilisateur (ne pas écraser, reset ou stash sans accord) et demande la branche cible si elle n'est pas fiable
  • Gère les cas limites : cherry-pick vide (changement déjà présent), conflits à résoudre en faveur des contraintes de compatibilité de la branche de release, merge commit GitHub inutilisable
  • Précise les commandes de vérification les plus étroites selon les fichiers touchés et force la base de la PR sur la branche de release plutôt que canary

Limites

  • Fortement lié au dépôt vercel/next.js et à ses conventions (canary, pnpm build-all, branches next-16-2) ; peu réutilisable tel quel ailleurs
  • Suppose que gh est authentifié et que l'utilisateur a les droits pour pousser et ouvrir une PR
  • Dépend de la skill $create-pr, qui n'est pas décrite ici
Quand l'utiliser

À utiliser quand une PR Next.js déjà fusionnée sur canary doit être reportée sur une branche de release existante comme next-16-2.

Quand l'éviter

À éviter pour des backports sur d'autres dépôts ou pour des cherry-picks vers une branche dont la validation et les tests ne peuvent pas être exécutés.

Analyse de sécurité

Prudence
Score qualité85/100

The instructions are limited to standard, transparent git/gh workflow steps for backporting a merged PR. There is no destructive command, no credential or secret handling, no obfuscated payload, and no attempt to disable safety. It explicitly tells the agent to inspect `git status` and not to overwrite, reset, or stash unrelated user changes without consent. The residual risk is ordinary: it mutates git/remote state and opens PRs, which warrants a caution rather than safe rating, but nothing here is malicious or exfiltrating.

Points d'attention
  • •Skill drives mutating git operations on the user's worktree and remote: branch creation, cherry-pick, and (via $create-pr) pushing a branch and opening a PR
  • •Uses network-fetching CLIs (git fetch, gh pr view) against vercel/next.js
  • •No allowed-tools declared, so an agent may treat arbitrary shell commands as in scope
Comment cette analyse est faite

Exemples

Backport to next-16-2
Backport PR #74219 to next-16-2: cherry-pick it from canary, run the relevant checks, and open a draft backport PR against the release branch.
Backport without tests
Cherry-pick merged PR #73980 onto next-16-3 and open the draft backport PR — skip the integration tests, just prepare the cherry-pick and PR.
Check for duplicate backport
Can you backport PR #74502 to next-16-2? If the change is already on that release branch, tell me instead of opening a PR.

name: backport-pr description: > Backport a merged Next.js pull request from canary to a previous release branch such as next-16-2. Use when the user asks to backport, cherry-pick, or open a backport PR from a PR number to an older Next.js version. Covers finding the merged PR commit, creating a backport branch from the target release branch, cherry-picking from canary, validating, and opening the PR with the release branch as the base. metadata: internal: true

Backport PR

Use this skill when a user asks to backport a merged Next.js PR to a release branch.

Inputs

  • Require a PR number and a target release branch, for example next-16-2.
  • If the target branch is not provided and cannot be inferred confidently from the user's request, ask before mutating git state.
  • Treat the target branch as variable; do not hard-code next-16-2 except when the user explicitly asks for it.

Workflow

  1. Inspect the current worktree before changing branches:

    git status --short
    git branch --show-current
    

    Preserve unrelated user changes. Do not overwrite, reset, or stash them without the user's consent.

  2. Sync the source and target branches:

    git fetch origin canary:refs/remotes/origin/canary <target-branch>:refs/remotes/origin/<target-branch>
    
  3. Identify the commit that landed the PR on canary:

    gh pr view <pr-number> --repo vercel/next.js --json number,title,state,url,mergeCommit,baseRefName,headRefName
    git log origin/canary --oneline --fixed-strings --grep="(#<pr-number>)"
    

    Prefer mergeCommit.oid when the PR is MERGED and the commit is contained in origin/canary. If GitHub does not return a usable merge commit, use the git log --grep result and verify the commit subject references the PR number.

  4. Create the backport branch from the release branch:

    git switch -c backport-<pr-number>-to-<target-branch> origin/<target-branch>
    

    After switching branches in this repo, run pnpm build-all before Next.js integration tests unless the user explicitly limits the task to preparing the cherry-pick or PR.

  5. Cherry-pick the landed commit with provenance:

    git cherry-pick -x <merged-commit-sha>
    

    Resolve conflicts in favor of preserving the release branch's compatibility constraints. If the cherry-pick is empty, verify whether the change is already present on the release branch and report that instead of opening a duplicate PR.

  6. Verify with the narrowest commands that cover the touched files. Prefer focused tests, pnpm types for TypeScript-only risk, and the relevant integration test mode for behavior changes.

  7. Open the backport PR using $create-pr.

    Override the normal $create-pr base branch: use --base <target-branch>, not canary. Keep the PR as a draft unless the user explicitly asks otherwise.

PR Shape

Use a title like:

[backport] <original PR title>

Use a concise PR body:

Backports <original PR title/link> to `<target-branch>`.

<!-- NEXT_JS_LLM -->

Related Skills

  • $create-pr - Create the branch commit, push it, and open the draft PR.
  • $pr-status-triage - Check CI failures or review feedback after the PR exists.

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/backport-pr-to-next-js-release-branch-mte1lkjw/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/backport-pr-to-next-js-release-branch-mte1lkjw' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/backport-pr-to-next-js-release-branch-mte1lkjw/download' --output '.skill-downloads/backport-pr-to-next-js-release-branch-mte1lkjw/SKILL.md.part' && mv '.skill-downloads/backport-pr-to-next-js-release-branch-mte1lkjw/SKILL.md.part' '.skill-downloads/backport-pr-to-next-js-release-branch-mte1lkjw/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/backport-pr-to-next-js-release-branch-mte1lkjw/SKILL.md' && test -s '.skill-downloads/backport-pr-to-next-js-release-branch-mte1lkjw/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/backport-pr' && cp -R '.skill-downloads/backport-pr-to-next-js-release-branch-mte1lkjw' '.claude/skills/backport-pr'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/backport-pr-to-next-js-release-branch-mte1lkjw'

openskills read 'backport-pr-to-next-js-release-branch-mte1lkjw'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/backport-pr-to-next-js-release-branch-mte1lkjw/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires