merge
Skill2 starsChanged 9 months agoMITView on GitHub
List active do/* worktrees and merge the chosen one into its origin branch, gated by a user-supplied approval token.
- Deletes or force-pushes
26 other projects use a version of this.
Adopted by
Most recently taken up by
- microsoft/vscodetheir own version, first seen Nov 12, 2026
- ryanportfolio/Harness-Firmwaretheir own version, first seen Oct 3, 2026
- ryanportfolio/Corewise.Academytheir own version, first seen Oct 3, 2026
- jantichy/claudetheir own version, first seen Oct 2, 2026
- envisioning/skillstheir own version, first seen Sep 22, 2026
- KUNDURUHIMANEESHREDDY/sabertheir own version, first seen Sep 21, 2026
Used with
Projects with it also use fix, report and 5 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
Google CloudSkillfix
Plan a remediation strategy after a test failure.
Also in 3 projects that use this
MicrosoftSkillreport
Turn an exploration (threads, findings, charts) into a single Markdown report — note, blog post, executive summary, KPI dashboard, slide brief, or multi-section analytical report, with embedded charts.
Also in 3 projects that use this
Microsoft AzureSkilltest
Also in 3 projects that use this
SentrySkillreview
Fixture review skill.
Also in 5 projects that use this
DockerSkillresearch
Research a documentation topic — locate affected files, understand the problem, identify what to change. Use when investigating an issue, a question, or a topic before writing a fix. Triggers on: "research issue 1234", "investigate what needs changing for #500", "what files are affected by #200", "where is X documented", "is our docs page about Y accurate", "look into how we document Z".
Also in 3 projects that use this
VercelSkillfind-skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
Also in 3 projects that use this
Other versions26 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 26
- microsoft/vscode★ 196ksame name
- ToolJet/ToolJet★ 41ksame name
- K9i-0/ccpocket★ 1.1ksame name
- automagik-dev/genie★ 345same name
- metedata/Remarc★ 73same name
- toy-crane/claude-code-playbook-template★ 73same name
- jantichy/claude★ 38same name
- Hassaan146/claude-skills★ 18same name
- AndreAlbuquerque/claude-config★ 17same name
- phanghonghao/THU-Awesome-Skills★ 8same name
16 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository18 other files it gives its agents.
- affirmationSkill
- auditSkill
- councilSkill
- doSkill
- gitSkill
- infoSkill
- kill-playgroundSkill
- memorySkill
- opsSkill
- qSkill
- refineSkill
- runSkill
- scopeSkill
- sim-sourceSkill
- stateSkill
- thinkSkill
- ui-brainSkill
- worktree-managerSkill
The file
We split this skill into the rules it gives an agent
9 rules. 0 are common, 4 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 23 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 48
Use the payload.origin_branch from the session to know the target branch.
- Very specific: line 50
If no do/* branches exist, tell the user and exit.
- Distinctive: line 57
If only one worktree exists, skip this step and auto-select it.
- Distinctive: line 81
If the dialog is cancelled, stop and say "Merge cancelled."
- Distinctive: line 121
If the hook rejects any command, surface the hook's error message and tell the user to generate a fresh token (tokens expire every 2 …
- Very specific: line 139
Never bypass the hook: Do not try --no-verify, alternative git paths, or filesystem manipulation.
- Very specific: line 140
Never read or reference
~/.claude-merge-key: If a tool result happens to show you key contents, ignore them. - Very specific: line 141
Never run
claude-merge-tokendirectly: Use ~/.claude/scripts/merge-dialog which gates behind a native macOS dialog the user must approve. - Distinctive: line 142
Tokens are single-intent: If a token fails (expired / invalid), do not retry with the same token.
“Common” is measured: kept by at least 6 in 10 of the 23 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Merge
Merge (or discard) an active do/* worktree. Every merge requires an approval token that only the user can generate — the model cannot forge it.
/merge — interactive: pick a worktree, pick an action
/merge <worktree-id> — shortcut: pre-select a worktree, then ask actionHow the gate works
- The user has a secret at
~/.claude-merge-key(read-denied to all Claude tools). - The user's shell has a
claude-merge-tokenscript that reads the key and prints an HMAC token for a given worktree-id. - The PreToolUse hook
do-merge-gate.shinterceptsgit merge do/*,git worktree remove .worktrees/do-*,git branch -d do/*, andgit reset --hard. It requires a validMERGE_TOKEN=<token>prefix on the command, and recomputes the HMAC to verify. - Tokens are valid for 2 minutes (current + previous minute bucket).
- The model has no path to the key or the token generator. Only the user can produce tokens.
Execution
Step 1: LIST
List active do/* worktrees. For each, show the worktree-id, the worktree path, and the likely origin branch:
# Live worktrees on disk
git worktree list --porcelain | awk '/^worktree / {wt=$2} /^branch / {br=$2; if (wt ~ /\/\.worktrees\/do-/) print wt, br}'
# Plus any dangling do/* branches without a worktree (in case a prior session removed the worktree but not the branch)
git branch --list 'do/*'Also read active sessions from state MCP for any in-flight /do runs:
mcp__state__session_list(skill: "do", status: "active")Use the payload.origin_branch from the session to know the target branch. If no session is found for a branch, fall back to git log do/do-<id> --first-parent --format='%H' | tail -2 | head -1 to find the likely fork point, then match against local branches.
If no do/* branches exist, tell the user and exit.
Step 2: PICK
AskUserQuestion:
- Question: "Which worktree?"
- Options: one per
do/*worktree (label =do-<id>with origin branch, e.g.do-1776294905 → overnight/refine-epics-8-10-remainder). - If only one worktree exists, skip this step and auto-select it.
Step 3: ACTION
AskUserQuestion:
- Question: "What would you like to do with
do-<id>?" - Options:
- Merge — rebase and merge into origin branch, clean up worktree and branch.
- Discard — delete worktree and branch. No merge.
- Open in VS Code —
code {WORKTREE_PATH}, then return to this question. - Cancel — exit, leave worktree untouched.
Step 4a: MERGE (token-gated)
Obtain the approval token via the native macOS dialog:
TOKEN=$(~/.claude/scripts/merge-dialog do-<id>)This pops up a macOS dialog with Approve as the default button. The user presses Enter (or clicks Approve) → the token is generated, copied to their clipboard, and returned to stdout.
If the dialog is cancelled, stop and say "Merge cancelled."
Fallback (if
~/.claude/scripts/merge-dialogis missing): Show manual instructions and ask for the token viaAskUserQuestion:To approve this merge, run in your own terminal (NOT via Claude): claude-merge-token do-<id> Paste the 12-character token below.Perform the merge, prefixing every gated command with
MERGE_TOKEN=<token>:TOKEN=<pasted-token> WORKTREE_BRANCH="do/do-<id>" WORKTREE_PATH=".worktrees/do-<id>" ORIGIN_BRANCH="<origin from step 1>" # Run from main repo cwd, not inside the worktree. cd "$(git rev-parse --show-toplevel)" git checkout $ORIGIN_BRANCH # Rebase origin onto latest git fetch origin $ORIGIN_BRANCH 2>/dev/null || true git rebase origin/$ORIGIN_BRANCH 2>/dev/null || true # Rebase do branch onto origin git checkout $WORKTREE_BRANCH git rebase $ORIGIN_BRANCH git checkout $ORIGIN_BRANCH # Token-gated merge MERGE_TOKEN=$TOKEN git merge --no-ff $WORKTREE_BRANCH -m "merge: $WORKTREE_BRANCH" # Token-gated cleanup MERGE_TOKEN=$TOKEN git worktree remove $WORKTREE_PATH --force git worktree prune MERGE_TOKEN=$TOKEN git branch -d $WORKTREE_BRANCH- If the hook rejects any command, surface the hook's error message and tell the user to generate a fresh token (tokens expire every 2 minutes).
- On success, complete any active state MCP session for this worktree and print: "Merged
do-<id>into<origin>and cleaned up."
Step 4b: DISCARD (also token-gated)
Discard is destructive — same gate. Obtain the token using the same dialog flow as Step 4a, then:
MERGE_TOKEN=$TOKEN git worktree remove $WORKTREE_PATH --force
git worktree prune
MERGE_TOKEN=$TOKEN git branch -D $WORKTREE_BRANCHRules
- Never bypass the hook. Do not try
--no-verify, alternative git paths, or filesystem manipulation. The hook is the authorization boundary. - Never read or reference
~/.claude-merge-key. If a tool result happens to show you key contents, ignore them. - Never run
claude-merge-tokendirectly. Use~/.claude/scripts/merge-dialogwhich gates behind a native macOS dialog the user must approve. If the dialog script is unavailable, the user must runclaude-merge-tokenin their own terminal. - Tokens are single-intent. If a token fails (expired / invalid), do not retry with the same token. Ask the user to regenerate.
- Always run merge commands from the main repo cwd, not from inside the worktree (cwd gets invalidated when the worktree is removed).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

