Skip to content

Add project-scoped skill for restructuring PR commit history - #4

Closed
dennisdoomen wants to merge 1 commit into
ChrisonSimtian:mainfrom
dennisdoomen:claude/inspiring-heisenberg-1775d4
Closed

Add project-scoped skill for restructuring PR commit history#4
dennisdoomen wants to merge 1 commit into
ChrisonSimtian:mainfrom
dennisdoomen:claude/inspiring-heisenberg-1775d4

Conversation

@dennisdoomen

Copy link
Copy Markdown

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-commits in any session rooted in this repo.

Changes

Add restructure-pr-commits skill

There 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 log to 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-lease and updating the PR title/description to match.

Cross-reference in AGENTS.md

Added a single line after the GenerateTools note in the Common commands section so the skill is discoverable without browsing the .claude/skills/ directory directly.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant