Add project-scoped skill for restructuring PR commit history - #4
Closed
dennisdoomen wants to merge 1 commit into
Closed
Add project-scoped skill for restructuring PR commit history#4dennisdoomen wants to merge 1 commit into
dennisdoomen wants to merge 1 commit into
Conversation
Introduces a Claude Code skill that walks through the safe, step-by-step process for reshaping an existing PR's commits into focused, reviewable units. The workflow covers the subtleties that trip up naive rebases: using git diff (not git log) as the authoritative file list, isolating branch-own commits with --first-parent --no-merges, creating a backup branch before touching history, verifying the result is bit-for-bit identical, and gating the force-push behind explicit user confirmation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Claude Code project skill that safely restructures an existing PR's commit history into focused, reviewable commits. The skill is invokable as
/restructure-pr-commitsin any session rooted in this repo.Changes
Add
restructure-pr-commitsskillThere was no consistent, discoverable workflow for reshaping a PR's history after it had been published. Developers had to recall the steps from memory or quote them manually in a prompt, leading to mistakes — particularly around using
git logto identify changed files (unreliable on branches that have been merge-updated from upstream) and around force-pushing without user confirmation.The new skill codifies the correct 8-step procedure: determining the true file list via
git diff, isolating branch-own commits with--first-parent --no-merges, backing up the branch before any rewrite, building a fresh history on a clean branch, verifying the result is identical to the backup, waiting for explicit confirmation, then pushing with--force-with-leaseand updating the PR title/description to match.Cross-reference in AGENTS.md
Added a single line after the
GenerateToolsnote in the Common commands section so the skill is discoverable without browsing the.claude/skills/directory directly.