agentleFS
youknowoneyouknowone/pyre/.claude/skills/rebase/SKILL.md

rebase

Skill6 starsChanged 26 days agoMITView on GitHub

Rebase the current working branch onto `upstream/main` (the remote base, NOT local `main`), resolving every conflict by consulting the authoritative RPython/PyPy source under `` rather than arbitrarily picking a side. Invoked via `/rebase`. Use whenever the user asks to "rebase", "rebase onto main", "restack on main", "replay on top of main", "pull main under my branch", or any equivalent request to rewrite the current branch on top of main while resolving conflicts. Before rebasing, this skill commits any unstaged work and squashes WIP noise into concise commits. During rebase, conflicts are resolved per-hunk — commit-level granularity is explicitly too coarse; each conflicting region is judged individually against upstream RPython/PyPy and merged to the more RPython-orthodox shape. Default to using this skill any time the user mentions rebasing, pulling main under the branch, or conflict resolution in the context of a long-running branch. Complements but does not replace `/merge` (which builds a green `-merge` branch) and `/parity` (which defines "RPython-orthodox").

  • Deletes or force-pushes
  • Commits and pushes

27 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use dependency-watch, perform-task and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • telegramdesktopSkill

    dependency-watch

    Audit Telegram Desktop dependencies on freshly fetched origin/dev for releases and security fixes, including upstream lag and backport candidates in patched forks. Use for the scheduled dependency monitor or an explicitly requested dependency report.

    Also in 5 projects that use this

  • telegramdesktopSkill

    perform-task

    Resolve, start or resume, implement, review, test, and publish exactly one existing ai-tdesktop task by short slug or full dated id, including rare blocked retries and split-required results. Use when the user invokes $perform-task or /perform-task with a known task name, or when the continue scheduler delegates one selected task. Runs standard review lenses with fast applicability bailouts and selects task-specific domain and evidence instruments without selecting additional work.

    Also in 5 projects that use this

  • JerovinoSkill

    process-inbox

    Processes tasks.md inbox items by triaging each one to its proper location in the vault

    Also in 5 projects that use this

  • Trejon-888Skill

    continue

    Load project context, alignment audit, status check, suggest next action. Auto-invoke at session start, after context switches, or when user says 'continue', 'pick up where we left off', 'resume', 'what's next', 'status check', 'what now'.

    Also in 6 projects that use this

  • lepinkainenSkill

    code-health

    Analyze codebase health - large files, test coverage gaps, duplicate code, dead/legacy code, and documentation issues. Use when asked to scan, audit, or assess code quality, find refactoring targets, or identify technical debt.

    Also in 3 projects that use this

  • dekozaSkill

    fix-pr

    Repair an existing pull request's review findings and target-branch conflicts, verify the result, and update the same open PR.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

19 rules. 0 are common, 13 are distinctive, and 6 are very specific to this project.

  • 0

    Common

    Most of the 27 edited versions we read keep these.

  • 13

    Distinctive

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    When the user types /rebase:

    line 23
  2. Distinctive:

    Do the prep work in Step 1 before touching git rebase.

    line 26
  3. Distinctive:

    If the rebase refuses to start because of a dirty working tree, go back to Step 1.

    line 83
  4. Very specific:

    Locate the RPython/PyPy counterpart: Use the mechanical rule documented in the /parity skill — strip the crate root, swap .rs for .py, …

    line 93
  5. Very specific:

    Remove the <<<<<<< / ======= / >>>>>>> markers and save.

    line 113
  6. Distinctive:

    After every region in a file is resolved, git add the file.

    line 115
  7. Distinctive:

    If more conflicts appear, return to Step 3.

    line 135
  8. Distinctive:

    If at any step the rebase resolution is genuinely ambiguous and upstream gives no guidance, stop and ask the user rather than guess.

    line 137
  9. Distinctive:

    If things go badly wrong:

    line 139
  10. Distinctive:

    After the rebase completes:

    line 149
  11. Very specific:

    Verify that the rebase kept the work.

    line 152
  12. Distinctive:

    Test only as much as the rebase changed, following AGENTS.md "How much to verify":

    line 153
  13. Distinctive:

    Do not push, merge, or force-push unless the user explicitly asks.

    line 161
  14. Very specific:

    When upstream/main and origin/main disagree, ask which is the base — do not pick.

    line 166
  15. Very specific:

    Every conflict region is judged individually.

    line 167
  16. Distinctive:

    Every non-trivial resolution cites the upstream RPython/PyPy file:line it was judged against.

    line 168
  17. Distinctive:

    Commit any unstaged work (or explicitly stash with user consent) before starting the rebase.

    line 169
  18. Distinctive:

    Never git push --force without explicit user instruction, even after a successful rebase.

    line 171
  19. Distinctive:

    When in doubt between two plausible resolutions, stop and ask the user — wrong silent resolutions compound.

    line 172

