ワンクリックで
md-squash
Squash branch commits into one coherent commit with standard layout
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Squash branch commits into one coherent commit with standard layout
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | md-squash |
| description | Squash branch commits into one coherent commit with standard layout |
| disable-model-invocation | false |
Squash all commits on the current branch (relative to a base branch) into a single well-structured commit. Follow every step below in order.
The user may provide arguments after /md-squash:
master).Parse these from the arguments. Examples:
/md-squash — squash against master, no extra context./md-squash main — squash against main./md-squash master this work adds a new caching layer — squash
against master with extra context.master).git merge-base HEAD <base-branch> to find the fork point.git log --format='%H %h %s' <merge-base>..HEAD to get all commits
to squash. If there are 0 or 1 commits, abort — nothing to squash.git log -1 --format='%B' <sha> to get the full
commit message body.git diff <merge-base>..HEAD to see the full diff.Before any destructive operation, create a backup branch:
git branch "$(git rev-parse --abbrev-ref HEAD)-squash-backup-$(date +%Y%m%d-%H%M%S)"
Confirm the branch was created successfully before proceeding.
Look at the commitlint keywords used across all the commits being squashed. If they all use the same keyword, use that. If they differ, ask the user which keyword to use, showing them the list of keywords found.
Look at the commit messages for a ticket ID (e.g. PROJ-123). If exactly one ticket ID is found consistently, use it. If multiple conflicting ticket IDs are found, ask the user which one to use. If none is found, ask the user:
No ticket ID found in the commit messages. Is there a relevant ticket to include in the title?
Concatenate all the individual commit messages' sections together, then produce ONE commit message with the following template. Apply the pruning rules described in each section.
<keyword>: <optional ticket> <short summary>
Changes:
- Bullet points describing what changed in the code.
- Be literal and precise.
- PRUNING: remove intermediate issues that were resolved
within the branch (e.g. fixing a build broken by an earlier
commit, intermediate refactoring of something introduced in
this branch). These are irrelevant to the final state.
- PRUNING: omit tiny details — this should NOT reproduce
everything in the diff.
- LIMIT: maximum 8 bullet points. Prioritise the most
important, user-visible, or architecturally significant
changes.
Context:
- Why we're making the change: the top-level reasoning, goal,
and key takeaways.
- LIMIT: maximum 3 bullet points. Focus on the high-level
"why" and "what we're trying to achieve".
- If the top-level reasoning is not extremely clear from the
commit messages and diff, ASK the user before writing this
section.
Review:
- Aggregate all review items from the individual commits.
- COV: aggregate all test-coverage items into 1-2 bullets max.
- Keep all other review keywords (RISK, MISSING, DECISION,
LATER, REFACTOR), EXCEPT remove items about intermediate
issues that have since been resolved within the branch.
Prompts <short-hash> (<FULL original commit title>):
- "Verbatim user quotes from this commit's prompts section."
- Preserve question/answer nesting as in md-commit format.
Prompts <short-hash> (<FULL original commit title>):
- "Verbatim user quotes from this commit's prompts section."
... (one Prompts section per original commit that had prompts)
IMPORTANT: The parenthesised title in each Prompts heading MUST be
the FULL original commit title line, including the keyword and
ticket ID. For example:
Prompts 05115fd (feat: IMP-30 improve SQS honeycomb tracing):
NOT:
Prompts 05115fd (improve SQS honeycomb tracing):
Do NOT strip the keyword or ticket from the title.
If the prompts were part of a question/answer, include them like this:
Prompts (
Prompts (
IMPORTANT: You MUST run ,wrap-message to wrap the message. Do NOT attempt to wrap lines yourself — the LLM cannot reliably wrap text.
Compose your draft commit message with NO attempt at wrapping — just write natural-length lines.
Reset and commit in one go:
git reset --soft <merge-base> && ,wrap-message <<'DRAFT' | git commit -F -
your message here
DRAFT
If the user wants changes after seeing the commit, amend by
repeating from step 1 with git commit --amend -F - instead.
Do NOT show the user text you composed yourself — only show the output of ,wrap-message.
Using the temp file saved in Step 1, add a git note to the new squashed commit containing the original commit information:
git notes add -m "<note content>" HEAD
The note should contain:
Squashed from the following commits:
<full SHA> <short hash> <oneline summary>
<full SHA> <short hash> <oneline summary>
...
--- Full original commit messages ---
commit <full SHA> (<short hash>)
<full commit message body>
commit <full SHA> (<short hash>)
<full commit message body>
...
Run git log -1 and git notes show HEAD to confirm everything looks
correct. Report the backup branch name to the user.