stacking-prs
Ce qu’il fait
Cette skill montre à l'IA comment créer et gérer des demandes de fusion empilées sur GitHub avec l'outil en ligne de commande gh stack. Elle s'adresse aux développeurs qui veulent découper un gros changement en couches plus faciles à relire.
Quand l’utiliser
- ✓Quand une modification est trop grande pour être relue en une seule demande de fusion et que vous voulez la découper en couches.
- ✓Quand une demande de fusion d'une pile change et que les couches au-dessus doivent être mises à jour.
- ✓Quand vous voulez fusionner une pile de demandes de fusion dans le bon ordre.
Lien du skill
https://github.com/PostHog/posthog/blob/master/.agents/skills/stacking-prs/SKILL.mdCopiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.
Comment l’utiliser
Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.
Message prêt à coller
Pour Claude Code, Codex ou Cursor : lancez-la dans le dossier du projet et le skill est installé.
Téléchargez le SKILL.md et placez-le dans le dossier de skills de votre agent.
Exemple de demande à votre IA
“Découpe ma grande branche de fonctionnalité en une pile de demandes de fusion plus petites que je peux relire une à une.”
5 nouveaux skills par semaine. 1 minute de lecture.
Comment ça marche
Une pile est une chaîne ordonnée où chaque demande de fusion s'appuie sur celle du dessous. L'IA utilise l'outil gh stack pour créer, soumettre et mettre à jour chaque couche, et pour rebaser les couches supérieures quand l'une d'elles change.
Contenu technique (SKILL.md original)
Texte original de l’auteur, en anglais, directement depuis 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
Questions fréquentes
Qu'est-ce qu'une demande de fusion empilée ?
C'est une chaîne de demandes de fusion où chacune cible la branche de celle du dessous, et la plus basse cible la branche principale.
Ai-je besoin de l'outil en ligne de commande gh ?
Oui. Cette skill utilise l'extension gh stack pour GitHub, que vous installez une fois avec le CLI GitHub.
Les nouvelles demandes de fusion doivent-elles commencer en brouillon ?
La skill crée d'abord les piles en brouillon, afin que chaque couche puisse être vérifiée avant d'être relue.
Détails
Description originale de l’auteur
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
Popularité
- Étoiles GitHub
- 41k
- Position au classement
- #6818
- Licence
- —
- Mis à jour
- 02/11/2026
Commentaires
- …
Autres skills de ce dépôt
depot-ci
41kAide votre agent à configurer et exécuter des workflows Depot CI, alternative à GitHub Actions, en migrant les workflows existants et en lisant les journaux.
depot-container-builds
41kAide votre agent à construire des images Docker sur les constructeurs distants de Depot, y compris les images multiplateformes et la correction des échecs.
depot-github-runners
41kAide votre agent à faire tourner les jobs GitHub Actions sur les machines gérées par Depot, à choisir la taille des runners et leurs labels, et à résoudre les problèmes de configuration.
editing-agents-md
41kAide votre agent à décider si une règle doit figurer dans un fichier AGENTS.md ou CLAUDE.md, et à la rédiger pour qu'elle soit suivie sans alourdir le fichier.
Skills similaires
diffs
394kPermet à votre agent de produire un diff réel et partageable de vos modifications, sous forme de lien ou d'image, plutôt qu'un résumé écrit à la main.
coding-agent
394kAide votre agent à confier une tâche de programmation plus importante à Codex, Claude Code ou OpenCode comme travailleur en arrière-plan, puis à suivre sa progression.
gh-issues
394kAide votre agent à trouver des tickets GitHub, choisir ceux à traiter et ouvrir des pull requests avec des correctifs, y compris le suivi des commentaires de relecture.