“Common” is measured: kept by at least 6 in 10 of the 27 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Rebase onto upstream/main, conflict-by-conflict, RPython-first

Why this skill exists

The working branch has drifted from upstream/main over time. Rebasing pulls upstream/main's progress under our work so that subsequent merging, reviewing, and landing operate against an up-to-date base. Two things make this rebase non-routine:

  1. The base is a freshly-fetched remote main, not local main. Rebase onto the published main the branch will ultimately land against. Do not fall back to the local main branch, which only moves when pulled and so may lag the remote; rebasing onto a stale local main leaves the branch still behind the real base.

    Fetch it first. A remote-tracking ref is only as current as the last fetch, and a stale one rebases the branch backwards onto a base that lacks already-merged work — silently, with zero conflicts, surfacing only as a compile error naming a symbol the dropped base provided.

    origin/main is not banned. It is a remote-tracking ref of the same kind as upstream/main, updated by the same fetch, and in this repository origin and upstream are the same URL — so preferring one and forbidding the other forbids an alias of what it mandates. The lag argument is about local main alone. Resolve the base per Step 1.5 and verify, rather than assuming which remote the user keeps current.

  2. Conflicts are not 50/50 choices. A conflict usually means both sides edited the same region with different intents. The right answer is almost always "whichever side matches RPython/PyPy upstream more faithfully" — sometimes that's ours, sometimes it's upstream/main's, and sometimes it's a blend taking individual lines from both. Picking a side wholesale loses information.

Commit boundaries do not reliably align with these semantic units. A single commit can contain five unrelated hunks; one hunk in that commit may belong to us and four to upstream/main. Therefore conflict resolution must operate on the hunk/region level, not on git checkout --ours / --theirs at file level.

Invocation

When the user types /rebase:

  1. Parse any follow-up text as scoping hints (e.g. /rebase finish what we started, /rebase skip the tests for now). Default is "rebase the current branch onto upstream/main, resolve every conflict".
  2. Do the prep work in Step 1 before touching git rebase.
  3. Execute the rebase per Steps 2–5.

Step 1 — Prepare the working tree

Goal: enter the rebase with a clean, conceptually-coherent commit history. Messy history makes conflict resolution harder because unrelated hunks pile up inside the same rebase step.

  1. Check state:

    git status --short
    git log upstream/main..HEAD --oneline
    git rev-parse --verify upstream/main
  2. Unstaged / untracked changes — if there is real uncommitted work, commit it. Use this convention: factual English message, no Co-Authored-By, no speculation about goals. If the changes are clearly WIP/scratch that should not land, confirm with the user before discarding or stashing.
  3. Squash WIP noise — if git log upstream/main..HEAD shows obvious fixups, revert-my-last-change, "typo", "trying X" commits, consolidate them with git rebase -i upstream/main (before the real rebase) or git reset --soft + fresh commits. Rationale: during the real rebase, each small WIP commit will re-apply and may re-introduce conflicts that were already resolved one commit later. Squashing these out collapses the noise.

    Squashing is not for consolidating meaningful commits into one giant commit. Keep commits that represent distinct concepts separate — it makes per-hunk conflict reasoning easier, because each step's diff stays narrow.

  4. Confirm the squash plan with the user before rewriting history, especially if the branch is shared.
  5. Resolve the base before invoking git rebase — see Step 1.5. Never fall back to local main.

