Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

backport

БесплатноБез исполняемых скриптовНе проверен

Use this skill when backporting a merged CPython change to a maintenance branch (3.14, 3.13, etc.) - whether invoked as /cpython:backport <version> [PR]…

gpsheadот gpshead★ 21 звезда на GitHub

Об этом скилле

Backporting CPython Changes

Do what cherry_picker (the tool behind the miss-islington bot) does, but intelligently: when the cherry-pick conflicts, adapt the change to the maintenance branch's own idioms instead of giving up. The output must be indistinguishable in form from an automated backport - same branch naming, same commit message format, same PR style - so the bots and human workflows built around cherry_picker keep working.

Inputs

From the invocation (e.g. /cpython:backport 3.13 https://github.com/python/cpython/pull/12345) or conversation, determine:

  • Target maintenance branch (e.g. 3.13). If not given, check the original PR's needs backport to X.Y labels and ask which one(s) to do. For multiple targets, work newest-first: each completed backport becomes the cherry-pick source for the next older branch (step 3), so the resolutions worked out for 3.14 carry down to 3.13 instead of being rediscovered.
  • Source change: a PR URL/number, or a commit sha on main. Given only an issue number, find the merged PR that closed it.
  • Branch support phase: confirm the target branch accepts this kind of change (devguide versions table). A branch in security-only phase takes security fixes exclusively, with release-manager signoff - if the target is past bugfix support and this isn't a security fix, stop and ask rather than prepare a PR the release manager will close.

Workflow

1. Gather facts about the original change

gh pr view <N> --repo python/cpython --json number,title,author,mergeCommit,labels,url
git log -1 --format=%B <merge-sha>   # full original commit message

Confirm the PR actually merged (mergeCommit non-null) - an open or closed-unmerged PR has nothing valid to backport. Given only a commit sha, recover the PR number from the (GH-N) suffix of its squash-merge title; the commit message format in step 4 depends on it.

Fetch upstream main first if the merge commit isn't local. Then look for sibling backport PRs:

gh pr list --repo python/cpython --state all --search '"GH-<N>" in:title'

A merged backport to a newer branch (e.g. the 3.14 backport when you're targeting 3.13) is more than a template: its merge commit already embodies the conflict resolutions needed to move the change one branch away from main, so prefer it as your cherry-pick source (step 3), fetching that maintenance branch so the commit is local — an older backport should never have to relearn what the newer one already worked out. It also supplies the commit message and PR body to mirror. A failed miss-islington attempt tells you exactly where the conflicts are.

2. Prepare the target branch

Work in a checkout of the maintenance branch - check git worktree list and sibling directories (e.g. ../3.13) before creating anything new. Sync it first:

git fetch upstream <version>
git checkout -b backport-<sha7>-<version> upstream/<version>

<sha7> is the first 7 characters of your source commit - the squash-merge on main, or the newer branch's backport merge commit when you're basing on one (step 3). This matches what cherry_picker itself would produce when run against that commit - do not deviate from the backport-<sha7>-<version> shape.

3. Cherry-pick and resolve conflicts intelligently

Choose the source commit closest to your target. Maintenance branches diverge from main progressively, so when a newer branch's backport of this change has already merged, cherry-pick that backport's merge commit instead of the original commit on main - the adaptations made for 3.14 carry the change most of the way to 3.13, often turning a conflicted pick into a clean one. Use the main commit only when no newer merged backport exists.

git cherry-pick -x <source-sha>

Conflicts are where you add value over the automated tool. For each conflicted hunk:

  • Understand why it conflicts: the maintenance branch may predate a refactor. Common cases: helper APIs that don't exist yet (*_LockHeld variants, _Py*_CAST macros from free-threading work), functions later converted to Argument Clinic, test files split into packages (test_os.py vs test_os/), renamed or moved files.
  • Regenerate, don't hand-merge, generated files. For conflicts in generated artifacts (Argument Clinic output, configure, frozen modules, pycore_global_strings.h and kin), resolve the source-of-truth file and rerun the target branch's own generator (make regen-*; for configure, the autoconf setup that branch pins). Hand-merged generator output can look clean yet fail the make regen-all consistency check in CI.
  • Doc/whatsnew/ conflicts have a standard answer. An entry in main's whatsnew file can't apply where that file doesn't exist: if the change is user-visible on the target branch, move the entry into that branch's own current whatsnew file; otherwise drop the hunk.
  • **Translate the fix into the target branch's exi
Полный SKILL.md на GitHub

Установить backport в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл backport?

Use this skill when backporting a merged CPython change to a maintenance branch (3.14, 3.13, etc.) - whether invoked as /cpython:backport <version> [PR], asked to backport or cherry-pick a fix from main, or handling a failed automated miss-islington backport. Produces a cherry_picker-convention branch and offers to open the backport PR.

Как установить скилл backport?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл backport запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить backport с