From swd
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.
How this skill is triggered — by the user, by Claude, or both
Slash command
/swd:rebaseThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
The point of this skill is **not** `git rebase`. Git can replay commits; it cannot tell you whether the replayed solution still makes sense. This skill is about the *thinking* around a rebase: re-validating the rebased work against a moved-on codebase, then doing the mechanical rebase carefully.
The point of this skill is not git rebase. Git can replay commits; it cannot tell you whether the replayed solution still makes sense. This skill is about the thinking around a rebase: re-validating the rebased work against a moved-on codebase, then doing the mechanical rebase carefully.
<branch> on <new-base>" / "rebase my WIP onto master"Do not invoke for trivial fast-forward rebases with no semantic delta (e.g. base advanced by one unrelated commit) — just git rebase directly.
curr — the branch / commit being rebased (default: current branch HEAD)old_base — the base curr was originally branched from (default: merge-base of curr and new_base)new_base — the target base (default: master / main, confirm with user)If any of these are ambiguous, ask before proceeding. Wrong base picks silently invalidate the entire analysis.
git rev-parse HEAD # curr
git merge-base <curr> <new_base> # old_base (likely)
git rev-parse <new_base> # new_base
State all three back to the user before continuing. If old_base == new_base, nothing to do — say so and stop.
curr's changesgit log --oneline <old_base>..<curr>
git diff --stat <old_base>..<curr>
For each commit on curr, capture: subject, intent, files touched, and any spec/invariant it's claimed against. This is the "what we're trying to preserve" baseline.
delta = new_base - old_basegit log --oneline <old_base>..<new_base>
git diff --stat <old_base>..<new_base>
Pay particular attention to:
docs/product-spec/, docs/invariants.md) — requirements may have changeddocs/architecture.md, AGENTS.md, component-level AGENTS.md) — boundaries may have moved.editorconfig / formatter configs — style may have shiftedcurr depends on may have changedcurr touches — direct conflict surfaceFor non-trivial deltas, delegate the survey to an Explore agent rather than reading every commit by hand.
For each piece of curr's change, classify against delta:
| Classification | Meaning | Action |
|---|---|---|
| Untouched | delta did not modify the surface curr relies on | Replay as-is |
| Adjusted | delta modified a dependency; curr still applies but needs edits | Plan the edits |
| Extended | delta added new surface curr should also cover (new caller, new channel, new spec) | Plan the extension |
| Obsolete | delta removed the code curr modifies, or already solves the problem | Drop the commit; confirm with user |
| Conflicting | delta introduces requirements that contradict curr's solution | Stop; escalate |
Also check: has the original problem been (partially) solved on new_base already? If yes, much of curr may be redundant.
If any of the following is true, stop and discuss with the user before touching code:
curr is classified Conflictingdelta invalidates the approach curr tooknew_basedelta (e.g. data privacy, isolation, channel rules)Surface these as a short summary with the inverted-pyramid principle: headline first ("rebase is risky because…"), then the specific conflicts, then options.
Enumerate, with file paths:
delta the rebased solution must be extended to (e.g. a new channel/handler that needs the same fix)delta whose modifications in curr are no longer neededdelta whose modifications in curr need adjustmentdelta that curr can keep as-isBefore committing to the plan, cross-check the riskiest assumptions:
new_base (not on old_base — they may differ)new_basenew_baseFor non-trivial rebases, run three explicit validation passes (mirroring feedback_plan_validation_passes): assumption pass, spec+architecture pass, edge-case pass.
Before executing, show:
Wait for user approval unless in auto mode and the rebase is low-risk.
Prefer an interactive-style approach where each logical commit is handled independently:
-X theirs/-X ours blindly)Never --no-verify to push past hook failures. Fix the underlying issue.
After all commits land:
just lint or component-specific)just test or component-specific)delta touched but curr did not — those are the easiest to break and the easiest to missSummarize for the user, inverted-pyramid:
When tempted to skip a step, check whether your reasoning appears below. If it does, the answer is: do the step.
| Rationalization | Why it fails here |
|---|---|
| "Conflicts resolved cleanly — ship it." | Conflict markers are the visible 10%; semantic drift is the invisible 90%. A clean text merge can still violate an invariant delta added. |
| "The tests passed after the rebase, so it's fine." | The tests cover what was true on old_base. If delta added new surface (new caller, new channel, new spec), the suite may not cover it yet. |
| "Git accepted the replay, so the commits must still be correct." | Git replays text. It does not check that the solution still matches the problem. Re-read the spec on new_base. |
"delta didn't touch the files curr changes — no cross-impact." | File-level untouched ≠ semantically untouched. A renamed helper, a new invariant, a tightened type — all can invalidate curr without touching its files. |
| "The original spec still applies." | Re-read it on new_base. Specs evolve in delta more often than agents assume; "still applies" should be a finding, not an assumption. |
"-X theirs / -X ours will clear this conflict fast." | These options hide semantic divergence in a hunk-shaped blindspot. Resolve by reading both sides. |
| "This commit looks redundant — I'll drop it silently." | Dropping a commit is a user-visible scope decision. Surface it, get the nod, then drop. |
| "I'll bundle the rebase-fix into the original commit." | If the fix is preserving the original intent, bundle. If it's a new bug fix you discovered during rebase, split — per the project's split-move-and-fix rule. |
| "Lint/tests aren't needed; rebase didn't touch logic." | Rebase always touches logic — replaying a change against new code is a logic change. Run them. |
| "Three iterations of conflict resolution is enough — push it." | If you've fought the same hunk three times, the approach itself is probably wrong on new_base. Stop and reframe with the user. |
old_base is not the spec you're shipping against.The rebase is complete when all of these are true. Each item is answerable with evidence, not a vibe.
curr, old_base, new_base) stated back to the user; old_base != new_base confirmed.curr carries a classification (Untouched / Adjusted / Extended / Obsolete / Conflicting) with a one-line justification.new_base (not from memory of old_base).--no-verify.-X theirs / -X ours was used to clear a conflict the agent didn't read both sides of.delta-touched code that curr did not touch was sanity-checked; "nothing broken there" is a finding, not an assumption.If a checkbox cannot be ticked honestly, the rebase is not done — return to the step that produces it.
Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub korya/swd-skills --plugin swd