skills/custom/git-rebase-surgeon/SKILL.md
Safe Git history rewriting with pre-flight validation. Use when the user asks to rebase, squash commits, sync a branch with upstream, or rewrite history.
npx skillsauth add rockcookies/skills git-rebase-surgeonInstall 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.
Rewrite history safely — validate, operate, push with --force-with-lease.
Stop immediately if either check fails:
| Check | Command | Fail condition | Stop message |
|-------|---------|----------------|--------------|
| Clean tree | git status --short | Any output | "Stash or commit changes first" |
| Safe branch | git branch --show-current | main or master | "Never rebase a protected branch" |
Both must pass before proceeding.
| User says | Strategy | Command |
|-----------|----------|---------|
| Squash/edit last N, or a count like "3" | Interactive | git rebase -i HEAD~N |
| Sync with upstream / "pull rebase" | Rebase pull | git pull --rebase origin main |
| Move onto another branch | Standard | git rebase <branch> |
| Auto-squash fixups | Auto-squash | git rebase -i --autosquash <target> |
Run both pre-flight checks.
🔧 Rebase Plan
Target: HEAD~3
Strategy: Interactive
Command: git rebase -i HEAD~3
⚠️ This rewrites history. Force push required after completion.
Proceed? [y/n]
Run the rebase command.
When the rebase pauses, report the conflicting files from git status:
⚠️ Rebase Conflict
Conflicting files:
- src/api/handler.ts
- src/utils/parser.ts
Resolve in editor, then:
git add <resolved-files>
git rebase --continue
To abort: git rebase --abort
git push --force-with-lease
Always --force-with-lease, never --force.
tools
Turn the current conversation into a spec and publish it to the project issue tracker — no interview, just synthesis of what you've already discussed.
tools
Teach the user a new skill or concept, within this workspace.
development
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
documentation
Configure this repo for the engineering skills — set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.