stacking-prs
Что он делает
Этот скилл показывает ИИ, как создавать и вести стеки pull request на GitHub с помощью инструмента командной строки gh stack. Он предназначен для разработчиков, которые хотят разбить большое изменение на небольшие слои, которые легче проверить.
Когда использовать
- ✓Когда изменение кода слишком велико для проверки в одном pull request и его нужно разбить на слои.
- ✓Когда нижний pull request в стеке меняется и слои над ним нужно обновить.
- ✓Когда нужно влить стек pull request в правильном порядке.
Ссылка на скилл
https://github.com/PostHog/posthog/blob/master/.agents/skills/stacking-prs/SKILL.mdСкопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.
Как использовать
Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.
Готовое сообщение для вставки
Для Claude Code, Codex или Cursor: запустите в папке проекта, и скилл установится.
Скачайте SKILL.md и положите его в папку скиллов вашего агента.
Пример запроса к вашему ИИ
“Разбей мою большую ветку с функцией на стек небольших pull request, которые я смогу проверять по одному.”
5 новых скиллов в неделю. 1 минута чтения.
Как это работает
Стек — это упорядоченная цепочка, где каждый pull request опирается на тот, что ниже. ИИ использует инструмент gh stack, чтобы создать, отправить и обновить каждый слой, а также перебазировать слои выше, когда один из них меняется.
Технический текст (оригинальный SKILL.md)
Оригинальный текст автора на английском, прямо с GitHub.
Stacked PRs with gh stack
Before you divide a change into layers, check things already tried. It records when a stack cost more review effort than one PR.
GitHub's native stacked PRs are enabled on this repo.
A stack is an ordered chain of PRs where each one targets the branch of the PR below it; the bottom PR targets master.
GitHub tracks the chain as a first-class object: the PR UI shows a stack map, branch protections (code owner approval, required checks) apply to every layer including mid-stack ones, and CI that runs on master PRs runs on every layer.
Setup (this skill is written against gh-stack v0.1.0):
gh extension install github/gh-stack # or: gh extension upgrade stack
Upstream docs: about stacked PRs, CLI commands.
In a cloud task sandbox, use gh_stack instead
The rest of this skill assumes a developer machine.
Cloud task runs block git commit and git push so unsigned commits cannot leave the sandbox, which takes out every gh stack command that publishes a stack — submit, sync, push, and link with branch arguments all push, and gh stack add -m commits.
There, build the stack from the signed-commit tooling and link it with the gh_stack MCP tool, which drives GitHub's Stacks REST API and never pushes:
- Commit each layer with
git_signed_commit, passing a newbranch— the checkout already sits on the layer below, so the branch starts there. - Open each layer's PR with
gh pr create --base <branch of the layer below>. - Link them with
gh_stack, operationcreate, passingpull_requestsbottom to top.
To restack a layer: check that layer out, git rebase <its parent branch>, then republish it with git_signed_rewrite passing onto = the parent branch.
gh stack rebase still does the rebase itself, but nothing may publish the result — gh stack push and gh stack sync both push.
git_signed_rewrite replays whatever local HEAD points at and uses branch only to pick which remote ref moves, so the layer has to be the checked-out branch or you publish the wrong history to it.
Create a stack
gh stack init my-feature-db # bottom branch, based on master
# ...commit...
gh stack add my-feature-api # next layer, based on the previous branch
# ...commit...
gh stack add -Am "add UI" my-feature-ui # stage all + commit in one step
- Adopt existing local branches (bottom to top):
gh stack init branch1 branch2 branch3. - Link PRs that already exist on GitHub, without local tracking:
gh stack link <pr> <pr> <pr>, bottom to top (branch names and PR URLs work too). Pass a stack number first to append to an existing stack:gh stack link <stack> <pr>. - Slice by reviewable unit: migration / backend / frontend, or mechanical-rename / behavior-change. Each PR must make sense to review and merge alone.
- Keep stacks shallow (2–4 layers). Every layer multiplies CI cost and rebase churn, and deep-stack pushes can trip GitHub's dispatch cap (see AGENTS.md, "Stacked PRs").
The pre-push hook and the
Stack depthcheck block a layer above the fifth open one (merged layers don't count). For more work on top, rungh stack init --base <top branch> <new branch>frommaster, because gh-stack refuses to start a stack from a layer of another one. Rebase the new stack ontomasteronce the lower stack lands. - Place a CI-heavy layer by how CI diffs it:
- Most jobs pick their work from the layer's own diff against its parent, so such a layer does not make the layers above it heavy. A push to any layer below it starts its jobs again (see the duplicate-run note under "Iterate and keep in sync"). Put it low, unless it is the layer that still changes most.
- A few steps diff against master, so they repeat on layers above the change. Trunk's impacted-targets job runs on every layer and computes affected crates when
rust/orproto/differs. Backend jobs build the HogQL parser from source whencommon/hogql_parser/orrust/hogql/parser/differs, and Playwright jobs whencommon/hogql_parser/differs. Those builds repeat only on upper layers whose own diff starts backend or Playwright jobs. If upper layers do, put the parser change in the top layer.
- Put every change that moves a visual review snapshot, Storybook
Частые вопросы
Что такое stacked pull request?
Это цепочка pull request, где каждый нацелен на ветку того, что ниже, а нижний нацелен на основную ветку.
Нужна ли команда gh?
Да. Скилл использует расширение gh stack для GitHub, которое вы один раз устанавливаете вместе с GitHub CLI.
Нужно ли создавать новые pull request как черновики?
Скилл сначала создаёт стеки как черновики, чтобы каждый слой можно было проверить до того, как его увидит проверяющий.
Подробности
Оригинальное описание автора
Create and manage GitHub native Stacked PRs in this repo with the `gh stack` CLI. Use when asked to stack PRs, split a large change into a stack, add a layer to a stack, restack or rebase a stack, adopt existing branches or PRs into a stack, check out someone else's stack, or land a stack. Covers creating and submitting stacks (draft-first), cascade rebases with `gh stack sync`, and landing one through the Trunk merge queue via `/merging-prs` — whole-stack via `trunk merge` on the top layer, or bottom-first — never `gh stack merge`.
repo: PostHog/posthog
Популярность
- Звёзды на GitHub
- 41k
- Место в рейтинге
- #6818
- Лицензия
- —
- Обновлён
- 02.11.2026
Комментарии
- …
Другие скиллы из этого репозитория
depot-ci
41kПомогает агенту настроить и запускать workflow в Depot CI, альтернативе GitHub Actions, включая перенос существующих workflow и чтение логов запусков.
depot-container-builds
41kПомогает агенту собирать Docker-образы на удалённых сборщиках Depot, включая мультиплатформенные образы, отправку в реестры и исправление ошибок сборки.
depot-github-runners
41kПомогает агенту переносить задачи GitHub Actions на раннеры Depot: выбирать размер и метки раннера и устранять проблемы настройки.
editing-agents-md
41kПомогает агенту решить, нужно ли правило в файле AGENTS.md или CLAUDE.md, и записать его так, чтобы оно работало, не раздувая файл.
Похожие скиллы
diffs
394kПозволяет агенту создать настоящее сравнение правок в виде ссылки или файла изображения, которым можно поделиться, вместо ручной сводки.
coding-agent
394kПомогает агенту передать большую задачу по коду в Codex, Claude Code или OpenCode как фоновому исполнителю, а затем проверять ее ход.
gh-issues
394kПомогает агенту находить задачи GitHub, выбирать, над какими работать, и открывать запросы на слияние с исправлениями, включая ответы на комментарии рецензентов.