Agent skill
git-hex-branch-cleanup
This skill should be used when the user wants to clean up a feature branch's history using git-hex (squash/fixup commits, reorder/drop/split commits, or rebase a branch onto main) without using an interactive terminal. Trigger phrases include: "clean up my branch", "polish history", "squash these commits", "fixup commits", "rebase onto main", "rewrite commits".
Install this agent skill to your Project
npx add-skill https://github.com/yaniv-golan/git-hex/tree/main/skills/git-hex-branch-cleanup
SKILL.md
Git-hex Branch Cleanup
When to use this Skill
This skill should be used when:
- The user says they want to "clean up", "rewrite", "polish", or "squash" a git history or feature branch.
- The user wants to rebase a branch onto another branch (e.g.
main) and present a clean, reviewable set of commits. - The user wants to split, squash, or reword commits using git-hex tools instead of manual interactive rebase.
Trigger phrases include: "clean up my commits", "squash fixups", "polish history", "rewrite commits", "rebase onto main", "make this branch reviewable".
Workflow
-
Plan first
- Call
git-hex-getRebasePlanto inspect the commit range you would modify. - Optionally call
git-hex-checkRebaseConflictsto estimate whether the rebase is likely to conflict.
- Call
-
Prepare changes
- For small edits to the last commit, prefer
git-hex-amendLastCommit. - For fixes to older commits, guide the user to edit and stage changes, then
use
git-hex-createFixuptargeting the original commit. - For large or mixed commits, consider
git-hex-splitCommitto separate files into focused commits.
- For small edits to the last commit, prefer
-
Apply the rewrite
- Use
git-hex-rebaseWithPlanto reorder, drop, squash, or reword commits. - Prefer
autoStash: trueandautosquash: truewhen the working tree is dirty, following git-hex documentation. - Never use git-hex on shared or protected branches; operate on feature branches the user controls.
- Use
-
Safety and recovery
- If the result is not what the user wanted, call
git-hex-undoLastto restore the previous state using git-hex backup refs. - If a rebase pauses with conflicts, hand off to the conflict resolution Skill.
- If the result is not what the user wanted, call
Tools to prefer
- Planning:
git-hex-getRebasePlan,git-hex-checkRebaseConflicts - History rewrite:
git-hex-rebaseWithPlan,git-hex-createFixup,git-hex-amendLastCommit,git-hex-splitCommit,git-hex-cherryPickSingle - Recovery:
git-hex-undoLast
Key constraints
rewordaction requiresmessagefield (without it, git opens an editor → hang).- Messages must be single-line (no TAB/newline characters).
- For reordering commits, set
requireComplete: truein the plan. - Prefer
fixupoversquashunless you need to combine commit messages. - Tools that perform their own auto-stash (
amendLastCommit,splitCommit,cherryPickSingle) exposestashNotRestoredwhen stash pop failed;rebaseWithPlanuses Git's native--autostashand does not emit this flag.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
git-hex-conflict-resolution
This skill should be used when the user is stuck in a git-hex-driven rebase, merge, or cherry-pick due to conflicts and wants the agent to inspect, resolve, and then continue or abort safely. Trigger phrases include: "resolve conflicts", "rebase is stuck", "conflict markers", "continue the rebase", "abort the rebase".
git-hex-pr-workflow
Complete pull request workflow combining git-hex (local craft) with remote collaboration (GitHub plugin or CLI). This skill should be used when the user wants to prepare, submit, and iterate on a PR with clean commit history. Trigger phrases include: "prepare a PR", "open a pull request", "address review feedback", "update my PR", "clean up commits for PR".
familiar-help
Use familiar companion tools for creative buddy/companion interactions. Handles fortunes, code roasts, haiku, stats, mood, lore, focus timers, and personality changes. Triggers when user addresses their companion by any name — "buddy" (Anthropic's UI label), "familiar", "companion", or whatever name the user uses for their companion — or by companion-specific intent: "tell me a fortune", "roast my code", "write a haiku", "show stats", "start a focus timer", "pomodoro", "be like Marvin", "change personality", "who are you", "what can you do". Do NOT use for normal code review, debugging, general coding help, or questions directed at Claude itself rather than the companion.
obsidian-vault
Search, create, and manage notes in the Obsidian vault with wikilinks and index notes. Use when user wants to find, create, or organize notes in Obsidian.
handoff
Compact the current conversation into a handoff document for another agent to pick up.
edit-article
Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft.
Didn't find tool you were looking for?