Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Auto Task.Restack

БесплатноБез исполняемых скриптовНе проверен

Propagate reviewed changes down an existing PR stack, keeping every PR mergeable

gpsaggeseот gpsaggese★ 158 звёзд на GitHub

Об этом скилле

Goal

  • Given the current PR is one branch in a stack of sequential PRs, propagate changes reviewed in an earlier PR into every PR stacked on top of it
  • Preserve full history: merge forward and commit. Never rebase or force-push
  • End with every PR in the stack mergeable, with CI green

Input

  • --only_plan: write the propagation plan to a file, without executing it

When to Use This Skill

  • Use after a PR in the middle or bottom of a stack was reviewed and changed, and the branches stacked on top of it need those changes
  • Do not use this to build a new stack. Use /auto_task.execute_with_stacked_prs instead
  • Follow .claude/skills/auto_task.rules.md section "Ask for Clarification Before Executing an Unclear Plan" when a PR's description is unclear. Do not guess and merge blind

Workflow

Create Only the Plan (--only_plan)

  • With --only_plan, follow .claude/skills/auto_task.rules.md section "Create Only a Plan with --only_plan"
  • Run only "Discover the Full Stack", "Print the Stack", and the creation of auto_task.restack.md, then stop without waiting for a confirmation

Discover the Full Stack

  • Get the current PR:
    > gh pr view --json number,title,baseRefName,headRefName,url
    
  • Walk up from the current PR's baseRefName, following each branch's own PR (gh pr list --head <base> --state all), until reaching the default branch (master). This is the bottom of the stack
  • Walk down from the current PR's headRefName, finding the open PR whose baseRefName equals the previous PR's headRefName (gh pr list --base <branch> --state open). This is the top
  • Order the PRs from bottom (based on master) to top
  • Check whether the bottom PR is behind the default branch:
    > gh pr view <bottom PR> --json mergeable,mergeStateStatus
    
    If mergeable is CONFLICTING (or the branch is just behind), treat the default branch as an implicit PR_0 at the bottom. It needs the same merge-forward treatment as every other pair

Print the Stack

  • Print one table with columns #, Branch, PR (#<NUM> — <title>), Base, e.g.:
    +---+--------------------+-----------------------------------------------+--------+
    | # | Branch             | PR                                             | Base   |
    +---+--------------------+-----------------------------------------------+--------+
    | 1 | ..._invoke_tasks   | #1423 -- auto-pick suffix in git_branch_create | master |
    | 2 | ..._invoke_tasks_2 | #1424 -- unit tests for git_*/gh_* tasks       | #1423  |
    +---+--------------------+-----------------------------------------------+--------+
    

Create and Confirm the Propagation Plan

  • Create auto_task.restack.md listing, for every consecutive pair (PR_i, PR_i+1), including (master, PR_1) when the bottom PR is behind the default branch:
    • What PR_i changed, from its GH description and git diff <base_i>...<head_i>
    • What must merge into PR_i+1, and which files are likely to conflict (touched by both)
  • Wait for the user to confirm this plan before touching any branch

Propagate Changes Down the Stack

  • Process pairs bottom-up, one at a time, so each merge includes everything propagated so far. Start with (master, PR_1) when it is in the plan
  • For each pair (PR_i, PR_i+1) or (master, PR_1):
    • Read PR_i's description (gh pr view <PR_i> --json body,title) to resolve conflicts by its intent, not blindly
    • Right before merging, git fetch and confirm the local branch tip matches origin/<branch_i+1>. Another process or session can push mid-stack, and merging on a stale copy silently drops those commits
      > git fetch origin <branch_i> <branch_i+1>
      > git checkout <branch_i+1>
      > git reset --hard origin/<branch_i+1>
      > git merge origin/<branch_i>
      
    • Resolve conflicts by hand, favoring the intent of PR_i's change. Do not use git rebase or force-push
    • Follow .claude/skills/coding.rules.md and .claude/skills/testing.rules.md while resolving conflicts in code and tests
    • Commit the merge and run git push. If the push is rejected because origin/<branch_i+1> moved, re-fetch and redo the merge. Do not force-push over it
  • Repeat up to the top of the stack

Make Every PR Mergeable

  • For every PR in the stack, in order, run /github_pr.get_ready_to_merge to get its CI green
  • After propagation, confirm mergeability:
    > gh pr view <NUM> --json mergeable,mergeStateStatus
    

Report Only Failures

  • Do not comment on a PR that merged cleanly and passed CI
  • If a PR hits an unresolved conflict or a CI failure needing human input, post one comment explaining the problem:
    > gh pr comment <NUM> --body "<what failed and why>"
    
  • Also describe the problem to the user directly. Do not leave it only in a PR comment

Conventions

  • Follow `.claude/skills/auto_task.rule
Полный SKILL.md на GitHub

Установить Auto Task.Restack в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл Auto Task.Restack?

Propagate reviewed changes down an existing PR stack, keeping every PR mergeable

Как установить скилл Auto Task.Restack?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Auto Task.Restack запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Auto Task.Restack с