Cascades a rebase through an entire PR stack after a base PR merges or upstream changes. Use when a stack needs to incorporate new base branch commits.
npx skills add https://github.com/athola/claude-night-market --skill stack-rebase
Cascade a rebase through an entire PR stack after a base
PR merges or the upstream base branch changes.
Run stack-rebase in any of these situations:
master; thesecond PR now needs to target master directly
master has moved forward and stack branches need toincorporate the new commits
pick up the change
sanctum:stack-push)sanctum:stack-create)git branch --list)git fetch origin)git status)--update-refsCreate TodoWrite items before starting:
stack-rebase:fetch-completestack-rebase:trigger-identifiedstack-rebase:rebase-completestack-rebase:conflicts-resolvedstack-rebase:force-pushedstack-rebase:prs-updatedfetch-complete)git fetch origin
If the merged PR's branch still exists on remote, note
that GitHub retains the branch after merge.
The merged branch itself is no longer a valid stack base.
trigger-identified)Determine what changed:
Case A, Base PR merged into master:
The slice that was the old "root" is now in master.
All remaining slices need to rebase onto master.
# Confirm the merged branch is now in master
git branch -r --merged origin/master | grep "${MERGED_BRANCH}"
Case B, Master moved forward:
Slices are behind master but the stack topology is
unchanged.
Rebase the root slice onto master; --update-refs
carries all descendants.
Case C, Mid-stack revision:
A slice was amended.
All descendant slices need to rebase onto it.
rebase-complete)STACK=stack/my-feature
BASE=master
# Check out the root slice
ROOT_SLICE=$(git branch --list "${STACK}/*" \
| sed 's/^[* ]*//' | sort | head -1)
git checkout "${ROOT_SLICE}"
# Rebase with --update-refs rewrites all stack branches
git rebase --update-refs origin/${BASE}
--update-refs scans the reflog and updates every local
branch ref that points to a commit being rebased.
All slice branches in the stack are rewritten in one pass.
# Check out the first slice BELOW the amended one
CHILD_SLICE=stack/my-feature/add-api # example
git checkout "${CHILD_SLICE}"
git rebase --update-refs stack/my-feature/add-schema
# jj rebases all descendants automatically on any change
# To rebase the whole stack onto master:
jj rebase -d master \
-r "ancestors(${STACK}/add-ui) & !ancestors(master)"
conflicts-resolved)If the rebase pauses with conflicts:
# See which file conflicts
git status
# After resolving each file:
git add <resolved-file>
git rebase --continue
Repeat until the rebase completes.
If a conflict is too complex, abort and investigate:
git rebase --abort
Then examine the diff between the conflicting commits
before retrying.
force-pushed)After a successful rebase, push all slice branches.
Use --force-with-lease to guard against remote changes
made since the last fetch:
for branch in $(git branch --list "${STACK}/*" \
| sed 's/^[* ]*//' | sort); do
git push --force-with-lease origin "${branch}"
echo "force-pushed: ${branch}"
done
Never use --force (drops the remote-change guard).
jj git push --all --allow-new
prs-updated)Case A only: After the root slice merged and you
rebased remaining slices onto master, the next PR in
the stack now targets the wrong base.
Update its base via the GitHub CLI:
NEXT_PR=456 # PR number of the new stack root
gh pr edit "${NEXT_PR}" --base master
For PRs further down the stack, their bases remain the
previous slice branch, which --update-refs already
rewrote; no base edit is needed for them.
Verify the full stack is consistent:
for branch in $(git branch --list "${STACK}/*" \
| sed 's/^[* ]*//' | sort); do
pr_num=$(gh pr list --head "${branch}" \
--json number,baseRefName \
--jq '.[0] | "#\(.number) base=\(.baseRefName)"')
echo "${branch}: ${pr_num}"
done
area for conflicts during rebase
once a day is cheaper than resolving a week of drift
prefer a fixup commit and squash at merge time
git rebase --update-refs requires Git 2.38+; confirmwith git version before running
--update-refs is unavailable, manually check outand rebase each slice branch in order from root to tip
reviews as stale; remind reviewers to re-approve
stack-push skill documents how to re-post thestack summary comment after a rebase changes PR SHAs
stack-rebase:fetch-complete throughstack-rebase:prs-updated) are created before the rebase starts
and marked complete in order
git fetch origin completes before the rebase trigger isidentified and classified as Case A, B, or C
git rebase --update-refs completes without abort for Cases Aand B; if conflicts occur, each is resolved before continuing
--force-with-lease; plain--force is never used
gh pr edit <next-pr> --base master updatesthe new stack root's base target and the full stack topology
verified with gh pr list output
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
Take athola/stack-rebase from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.