claude-code-plugin-ref…
Explain plugin, skill, command, agent, and hook mechanics used here. Use when authoring or debugging plugins. Do not use for ops; use night-market-operations.
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 -y skills add athola/claude-night-market --skill stack-rebase --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/stack-rebaseContext preview
The summary Claude sees to decide when to auto-load this skill.
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.
name: stack-rebase description: 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. alwaysApply: false category: workflow-automation tags: - git - stacked-diffs - rebase - pr - cascade tools: [] complexity: medium model_hint: standard estimated_tokens: 900 dependencies: - sanctum:stack-create - sanctum:stack-push - sanctum:git-workspace-review
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:
second PR now needs to target `master` directly
incorporate the new commits
pick up the change
Create `TodoWrite` items before starting:
1. `stack-rebase:fetch-complete` 2. `stack-rebase:trigger-identified` 3. `stack-rebase:rebase-complete` 4. `stack-rebase:conflicts-resolved` 5. `stack-rebase:force-pushed` 6. `stack-rebase:prs-updated`
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.
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.
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)"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.
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}"
doneNever use `--force` (drops the remote-change guard).
jj git push --all --allow-new
**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 masterFor 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}"
donearea for conflicts during rebase
once a day is cheaper than resolving a week of drift
prefer a fixup commit and squash at merge time
with `git version` before running
and rebase each slice branch in order from root to tip
reviews as stale; remind reviewers to re-approve
stack summary comment after a rebase changes PR SHAs
`stack-rebase:prs-updated`) are cre
A plugin marketplace for Claude Code. Install only the plugins you need to run git workflows, code review, spec-driven development, and autonomous agents from inside your Claude Code session.
Explain plugin, skill, command, agent, and hook mechanics used here. Use when authoring or debugging plugins. Do not use for ops; use night-market-operations.
States load-bearing decisions, invariants, and weak points. Use when judging a design change. Do not use for gating; use night-market-change-control.
Rebuild the dev environment: uv, Python tiers, pins, traps. Use when onboarding or toolchain breaks. Do not use for daily commands; use night-market-operations.
Classify, gate, and review changes. Use when landing a PR, releasing, or amending rules. Do not use for failure triage; use night-market-debugging-playbook.
Search and record project memory (Discussions, journal, ADRs). Use before re-investigating anything. Do not use for settled battles; see failure-archaeology.
Bind loop 'done' to unfakeable gates. Use to harden egregore/herald loops or promote completion_integrity. Not for QA gates; use night-market-validation-and-qa.