stacking-prs
하는 일
이 스킬은 gh stack 명령줄 도구를 써서 GitHub에서 스택형 풀 리퀘스트를 만들고 관리하는 방법을 AI에게 보여 줍니다. 큰 변경을 검토하기 쉬운 작은 층으로 나누려는 개발자를 위한 것입니다.
사용하는 경우
- ✓코드 변경이 너무 커서 한 번에 검토하기 어렵고 층으로 나누고 싶을 때.
- ✓스택에서 아래쪽 풀 리퀘스트가 바뀌어서 그 위 층들을 갱신해야 할 때.
- ✓풀 리퀘스트 스택을 올바른 순서로 병합하고 싶을 때.
스킬 링크
https://github.com/PostHog/posthog/blob/master/.agents/skills/stacking-prs/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“큰 기능 브랜치를 한 번에 하나씩 검토할 수 있는 작은 풀 리퀘스트 스택으로 나눠 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
스택은 각 풀 리퀘스트가 아래 풀 리퀘스트 위에 쌓이는 순서 있는 체인입니다. AI는 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
자주 묻는 질문
스택형 풀 리퀘스트란 무엇인가요?
각 풀 리퀘스트가 아래 풀 리퀘스트의 브랜치를 대상으로 하고, 가장 아래 것은 main 브랜치를 대상으로 하는 풀 리퀘스트의 연결입니다.
gh 명령줄 도구가 필요한가요?
네. 이 스킬은 GitHub용 gh stack 확장을 사용하며, GitHub CLI로 한 번 설치합니다.
새 풀 리퀘스트는 초안으로 시작해야 하나요?
스킬은 먼저 초안으로 스택을 만들어서 누군가 검토하기 전에 각 층을 확인할 수 있게 합니다.
상세 정보
작성자의 원본 설명
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
- 라이선스
- —
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
depot-ci
41k에이전트가 GitHub Actions 대안인 Depot CI 워크플로를 설정하고 실행하도록 돕습니다. 기존 워크플로 이전과 실행 로그 읽기를 포함합니다.
depot-container-builds
41k에이전트가 Depot 원격 빌더에서 Docker 이미지를 빌드하도록 돕습니다. 다중 플랫폼 이미지, 레지스트리 푸시, 빌드 실패 수정을 포함합니다.
depot-github-runners
41k에이전트가 GitHub Actions 작업을 Depot 관리형 러너로 옮기고, 러너 크기와 라벨을 고르도록 돕습니다.
editing-agents-md
41k에이전트가 규칙을 AGENTS.md나 CLAUDE.md 중 어디에 둘지 정하고, 파일을 키우지 않으면서 잘 지켜지도록 쓰게 돕습니다.