skills/mine.worktree-rebase/SKILL.md
Use when the user says: "rebase this worktree" or "sync worktree to parent branch". Detects the parent repo's current branch and rebases this worktree onto it.
npx skillsauth add NodeJSmith/Claudefiles mine.worktree-rebaseInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
$ARGUMENTS — optional, natural language. Parse for two things:
feature/jsmith/foo, main). If provided, skip auto-detection and rebase onto this branch.force, just rebase, no prompt, skip prompt, yes, -y. If present, skip Phase 4 confirmation.Both are independent and can be combined.
Examples:
/mine.worktree-rebase — auto-detect, confirm before rebasing/mine.worktree-rebase just rebase — auto-detect, no confirmation/mine.worktree-rebase feature/jsmith/foo — explicit branch, confirm/mine.worktree-rebase feature/jsmith/foo force — explicit branch, no confirmationgit rev-parse --git-dirgit branch --show-currentgit-default-branchDetect whether the parent repo is currently on a non-default branch, and offer to rebase this worktree onto it. For best results, run this immediately after entering a new worktree.
Check the Context above. If the Git dir value does not contain worktrees/, stop immediately:
This skill only works from inside a git worktree. The current git dir is not a worktree path. Nothing to do.
If $ARGUMENTS contains a target branch (see Arguments), use that as <orig-branch> and skip to Phase 3.
Otherwise, auto-detect from the parent repo. Run these commands sequentially. Do NOT use $(...) command substitution (see CLAUDE.md bash restrictions).
Step 1 — Get the shared git directory:
git rev-parse --git-common-dir
Note the output — call it <common-git-dir>.
Step 2 — Derive the original repo root. Use the exact path from Step 1 — substitute it directly (no pipes, no xargs — handles spaces in paths correctly):
dirname <common-git-dir>
For example, if Step 1 returned /home/jessica/Claudefiles/.git, run dirname /home/jessica/Claudefiles/.git. Note the output — call it <orig-root>.
Step 3 — Read the current branch of the original repo. Use the exact path from Step 2:
git -C <orig-root> symbolic-ref --short HEAD 2>/dev/null
<orig-branch>.<orig-branch> as the default branch (no rebase needed).Compare <orig-branch> to the default branch from Context.
If they are the same → stop with a friendly message:
The parent repo is currently on
<default-branch>. No rebase needed.
Display a summary:
Parent repo branch : <orig-branch>
Worktree branch : <current-branch>
Worktree base : origin/<default-branch>
This worktree's base is assumed to be `origin/<default-branch>`, but the parent repo is currently on `<orig-branch>`.
Rebasing will move this worktree's commits on top of `<orig-branch>`.
If $ARGUMENTS indicates skipping confirmation (see Arguments), proceed directly to Phase 5.
Otherwise, ask the user to confirm using AskUserQuestion:
<current-branch> onto <orig-branch>?"Worktree rebaseYes — rebase onto <orig-branch> (description: git rebase --onto <orig-branch> origin/<default-branch>)No — leave as-is (description: Keep the current base (origin/<default-branch>))If the user selects "No", stop with: "No changes made."
Verify the working tree is clean before rebasing:
git status --porcelain
If the output is non-empty, stop with:
The working tree has uncommitted changes. Commit or stash them before rebasing.
Fetch to ensure refs are current before rebasing:
git fetch origin
Then run:
git rebase --onto <orig-branch> origin/<default-branch>
If the rebase succeeds (exit 0):
git log --oneline -5
Then confirm:
Rebase complete.
<current-branch>is now based on<orig-branch>.
If the rebase exits non-zero (conflict), print:
Rebase conflict. Resolve the conflicts, then run:
git rebase --continueOr to abort and return to the original state:
git rebase --abort
Do not attempt to auto-resolve conflicts. Stop here.
development
Use when the user says: "document how X works", "write up how this works", "durable explanation", "explain this for the docs", "document this subsystem". Writes a durable, architectural-altitude explanation that survives code churn.
development
Use when picking up a fresh session after /clear, a stop, or an unanswered AskUserQuestion. Reconstructs the prior session's intent from its transcript tail and surfaces any unresolved decision; user-invoked only — for a hand-written end-of-day handoff use /mine-good-morning instead.
development
Use when the user says: "what did we discuss", "continue where we left off", "remember when", "as I mentioned", "you suggested", "we decided", "search my conversations", "find the conversation where", "what did we work on", or uses implicit signals like past-tense references, possessives without context, or assumptive questions. Direct search over past Claude Code sessions via cass.
tools
Use when the user says: "what context do I have", "relevant history for this task", "what have we done related to this". Also usable proactively when starting work that likely has prior history. Assembles a structured context brief from past session history via cass, scoped to the current task and workspace.