Step 1.5 — Fetch, then resolve the base

The base is a remote main, and which remote holds the current one is a question to answer, not to assume.

  1. Fetch the candidates. This is cheap and it is what keeps a stale ref from silently rebasing the branch backwards:

    git fetch upstream 2>/dev/null; git fetch origin
  2. Read both tips:

    git rev-parse upstream/main origin/main 2>&1
  3. Choose:
    • They agree — the common case here, where origin and upstream are the same URL. Either name works; use upstream/main.
    • They disagree — do not pick silently. Show the user both tips and git log --oneline upstream/main..origin/main (and the reverse), and ask which is the base. One of them is ahead, and rebasing onto the other drops whatever it is ahead by.
    • upstream does not exist — use origin/main. It is a remote-tracking ref of the same kind; there is no reason to stop.
    • Neither exists — stop and ask the user to add and fetch a remote. Do not silently rebase onto local main.
  4. Record the resolved SHA. Step 5 verifies against it, and a peer rebase mid-run can move the branch under you.

Step 2 — Start the rebase

git rebase upstream/main

Substitute whichever base Step 1.5 resolved. If the rebase completes cleanly with no conflicts, skip to Step 5.

If the rebase refuses to start because of a dirty working tree, go back to Step 1.

Step 3 — Resolve each conflict per hunk, not per file or commit

When git rebase stops on a conflict, a single invocation may have produced multiple conflicted files, and each file may have multiple <<<<<<< / ======= / >>>>>>> regions. Each region is judged independently. Do not resolve them all the same way; do not run git checkout --ours / --theirs; do not accept IDE "Take Current" / "Take Incoming" bulk actions.

