auto_task.execute_with_stacked_prs
Execute a sequence of tasks as one stack of branches and PRs
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-02
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- model
- haiku
- description
- Execute a sequence of tasks as one stack of branches and PRs
03 SKILL.md 正文
Goal
- Execute one GitHub issue as a stack of sequential branches and PRs, each named
<BASE>_<ID>(ID= 1, 2, 3, ...) and each branched from the previous one, so the PRs stack in review order - Create the whole stack without stopping for review between branches
- The user then reviews, edits, and merges each PR bottom-up at their own pace, after this skill's job is done
- Follow
.claude/skills/auto_task.rules.mdfor how tasks are queued, specified, and named before they reach this skill
Input
- The user will pass you a task in the format
When to Use This Skill
- Use it only when the tasks favor stacked execution: specs are complete, tasks form a real dependency chain, and the user prefers one batch review over interruptions
- Follow
.claude/skills/auto_task.rules.mdsection "Ask for Clarification Before Executing an Unclear Plan" when a task's spec is unclear or incomplete: do not keep building downstream tasks on top of a guess - Make sure that once you start implementing the stack all the doubts have been clarified by asking to the user, so that you can proceed without interruptions
Workflow
Confirm the Task List
- Follow
.claude/skills/auto_task.rules.mdsection "Confirm the Task List Before Executing" for the task list format and the problem/solution check; these ordered tasks are the stack's branches, one task per branch - Confirm task
<ID+1>depends only on task<ID>, not onmasterand not on an earlier task in the list - If the order or a dependency is unclear, ask before starting: fixing a wrong dependency after the stack is built means rebasing everything above it
Create the Issue and the First Branch (_1)
-
Follow
.claude/skills/auto_task.rules.mdsection "One GitHub Issue Is the Unit of Work": one GH issue covers the whole stack, not one issue per branch -
Create the issue and the first branch / PR
<BASE>_1> git_create_issue_and_branch.py \ --gh_issue_title "<TITLE>" --gh_issue_body "<Description of entire stack>" \ --suffix 1 -
The description of the entire task is
-
Commit the file passed by the user (e.g.,
tasks.md) -
Implement task 1, run the tests it touches, commit, push
Stack Each Following Branch (_<ID>)
- For
IDfrom 2 toN, while still checked out on branch<BASE>_<ID-1>:-
Derive branch
<BASE>_<ID>fresh from the issue, not from the current branch name, and branch it from<BASE>_<ID-1>instead ofmaster:> invoke git_branch_create --issue-id <NUM> --suffix <ID> \ --no-only-branch-from-master --no-abort-if-not-master --no-create-pr- Do not use
invoke git_branch_next_namefor this: it appends its own_1,_2, ... onto whatever branch is currently checked out, so run from<BASE>_<ID-1>it produces<BASE>_<ID-1>_1, not<BASE>_<ID>; only--issue-id --suffix <ID>derives<BASE>_<ID>correctly - Pass both
--no-only-branch-from-masterand--no-abort-if-not-master: withonly_branch_from_masterleft at its default (True), the task switches tomasterbefore branching regardless ofabort_if_not_master
- Do not use
-
Implement task
<ID>and run the tests it touches -
Commit and push
-
Open the PR against the previous branch in the stack, not against
master:> gh pr create --base <BASE>_<ID-1> --head <BASE>_<ID> --title "<TITLE>" -
Do not stop for review between branches: move straight to
<BASE>_<ID+1>once<BASE>_<ID>'s tests pass
-
Report the Stack
- Confirm each PR's base with
gh pr view <BASE>_<ID> --json baseRefName - Report one ordered list back to the user: branch, PR link, base branch, for every
IDin the stack, so the whole sequence can be reviewed at once
How the Stack Gets Merged
- This is the user's process, downstream of this skill; it is documented here so a later run of this skill picks up an in-progress stack correctly
- The user reviews, edits, and merges PRs bottom-up, one at a time, not the whole stack at once
- After
<BASE>_<ID-1>'s PR merges intomaster:-
Retarget
<BASE>_<ID>'s PR base tomaster, if GitHub did not already do it when the merged branch was deleted:gh pr edit <BASE>_<ID> --base master -
Sync
<BASE>_<ID>with the now-updatedmaster:> invoke git_merge_masterthen resolve whatever conflicts come up, commit, push
- This is a merge, not a rebase: if
<BASE>_<ID-1>was squash-merged, expect a conflict even on identical content, since Git cannot tell the squashed commit and the original commits are the same change
- This is a merge, not a rebase: if
-
Repeat for
<BASE>_<ID+1>once<BASE>_<ID>'s PR merges, continuing bottom-up until the stack is gone
-
- Never force-push a branch whose PR has unresolved review comments without telling the user first
Conventions
- Follow
.claude/skills/auto_task.rules.mdfor queue, spec, naming, and coding/testing conventions - Follow the template
.claude/templates/auto_task.template.mdif a task in the stack turns out to need splitting mid-run - If the issue also spans a submodule (see
.claude/skills/auto_task.rules.md"Multi-Repo Issues, Branches, and PRs"), only the outer repo's branches stack (_1.._N): a submodule gets one companion branch/PR, not a stack, sinceinvoke git_branch_create --suffixdoes not fan out to submodules-
Pass
--submodulesalongside--suffix 1on the firstgit_create_issue_and_branch.pycall below to create that companion branch/PR once, then refresh the issue's companion PR links after the stack is built:> git_create_issue_and_branch.py --gh_issue_id <NUM> --submodules \ --update_pr_links
-
Constraints
- Follow
.claude/skills/auto_task.rules.mdsections "The User Owns Commit and Merge Decisions" and "One GitHub Issue Is the Unit of Work" - Do not move to the next task before the tests touched by the current one pass: an untested task compounds into everything stacked on top of it
- Do not squash or reorder commits across tasks without being asked
- Keep one task mapped to one branch and one PR: do not fold two queued tasks into a single branch to save steps
- One GH issue covers the whole stack: do not open a separate issue per branch
Verification
- [ ] Every branch is named
<BASE>_<ID>, including the first, withIDincreasing by 1 up the stack - [ ] Every branch's Git merge base is the previous branch in the stack, not
master, except<BASE>_1, whose base ismaster - [ ] Every PR's base matches its parent branch in the stack, not the repo's default
branch, except
<BASE>_1's PR, whose base ismaster - [ ] Every branch and PR in the stack was created under the one shared GH issue
created alongside
<BASE>_1 - [ ] The tests touched by each task passed before that task's branch was pushed
- [ ] The final report lists every branch and PR in dependency order with links
04 同仓库更多 Skills
tutorial_in_60_mins.propagate_docker_changes
Sync tutorial and class-project Docker files to match project_template
tutorial_in_60_mins.merge_markdown
Merge the content of a markdown file into a Jupyter notebook
tutorial_in_60_mins.format
Format a directory to follow the "Learn X in 60 Minutes" tutorial conventions
tutorial_in_60_mins.create
Create a tutorial directory for the Learn X in 60 Minutes conventions
todo.reorg_in_progress
Reorganize ai_task_queue.md so in-progress tasks, not-started tasks, and mislabeled topic headers sit under the right H1 stage
todo.reorg_headers
Reorganize ai_task_queue.md .md so every H2 topic matches ALL TOPICS and every H3 task sits under the right topic, keeping its H1 stage