skills/reimplement-branch/SKILL.md
Reimplement the current branch on a new branch with a clean, narrative-quality git commit history. Use when the user wants to clean up messy commits, create a tutorial-style commit history, or prepare a branch for review with logical, self-contained commits. Triggers on requests like "clean up my commits", "reimplement this branch", "create a clean history", or "make my commits reviewable".
npx skillsauth add ilamanov/skills reimplement-branchInstall 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.
Create a new branch with a clean, narrative-quality commit history from an existing branch's changes.
Run these commands to understand the current state:
git branch --show-current # Source branch
git status --short # Uncommitted changes
git log main..HEAD --oneline # Commits since main
git diff main...HEAD --stat # Full diff summary
Use the autonomous workflow when the user wants the agent to complete the entire reimplementation, verification, and PR flow end to end.
mainStudy all changes between source branch and main. Form a clear understanding of the final intended state.
git checkout main
git checkout -b <new-branch-name>
Use the user-provided branch name, or {source-branch}-clean if none provided.
Break the implementation into self-contained logical steps. Each step should reflect a stage of development—as if writing a tutorial.
Recreate changes in the clean branch, committing step by step. Each commit must:
Use git commit --no-verify for intermediate commits. Pre-commit hooks check tests, types, and imports that may not pass until full implementation is complete.
git diff <source-branch>--no-verify to ensure all checks passUse the /pr skill to create a pull request. Include a link to the original branch in the PR description.
Use this workflow when the user wants to collaborate on the reimplementation timeline, create one clean change at a time, or build a stack of PRs where each branch depends on the previous branch.
Record the source branch name and inspect its full diff against main, but do
not assume the source branch will be merged.
git branch --show-current
git status --short
git log main..HEAD --oneline
git diff main...HEAD --stat
Break the snapshot into reviewable milestones with the user. Prefer milestones that can stand alone as stacked PRs:
Do not start committing until the user confirms the initial timeline or the next branch to carve out.
It is okay, and often preferable, to break the snapshot into several small PRs instead of trying to make every branch correspond to the original feature's internal implementation order. Start by separating out changes that are independently useful and easy to review:
For each standalone change, create a branch from the current stack base, stage only that change, commit it, push it, and open a PR. The rest of the snapshot can remain as unstaged working-tree changes on top of the branch so the next PR can be carved out from the same source material.
When a standalone PR merges, temporarily stash the remaining unstaged snapshot changes, update the new stack base, create the next branch, and restore the snapshot changes:
git stash push --include-untracked -m "snapshot remainder before <next-branch>"
git switch main
git pull --ff-only
git switch -c codex/<next-change>
git stash pop
git restore --staged .
If restoring the snapshot conflicts with new main changes, resolve or reset
only the conflicted files needed for the current PR. Keep unrelated snapshot
work unstaged. This lets the agent and user repeatedly extract focused PRs while
preserving the rest of the source branch as local working-tree material.
Switch to the desired base, usually main, and apply the source branch diff into
the working tree without staging it.
git switch main
git diff main...<source-branch> | git apply
git status --short
Keep unrelated pre-existing worktree changes separate. If needed, unstage files without discarding content before starting the stack.
For the first PR, branch from main. For later PRs, branch from the previous PR
branch so the stack is explicit.
git switch -c codex/<change-name>
Stage only the files or hunks that belong to the current milestone. Leave the rest of the snapshot diff unstaged for later branches.
git add -p
git commit --no-verify
Use --no-verify for intermediate stacked commits when later milestones are
needed for the full app to pass checks.
Run the relevant focused checks for the current branch. Open a PR whose base is
the previous stack branch, or main for the first branch. Mention the source
snapshot branch in the PR description.
After each PR branch is created, continue from that branch, carve out the next milestone from the remaining unstaged snapshot diff, and repeat until the final stacked branch matches the source snapshot.
At the end, verify that the stack tip matches the snapshot:
git diff <source-branch>
tools
Generally-applicable conventions for how code is written and arranged — tooling/package manager, import style, file & component naming, comments, and where files live (colocation vs. global folders). Use whenever creating, naming, moving, or importing a file, running project commands, or deciding where a new module belongs. Consult BEFORE writing the code so the conventions are baked in, not retrofitted. If a convention below matches the work, apply it — don't ask, just follow it (call out the choice in one line so the user can override).
development
Generally-applicable frontend/UI best practices. Use whenever building, modifying, or reviewing UI — adding a form/button/dialog/modal, wiring keyboard shortcuts, creating any interactive surface that submits a form, or any time TSX/JSX is being written or edited. Consult BEFORE writing the code so the patterns are baked in, not retrofitted. If a scenario described in the skill body matches the work, apply the pattern — don't ask, just follow it (call out the choice in one line so the user can override).
tools
Generally-applicable backend/data best practices. Use whenever writing or modifying backend/data code — API routes, server actions, DB writes, background jobs, agent tools, import flows, webhooks, paste handlers, or anywhere data enters the system. Consult BEFORE writing the code so the patterns are baked in, not retrofitted. If a scenario described in the skill body matches the work, apply the pattern — don't ask, just follow it (call out the choice in one line so the user can override).
development
Runs on a schedule to mine recent Codex and Claude Code conversations across configured projects, find moments where things went off plan (the user had to steer, correct, abort, or re-explain), and propose targeted improvements to the specific skills that were in use at the time. Opens one pull request per run against the skills repo, with each proposed edit annotated with the concrete steering moment that motivated it. Also analyzes its own runs (the `skills` repo is one of the configured projects) so it iteratively improves itself. Use this skill when the user asks to "analyze recent conversations", "find what went wrong", "improve skills based on past runs", or sets up a scheduled run of skill-improver. Make sure to use this skill whenever the user mentions recursive skill improvement, post-mortem analysis of agent conversations, or automating skill quality based on real usage.