tidy-history
tidy-history, folds the commits of the current branch into one commit per change. Use whenever the user wants to tidy, clean up, squash or rewrite the history of a branch, fold fixups into the commits they finish, or when the pull-request skill pushes a branch.
- License 许可
- MIT
- 最近更新
- 2026-11-11
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- tidy-history
- description
- tidy-history, folds the commits of the current branch into one commit per change. Use whenever the user wants to tidy, clean up, squash or rewrite the history of a branch, fold fixups into the commits they finish, or when the pull-request skill pushes a branch.
- argument-hint
- [base]
03 SKILL.md 正文
Rebuilds the history of the branch checked out in the session's worktree, so a reviewer reads one commit per change. The tree stays the same.
Steps
-
Find the base. The base is the branch the user or the calling skill named, otherwise the
baseRefNameof the open pull request thatgh pr view --json number,baseRefNamefinds for the branch, otherwisedevwhen the remote has it and the current branch is another one, otherwise the default branch. Rungit fetch origin <base>.<fork>isgit merge-base origin/<base> HEAD. Stop and say why when the current branch is the base or has no commit beyond it. -
Check that the branch may be rewritten. Stop and say why when one of these holds.
-
The stage is not empty, so
git diff --cached --quietfails. -
A person has reviewed the open pull request, so the command prints more than 0, unless the user asks for the tidy anyway. Reviews of apps do not count.
gh api graphql -F owner='{owner}' -F repo='{repo}' -F number=<number> \ -f query='query($owner: String!, $repo: String!, $number: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $number) { reviews(first: 100) { nodes { author { __typename } } } } } }' \ --jq '[.data.repository.pullRequest.reviews.nodes[] | select(.author.__typename == "User")] | length' -
The remote holds commits the branch lacks.
git fetch origin <branch>succeeds andgit merge-base --is-ancestor origin/<branch> HEADfails. -
Layers of a stack build on the branch, so
gh pr list --base <branch> --state open --json numberlists a pull request, unless the calling skill rebases them after the push.
-
-
Name the changes. A reviewer reads one commit per change, such as a criterion of the issue, a refactoring it builds on or a diagram update. A commit that only finishes an earlier one of the branch belongs to that commit, such as a fix from a review or a check, a revert, a format or lint pass, or work in progress. Read
git log --reverse --format='%h %s%n%b' <fork>..HEADand name the changes. When the branch holds no more commits than changes, the history is tidy and this is the end. -
Rebuild the branch. Note
git rev-parse HEADas<old>.git reset --soft <fork>Commit the stage with the
commitskill, one commit per named change in the order of the old history, each with theRefsandClosestrailers its old commits carried. The commit skill prints its plan without waiting and takes the issue from those trailers. A change whose old commits carry none is committed without a reference. Thengit diff --quiet <old> HEADmust succeed. When it fails,git reset <old>restores the branch and leaves the working tree alone. -
Push the rebuilt history when the branch is on the remote. Report a rejected push and stop.
git push --force-with-lease origin <branch> -
Reply with the commits before and after the tidy, or why it did not run.
Done when the branch holds one commit per change with the tree of <old>, is pushed with lease when it is on the remote, or the reply says why the tidy did not run.
04 同仓库更多 Skills
why
Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Discovers available MCPs and queries each evidence category (source control, issue tracker, long-form docs, real-time chat, infrastructure observability, error tracking, product analytics warehouse) in parallel, then returns a cited read on decisions and tradeoffs. Use how for runtime behavior.
tdd
Use only when the user explicitly asks for TDD, a failing test, or a regression test, OR when the bug has an obvious cheap local test target. Skip when the test path is unclear, expensive, integration-heavy, or not requested.
swarm
Fan out N parallel workers, drain them, and return one report. Use for /swarm, 'swarm this', or parallel coverage, races, gauntlets, and exploration.
show-me-your-work
Keep a reviewable decision trail for long-running or unattended work: a TSV log with one row per decision (what, why, evidence, result). Local by default; commit it when a reviewer needs the trail to trust the result. Use for /show-me-your-work, autonomous or multi-phase runs, or work a human reviews after stepping away.
interrogate
Use for "interrogate", "adversarial review", "multi-model review", "challenge this", "stress test this code", "find blind spots", or "tear this apart". Multiple LLM reviewers challenge changes from independent angles.
how
Use for "how does X work", code walkthroughs before changing something, and placement / ownership / layering questions ("where should this live", "which package owns this", "is this the right layer"). Explains subsystem architecture, runtime flow, onboarding mental models. Use why for motivation.