본문으로 건너뛰기
Skillpedia
일반 코딩41k · #6818

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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/PostHog/posthog/blob/master/.agents/skills/stacking-prs/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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:

  1. Commit each layer with git_signed_commit, passing a new branch — the checkout already sits on the layer below, so the branch starts there.
  2. Open each layer's PR with gh pr create --base <branch of the layer below>.
  3. Link them with gh_stack, operation create, passing pull_requests bottom 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 depth check block a layer above the fifth open one (merged layers don't count). For more work on top, run gh stack init --base <top branch> <new branch> from master, because gh-stack refuses to start a stack from a layer of another one. Rebase the new stack onto master once 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/ or proto/ differs. Backend jobs build the HogQL parser from source when common/hogql_parser/ or rust/hogql/parser/ differs, and Playwright jobs when common/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.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