Rework commits
Explicit-invocation workflow for safely reorganizing completed branch work into small, dependency-ordered, semantic Git commits, proving the rewritten tree matches the original result, and optionally pushing the polished history. Use only when the user directly invokes the rework-commits skill.From its SKILL.md
npx -y skills add himanshi-28/coding-agent-skills --skill rework-commitsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its file declares
Copied from the file, not written here
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
4.7 KB, 884 tokens by cl100k_base, as published. Nobody here has run it
Rework Commits
Optimize history for human review without changing the final code. Preserve a recovery path before rewriting anything.
Safety Rules
- Never rewrite a default, protected, or shared branch.
- Never use
git reset --hard, plaingit push --force, or automatic stashing. - Never include unrelated user changes, secrets, generated artifacts, or ignored files in a commit.
- Prefer non-interactive Git commands. Set
GIT_EDITOR=trueonly for commands that could otherwise open an editor. - Treat an explicit request to rework commits as authorization to rewrite local feature-branch history after creating the recovery point. Always obtain confirmation immediately before force-pushing previously published history.
Workflow
- Inspect repository state.
- Read applicable repository instructions.
- Identify the current branch, default branch, upstream, merge base, worktree status, in-progress Git operations, and commits unique to the branch.
- Stop on the default branch or during a merge, rebase, cherry-pick, or bisect.
- Require a clean, complete snapshot.
- Inventory staged, unstaged, and untracked files.
- If the worktree is dirty, do not stash or stage everything automatically. Ask the user to finish or scope the changes, or obtain approval for a temporary WIP snapshot containing explicitly listed in-scope files.
- Continue only when the intended final result is represented by a clean
HEAD.
- Establish the recovery point.
- Record the original branch name, commit hash, and tree hash.
- Create a uniquely named local backup branch under
backup/rework-commits-...pointing to the original tip and report its name. - Keep the backup until the rewritten branch is verified and any requested push succeeds.
- Determine the exact rewrite scope.
- Use the user-specified base when provided; otherwise derive the repository's default branch and merge base.
- Inspect the complete base-to-tip diff and every branch commit before planning.
- Exclude pre-existing upstream work and unrelated changes.
- Plan semantic commits before resetting.
- Give each commit one reviewable purpose and explain why it exists.
- Order prerequisites before dependents: schema and configuration, domain or backend behavior, API or integration, UI, then documentation or cleanup when applicable.
- Keep refactors separate from behavior changes unless separation would make either commit invalid.
- Pair tests with the behavior they verify, except for an intentionally protected test-first contract commit.
- Ensure each proposed commit leaves the repository coherent and is small enough to review independently.
- Rebuild the branch.
- Show the proposed commit sequence before rewriting.
- Reset the feature branch to the merge base with a non-destructive mixed reset so the final tree remains in the worktree.
- Stage explicit paths or hunks for one planned commit at a time; never use
git add .as a shortcut. - Inspect the staged diff, confirm it contains exactly one concern, then commit with a descriptive message that explains intent.
- Run focused verification for the commit when feasible before continuing.
- Prove content preservation.
- Confirm the worktree is clean.
- Compare the rewritten
HEADwith the original tip and require an empty diff; compare tree hashes when possible. - Review the new log and base-to-head diff to confirm every original change appears exactly once and no new content was introduced.
- If validation fails, stop and restore or offer recovery from the backup branch rather than improvising.
- Push only when requested.
- For an unpublished branch, push normally and set the upstream.
- If published history was rewritten, explain the impact and obtain confirmation immediately before using
git push --force-with-lease. - Never force-push a shared branch or use plain
--force.
- Finish the handoff.
- Keep the backup branch until push verification succeeds; remove it only with user approval.
- Use the
review-changesskill to run the final review and generate reviewer questions and pull-request context from the polished history.
Output
Report the merge base, recovery branch and original hash, final commit sequence, verification run per commit, proof that the final tree is unchanged, push status, and exact recovery instructions if anything failed.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.