For each conflict region:

  1. Identify the semantic question. What did the current side (HEAD / upstream/main in a rebase — git flips ours/theirs during rebase; check git rebase --show-current-patch if unsure) change, and what did the incoming side (our branch's commit) change? State both intents in one sentence each before choosing.
  2. Locate the RPython/PyPy counterpart. Use the mechanical rule documented in the /parity skill — strip the crate root, swap .rs for .py, prepend the upstream root at ``. Open the upstream file. Read the region that corresponds to the conflicted region.

    If the mechanical rule fails to produce a valid path, read the /parity skill's "When the mechanical transform fails" section — the failure itself may indicate that one side of the conflict has drifted away from upstream structure, which is a strong signal about who to side with.

  3. Judge RPython-orthodoxy per region. Lean toward the side whose:

    • Structure matches the RPython file line-by-line (identifier names, argument order, control flow).
    • Dependencies (helper functions, types, fields referenced) exist in upstream.
    • Comments match or cite upstream.

    Against the side whose:

    • Names do not appear anywhere in rpython/ or pypy/ under the project root.
    • Added side tables, caches, or feature flags without upstream basis (see /parity's "Signals of NEW-DEVIATION").
    • Comments say // workaround, // pyre-only, // adaptation without a cited upstream line.
  4. Blend when both sides are partially orthodox. It is common that upstream/main fixed a real bug in the conflicted region and our branch renamed a variable in the same region. In that case the resolution is upstream/main's fix + our rename, not one or the other. Write the blended region by hand in the editor — do not rely on any conflict marker to auto-resolve a blend.
  5. If neither side is orthodox, fix the region to match upstream even if that means writing code different from both sides. A rebase is a legitimate moment to fix a pre-existing deviation in a hunk you had to touch anyway. Don't expand scope beyond the conflicting region, though — an unrelated clean hunk is out of scope for this skill.
  6. Cite the upstream line(s) consulted in a brief note the user will see when you summarize. This is how the user audits your conflict resolution after the fact without re-running the rebase.
  7. Remove the <<<<<<< / ======= / >>>>>>> markers and save.

After every region in a file is resolved, git add the file. Only after every conflicted file in the current rebase step is added, continue with Step 4.

Step 4 — Verify, then continue the rebase

Before git rebase --continue:

  1. Re-read the diff for this step to catch accidental deletions:

    git diff --cached
  2. For each resolved file, sanity-check that the logic compiles and matches upstream structure. If the file is Rust and the change is non-trivial, cargo check -p <crate> on the affected crate is cheap and catches obvious breakage before the next conflict compounds the damage. Full cargo test is overkill between steps — save that for Step 5.
  3. Continue:

    git rebase --continue
  4. If more conflicts appear, return to Step 3. Each conflict region gets the same RPython-first treatment.
  5. If at any step the rebase resolution is genuinely ambiguous and upstream gives no guidance, stop and ask the user rather than guess. Partial rebases can be stashed and resumed; a wrong silent resolution propagates through the rest of the rebase.

If things go badly wrong:

git rebase --abort     # returns to pre-rebase state; no work lost

--abort is safe — it's the designed undo. Prefer aborting and restarting over git rebase --skip of a commit you don't understand.

Step 5 — Final sanity check

After the rebase completes:

  1. git log upstream/main..HEAD --oneline — confirm the commit list is what was expected, and that the history is linear on top of upstream/main.
  2. Verify that the rebase kept the work. Commits that did not conflict must keep their patch-id (git show <sha> | git patch-id --stable, old against new). No commit may be emptied.
  3. Test only as much as the rebase changed, following AGENTS.md "How much to verify":
    • The pre-rebase tip was green (locally or on CI): run cargo check on the crates whose conflicts you resolved by hand. If a resolution blended logic from both sides, also run the tests that exercise that region. Do not rerun the full cargo test --all or pyre/check.py just because the base moved; CI does that.
    • The pre-rebase tip was never verified, or its last CI run was red: the rebase does not change that. Run the gate that the red, or the unverified change, calls for before the next push.
  4. Report to the user:
    • Number of conflicts resolved.
    • For each non-trivial resolution: file:line on our side, file:line upstream consulted, one-sentence justification.
    • What was verified (check, targeted tests, or full gate), and why that much.

Do not push, merge, or force-push unless the user explicitly asks.

Hard rules (recap)

  • Base is a remote main resolved and fetched per Step 1.5, never local main. Fetch before reading a tip; an unfetched ref is the one failure of this skill that produces no conflict and no error until compile time.
  • When upstream/main and origin/main disagree, ask which is the base — do not pick.
  • Every conflict region is judged individually. No bulk --ours / --theirs, no IDE "take all current", no trust-one-side-per-file shortcuts.
  • Every non-trivial resolution cites the upstream RPython/PyPy file:line it was judged against.
  • Commit any unstaged work (or explicitly stash with user consent) before starting the rebase.
  • Squash WIP noise only; do not collapse meaningful commits into one.
  • Never git push --force without explicit user instruction, even after a successful rebase.
  • When in doubt between two plausible resolutions, stop and ask the user — wrong silent resolutions compound.

Interaction with other skills

  • /parity — defines "RPython-orthodox" in detail (mechanical upstream path lookup, NEW-DEVIATION signals, structural vs functional parity). Read its body when a conflict requires judging orthodoxy and the summary above is insufficient.
  • /merge — separate workflow. /merge accumulates green slices on a <branch>-merge branch starting from upstream/main; /rebase rewrites the current branch on top of upstream/main in place. They are not interchangeable. Use /rebase when the goal is "my branch should be linear on top of current upstream/main"; use /merge when the goal is "I need a staging branch where pyre/check.py is always green".
  • /commit — the commit convention (factual English, no Co-Authored-By, no "improves X" speculation) applies to any commits this skill creates during Step 1 prep.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.