Rebase a work-in-progress or completed branch onto a new base, ensuring the rebased changes still satisfy their original spec, comply with the (possibly updated) architecture, conventions, and invariants of the new base, and introduce no regressions. Use when the user says "rebase this branch on X", "rebase my work on master", "move these commits onto the new base", or otherwise asks to migrate a set of commits onto a different base than they were authored against.
93%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Git can replay commits. It cannot tell you whether the replayed solution still makes sense on a codebase that moved on. This skill re-validates the work against the new base, then does the mechanics carefully.
Do not invoke it for a fast-forward with no semantic delta. That is just git rebase.
Paths are relative to this file. <plugin root> is two directories above it.
| File | Read at | Holds |
|---|---|---|
references/stash.md | step 0, only if the tree is dirty | the labeled stash, the restore, a conflicted pop |
../../assets/writing.md | step 7, before writing the plan | the writing rules for every text a person reads |
references/rationalizations.md | when tempted to skip a step | why each shortcut fails |
curr: the branch or commit being rebased. Default: HEAD.old_base: what curr was branched from. Default: the merge-base of curr and
new_base.new_base: the target. Default: master or main. Confirm with the user.If any is ambiguous, ask. A wrong base silently invalidates the whole analysis.
Preflight. If git status --porcelain is not empty, read references/stash.md
now. The uncommitted work must survive the rebase. Stash it under a label, never
silently.
Three points. State the hashes of curr, old_base, and new_base to the user. If
old_base equals new_base, there is nothing to do. Say so and stop.
Inventory curr. Per commit, record the subject, the intent, the files, and the
spec or invariant it claims to satisfy. This is what must survive.
Inventory the delta from old_base to new_base. Read each of these on
new_base, never from memory:
AGENTS.md. Boundaries may have moved.curr calls.curr touches.A change outside curr's files can still break it: a renamed helper, a new invariant,
a tighter type. Delegate a large delta to a read-only search subagent.
Classify each commit against the delta, with a one-line justification. Name the files for every class other than Untouched.
| Class | Meaning | Action |
|---|---|---|
| Untouched | The delta did not change the surface curr relies on | Replay as is |
| Adjusted | The delta changed a dependency. curr still applies with edits | Plan the edits |
| Extended | The delta added surface curr should also cover: a caller, a channel, a spec, a test convention | Plan the extension |
| Obsolete | The delta removed the code curr modifies, or already solves the problem | Drop only after the user agrees |
| Conflicting | The delta adds a requirement that curr's solution contradicts | Stop at step 5 |
Also ask whether new_base already solves the original problem, in part or in full.
Risk gate. Stop and talk to the user before touching code in four cases. Something
is Conflicting. The architecture invalidates curr's approach. The problem is already
solved differently. The replay would break an invariant the delta added. Headline
first, then the conflicts, then the options.
Derisk. Verify every "I assume X is still true" against the code on new_base. A
non-trivial rebase gets three passes: assumptions, spec and architecture, edge cases.
Present the plan. Read ../../assets/writing.md now. Per commit: replay, replay
with edits, drop, split, or new commit, with the files and changes for each edit. Ask
the open questions now, not mid-rebase. Wait for approval unless in auto mode and the
rebase is low-risk.
Execute commit by commit.
-X theirs or -X ours.--no-verify.Restore the stash if step 0 made one, per references/stash.md. A conflicted pop
goes to the user, never through checkout -- or reset --hard.
Verify. Run the full lint and unit tests on the affected components, and an e2e
sanity check of the behavior the branch delivers. Re-read the original spec or PR
description against the result. Check the surfaces the delta touched and curr did
not. They are the easiest to break and to miss.
Report as an inverted pyramid. The headline says succeeded, succeeded with
adjustments, or blocked. Then the per-commit outcome, the spec or invariant deviations
and their resolution, and what the user should still verify by hand. Run
<plugin root>/scripts/prose-lint.py on the report and fix every finding.
Each item is answerable with evidence. One you cannot tick honestly sends you back to the step that produces it.
old_base differs from new_base.new_base.--no-verify, -X theirs, or
-X ours.curr did not were checked, and "nothing broken there" is a finding.prose-lint.py with no findings.korya/swd-skills
b1520b9
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.