stacking-prs
Qué hace
Esta skill muestra a la IA cómo crear y gestionar pull requests apiladas en GitHub con la herramienta de línea de comandos gh stack. Está pensada para desarrolladores que quieren dividir un gran cambio en capas más pequeñas y fáciles de revisar.
Cuándo usarla
- ✓Cuando un cambio de código es demasiado grande para revisarlo en una sola pull request y quieres dividirlo en capas.
- ✓Cuando cambia una pull request inferior de una pila y hay que actualizar las capas superiores.
- ✓Cuando quieres fusionar una pila de pull requests en el orden correcto.
Link de la skill
https://github.com/PostHog/posthog/blob/master/.agents/skills/stacking-prs/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Divide mi rama de funcionalidad grande en una pila de pull requests más pequeñas que pueda revisar una a una.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
Una pila es una cadena ordenada en la que cada pull request se apoya en la de abajo. La IA usa la herramienta gh stack para crear, enviar y actualizar cada capa, y para reorganizar las capas superiores cuando cambia una de ellas.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de 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
Preguntas frecuentes
¿Qué es una pull request apilada?
Es una cadena de pull requests en la que cada una apunta a la rama de la de abajo, y la inferior apunta a la rama principal.
¿Necesito la herramienta de línea de comandos gh?
Sí. Esta skill usa la extensión gh stack de GitHub, que se instala una vez con la CLI de GitHub.
¿Las nuevas pull requests deben empezar como borradores?
La skill crea las pilas primero como borradores, para que cada capa pueda revisarse antes de que nadie la revise.
Detalles
Descripción original del autor
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
Popularidad
- Estrellas en GitHub
- 41 mil
- Posición en el ranking
- #6818
- Licencia
- —
- Actualizada
- 2/11/2026
Comentarios
- …
Más skills de este repositorio
depot-ci
41 milAyuda a tu agente a configurar y ejecutar flujos de Depot CI, una alternativa a GitHub Actions, y a leer los registros de ejecución.
depot-container-builds
41 milAyuda a tu agente a crear imágenes de Docker en los constructores remotos de Depot, incluidas las multiplataforma, y a corregir fallos.
depot-github-runners
41 milAyuda a tu agente a pasar los trabajos de GitHub Actions a runners gestionados por Depot, elegir su tamaño y etiquetas y resolver problemas de configuración.
editing-agents-md
41 milAyuda a tu agente a decidir si una regla debe ir en un archivo AGENTS.md o CLAUDE.md, y a escribirla para que se cumpla sin sobrecargar el archivo.
Skills parecidas
diffs
394 milPermite que tu agente genere un diff real y compartible de los cambios, como enlace de visualización o archivo de imagen, en lugar de un resumen escrito a mano.
coding-agent
394 milAyuda a tu agente a pasar un trabajo de programación grande a Codex, Claude Code u OpenCode como trabajador en segundo plano, y después revisar su progreso.
gh-issues
394 milAyuda a tu agente a encontrar incidencias de GitHub, elegir cuáles trabajar y abrir pull requests con correcciones, incluido el seguimiento de los comentarios de revisión.