بنقرة واحدة
branch-squash
Squash branch commits into meaningful groups via scripted interactive rebase
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Squash branch commits into meaningful groups via scripted interactive rebase
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | branch-squash |
| description | Squash branch commits into meaningful groups via scripted interactive rebase |
Analyze commits on the current branch, propose meaningful groupings, and execute a scripted interactive rebase to squash them.
/branch-squash [<base-branch>]
/branch-squash — base branch auto-detected/branch-squash develop — squash against developIf the user provides a base branch as an argument, use it. Otherwise, auto-detect:
develop branch exists (git rev-parse --verify develop 2>/dev/null)develop exists and the current branch is not a release branch (release/*), use developmain/master and develop are reasonable targetsmain — or master if main does not existAlways confirm the detected base branch with the developer before proceeding. Show them: "I detected <branch> as the base. Is that correct?"
Run:
git log <base>..HEAD --merges --oneline
If merge commits exist, warn the developer and ask how to proceed:
If the developer chooses to continue, add --rebase-merges context to the rebase strategy. However, recommend aborting in most cases — a clean linear history is easier to squash.
Run:
git log <base>..HEAD --oneline --reverse
Display the full list to the developer so they can see what will be grouped.
Analyze the commits and propose meaningful groups. Follow these heuristics:
Grouping rules:
Commit message conventions for squashed groups:
Follow the <category>: <purpose> convention:
refactor, feature, fix, docs, tests, chore)Present the proposed plan as a table:
| Group | Commits squashed | Proposed message |
|-------|-------------------------------|-------------------------------------------------------------|
| 1 | abc1234, def5678, ghi9012 | refactor: read-side matrix access replaced with accessors |
| 2 | jkl3456, mno7890 | docs: naming conventions and demo-based test plan |
| 3 | pqr1234 | chore: branch planning files cleaned up |
Present the grouping plan and wait for explicit approval before proceeding. The developer may want to:
Do NOT proceed to the rebase until the developer confirms.
git branch backup-before-squash
Inform the developer: "Created backup branch backup-before-squash. Your original history is safe."
If a branch named backup-before-squash already exists, append a timestamp:
git branch backup-before-squash-$(date +%Y%m%d-%H%M%S)
Do NOT use git rebase -i interactively — it requires terminal input that is not supported.
Instead, use the scripted rebase approach:
/tmp/rebase-editor.sh:cat > /tmp/rebase-editor.sh << 'REBASE_SCRIPT'
#!/bin/bash
cat > "$1" << 'EOF'
pick <first-hash-of-group-1> <short description>
fixup <second-hash-of-group-1> <short description>
fixup <third-hash-of-group-1> <short description>
exec git commit --amend -m "<squashed commit message for group 1>"
pick <first-hash-of-group-2> <short description>
fixup <second-hash-of-group-2> <short description>
exec git commit --amend -m "<squashed commit message for group 2>"
pick <hash-of-final-commit> <short description>
EOF
REBASE_SCRIPT
chmod +x /tmp/rebase-editor.sh
Key rules for the todo file:
pick for the first commitfixup (not squash — avoids editor prompts)exec git commit --amend -m "..." line sets the final messagepick, no execgit log outputexec lines must not contain single quotes — use double quotesGIT_SEQUENCE_EDITOR=/tmp/rebase-editor.sh git rebase -i <base-branch>
If the rebase stops with an error:
git status to assess the situationgit rebase --continuegit rebase --abort to return to the pre-rebase stategit rebase --abort and inform the developer that the backup branch is intactNever force through a rebase with unresolved conflicts.
After the rebase completes successfully:
git diff backup-before-squash HEAD
This diff must be empty. If it shows any differences:
git reset --hard backup-before-squash to restore the original stateIf the diff is empty, report: "Verified: the rebased tree is identical to the original. No changes were lost."
Also show the new commit log:
git log <base>..HEAD --oneline
Ask the developer: "The backup branch backup-before-squash is no longer needed. Shall I delete it?"
git branch -D backup-before-squashClean up the temp script:
rm -f /tmp/rebase-editor.sh
Co-Authored-By line or reference AI in commit messages.Initialize Claude Code in a repository with standard project scaffolding. Use this skill whenever the user wants to set up Claude Code in a new repo, initialize claude configuration, run /init with extras, or mentions "ray-init". This goes beyond the built-in /init by adding gitignore rules, Sideways files, and a local planning doc.
Test-Driven Development discipline for writing code. Use this skill whenever writing new features, adding behavior, refactoring with tests, fixing bugs with regression tests, or when the user mentions TDD, red-green-refactor, test-first, failing tests, or asks to write tests before implementation. Also triggers when branch plans contain FAILING test tasks or test-first instructions.
Create a plan document for the current branch, or for a specified new/existing branch. The complete template and all instructions are provided below — do not search for examples elsewhere.
Plan and track a bugfix with diagnosis-first discipline — create a BUGFIX.<branch>.md working doc, trace the reported symptom to a proven root cause, and write a failing test that reproduces the bug BEFORE fixing it. Use when the user reports a bug to fix, asks to investigate or diagnose a defect, starts a bugfix branch, or mentions "ray-bugfix-plan". The complete template and all instructions are below — do not search for examples elsewhere.
Audit skill source files for personal references, credentials, and other publication blockers before mirroring them into the ray-ai-skills public repo. Use this skill whenever the user wants to audit one or more skills, check skills before publishing/syncing, look for hardcoded paths or sensitive content in skills, or asks "audit my skills". If no specific skills are named, audit every skill that has changed since the last sync (or is new and not yet mirrored).
Update the ray-ai-skills repo from source skills under ~/.claude/skills/ — audit, then sync, then stop before commit. Also handles adding a new skill to .shared-skills, removing a skill from the mirror, or auditing without syncing. Use this skill whenever the user wants to sync skills into the repo, publish skill changes, update the skills mirror, add a skill to the shared list, remove a skill from the shared list, or says "skills-update". Accepts natural-language targets like "sync all", "update ray-tdd and ray-commit", "remove ray-foo", "audit only", etc.