reorganize-branch-commits
Reorganize the commits on a non-default git branch into a clean, logical history by rewriting the branch — `git reset` + re-commit by default, `git rebase -i` when commit boundaries already align. Propose groupings based on the actual work done (features, refactors, tests, fixes, docs), get explicit user approval, back the branch up, then rewrite history. Use this skill whenever the user wants to tidy up, clean up, reorganize, restructure, squash, or curate commits on a feature branch — even if they phrase it as "my branch is a mess", "squash this down", "combine these commits", "fix up the commit log before I open a PR", or "make the commits presentable for review". Trigger proactively when the user is about to open or push a PR and the branch has scrappy/WIP/"fix" commits to collapse. Refuses to operate on default or release-shaped branches (main, master, develop, trunk, production, release, or the repo default) — a feature-branch-only tool.
- License 许可
- MIT
- 所属仓库
- esond/skills
- 最近更新
- 2026-11-07
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- reorganize-branch-commits
- description
- Reorganize the commits on a non-default git branch into a clean, logical history by rewriting the branch — `git reset` + re-commit by default, `git rebase -i` when commit boundaries already align. Propose groupings based on the actual work done (features, refactors, tests, fixes, docs), get explicit user approval, back the branch up, then rewrite history. Use this skill whenever the user wants to tidy up, clean up, reorganize, restructure, squash, or curate commits on a feature branch — even if they phrase it as "my branch is a mess", "squash this down", "combine these commits", "fix up the commit log before I open a PR", or "make the commits presentable for review". Trigger proactively when the user is about to open or push a PR and the branch has scrappy/WIP/"fix" commits to collapse. Refuses to operate on default or release-shaped branches (main, master, develop, trunk, production, release, or the repo default) — a feature-branch-only tool.
02 资源文件 1
- 参考文档agents/openai.yaml133 B
03 SKILL.md 正文
reorganize-branch-commits
Rewrite the commits on a feature branch into a clean, logical history. Every commit from the base forward gets a new hash.
Step 1 — check the branch
The repo default is git symbolic-ref refs/remotes/origin/HEAD --short | sed 's@^origin/@@'. The base is git merge-base HEAD origin/<default>, unless the user names another (a branch stacked on another feature branch).
Stop and tell the user if any of these hold:
- HEAD is detached, or the branch is
main,master,trunk,develop,production,release, or the repo default. git statusshows uncommitted changes or an in-progress rebase, merge, or cherry-pick. A reset would fold uncommitted edits into the new commits.- The branch has fewer than two commits past the base.
Step 2 — propose a history
Read git log --name-status <base>..HEAD and the diffs behind it. Group by what the diffs actually do, not by the existing messages: one logical change per commit, refactors before the feature that needs them, and "wip" / "fix typo" / "address review" commits folded into the change they serve. Match the subject style of recent commits on the default branch.
Present a numbered list of new commits, each with its subject, the source commits folded into it, and the files it touches. Every existing commit must be accounted for. Flag merge commits (they'll be flattened) and commits by other authors (a reset re-attributes them to the current user).
If the branch has an upstream, say that finishing will need a force push. Don't rewrite anything until the user approves the proposal.
Step 3 — back up
git branch "backup/<branch>/$(date -u +%Y%m%dT%H%M%SZ)"
Tell the user the backup's name; git reset --hard <backup> restores the original branch.
Step 4 — rewrite
git reset <base>, then stage and commit each group in order. Use git add -p when one file's hunks belong to different groups. Let hooks run; never pass --no-verify.
Use git rebase -i <base> instead when the existing commit boundaries already match the groups, or when other authors' commits must keep their authorship. If it stops on a conflict, report the paths and let the user decide whether to resolve or abort.
Step 5 — verify and hand off
git diff <backup> HEAD must be empty. If it isn't, show the user the difference: a missed hunk goes into a commit, while hook output (formatters, codegen) needs the user's OK. Then show git log --oneline <base>..HEAD.
Once the diff is empty or the user has accepted what's left, ask whether to push, and push only on a yes: git push --force-with-lease if the branch has an upstream, otherwise git push -u origin <branch>. Never use plain --force.
After the push succeeds, offer to delete the backup with git branch -D <backup>, and keep it if the user declines.
04 同仓库更多 Skills
work-item-voice
Write or edit the user's issues in their own voice, in any work tracker — Jira, Linear, GitHub Issues, Azure DevOps. Covers features (new behavior), tasks (work that needs doing), and bugs (behavior that does not match expectation). Load this whenever the deliverable is an issue body, whether they say "file a bug", "write a ticket", "draft a story", "create an issue for this", "turn this into a Jira", "write this up in Linear", or paste a thread and ask for an issue out of it. Load it too whenever text goes into an issue that already exists — "record this in the issue", "add what we found to the ticket", "note this on the card", "update the one about refunds", or naming an issue by its key and asking for a fact to go in it — and when writing or updating one is a step inside a larger task. Features get behavior-driven framing with no implementation prescribed, and bugs get expected versus actual. Not for a comment on an issue, which is a conversation turn.
conversational-voice
Write the user's side of a conversation with another person, in the user's own voice: Slack messages and replies, DMs, email, PR and code-review comments, Linear or Jira comments, and any other turn in an exchange that goes out under the user's name. Load this whenever the deliverable is a message a human will read as written by the user, whether they say "draft a Slack message", "reply to this", "how should I word this", "tell the team", "ask them about X", "send a note to", or just paste a thread and ask what to say back. Load it too when tightening, shortening, or sanity-checking a message they already wrote, and when a message is one step of a larger task. The register is direct and informal, the way they'd talk to a friend or acquaintance, with the answer up front for a reader who skims. Not for something the user authors rather than sends — an issue body, a PR description, a commit message — even though a person reads those too.
sync-core-repo-docs
Create or audit a repo's three core doc files — README.md, the agent instructions file (AGENTS.md or CLAUDE.md), and REVIEW.md — in that dependency order. If a file is missing, generate it from the codebase; if it exists, audit it against the current code and apply targeted fixes after confirmation. README.md gets a developer from clone to running the project; AGENTS.md captures coding guidance for the agent (delegating to /init or claude-md-improver); REVIEW.md holds guidance for code reviewers, human or automated, without duplicating AGENTS.md. Target files with --readme, --claude, and --review, or run all three. Use whenever the user wants to set up, bootstrap, scaffold, refresh, audit, update, or sync a repo's docs, or says things like "create a README", "is my README still accurate", "write a CLAUDE.md", "write an AGENTS.md", "audit our docs", or "get this repo ready for contributors" — even when only one file is named. Prefer it over claude-md-improver when README or REVIEW are also in scope.
sync-core-docs
Create or audit a repo's README.md, AGENTS.md/CLAUDE.md, and REVIEW.md docs.
righting-software-system-design
Opt-in, collaborative system-design workflow based on Juval Löwy's iDesign methodology in *Righting Software*. Conducts a multi-phase interview (framing → use cases → volatility analysis → components → call-chain validation → report) that surfaces unknown-unknowns and produces a written recommendation at `decompositions/{system-name}/report.md`. **Run only when the user explicitly invites this workflow** — not for general architecture questions, lightweight design conversations, or quick "where should X live?" questions. Valid triggers: the user names the skill directly, references *Righting Software* / Juval Löwy / iDesign / "The Method" / volatility-based decomposition and asks to run a full session, asks for a "deep" or "structured" or "Löwy-style" system design session, or accepts a prior suggestion to run it. Wait for an explicit yes before entering Phase 0. The skill is interrogative — a back-and-forth interview that challenges each volatility candidate and proposes ones the user hasn't considered.
pr-review-resolver
Address outstanding review feedback on a GitHub pull request: unresolved review threads, submitted review bodies, and general PR comments. Triages each critically, fixes what it agrees with, and pushes back on the rest. Use whenever the user wants to address, fix, resolve, or work through PR review comments or feedback, even if they just say "handle the PR comments", "fix what the reviewers said", or "go through the PR", or pastes a PR URL and asks you to act on the feedback there.