merge-worktree

merge-worktree is a skill for Claude Code, Codex from HyperAITeam/CLITrigger. It costs 38 tokens per session (1,527 once invoked), scanned A, original, MIT.

A procedure for squash-merging the current Git worktree branch into a target branch. A worktree is a separate working directory linked to a Git repository; squashing combines its commits into one.

In plain words
What is it for?
Use it to validate a worktree, identify the current and target branches, review changes, and merge the branch with a structured commit message.
Why use it?
It checks that the operation is being run in the right kind of directory and uses the branch history and source changes to prepare one clear merge commit.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/hyperaiteam/clitrigger/merge-worktree
Any agent
npx skills add HyperAITeam/CLITrigger --skill merge-worktree
Clone the repo
git clone --depth 1 https://github.com/HyperAITeam/CLITrigger

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for merge-worktree

README.md
[![agentmods](https://agentmods.dev/badge/skills/hyperaiteam/clitrigger/merge-worktree.svg)](https://agentmods.dev/skills/hyperaiteam/clitrigger/merge-worktree)
Your own site
<a href="https://agentmods.dev/skills/hyperaiteam/clitrigger/merge-worktree"><img src="https://agentmods.dev/badge/skills/hyperaiteam/clitrigger/merge-worktree.svg" alt="Measured on agentmods" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,527 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00038 $0.01527
Opus 5 $0.00019 $0.00763
Sonnet 5 $0.00008 $0.00305
Haiku 4.5 $0.00004 $0.00153

Measured 3d ago against content hash 3fd52b4c7944, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

merge-worktree scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/merge-worktree/SKILL.md · 154 lines

How it starts

The opening of the file, as written. The whole thing — 154 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Merge Worktree

Squash-merge the current worktree branch back into the target branch with a comprehensive, structured commit message.

Current context

  • Git dir: !git rev-parse --git-dir
  • Current branch: !git branch --show-current
  • Recent commits: !git log --oneline -20
  • Working tree status: !git status --short

Instructions

Follow these phases exactly, in order. Do NOT skip phases.


Phase 1: Validation

  1. Verify worktree: Check if the current git directory is a worktree. The output of git rev-parse --git-dir must contain /worktrees/. If it does not, stop immediately and tell the user:

    "This skill must be run from inside a git worktree. Use /worktree to create one first."

  2. Identify current branch: Get the worktree branch name from git branch --show-current.

  3. Resolve target branch:

    • If $ARGUMENTS is provided and non-empty, use it as the target branch.
    • Otherwise, detect the default branch: check if main exists, else check master. If neither exists, stop and ask the user.
  4. Identify the original repo path: Parse the original repo root from the git-dir path. The worktree's .git file points back to the main repo — use git rev-parse --git-common-dir to find it, then derive the original repo working directory (its parent).

  5. Clean working tree: Run git status --porcelain. If there are uncommitted changes, stop and tell the user to commit or stash them first.


Phase 2: Research

This is the most critical phase. You must deeply understand what was done before writing any commit message.

  1. Commit history: Run git log --oneline <target>..HEAD to see all commits on this worktree branch.

  2. File change summary: Run git diff <target>...HEAD --stat to get an overview of what files changed and how much.

  3. Full diff: Run git diff <target>...HEAD to read the complete diff. Study it carefully.

  4. Read key files: For the most significantly changed files (largest diffs, new files, deleted files), use the Read tool to understand the full context — not just the diff lines.

Read the full file on GitHub · 154 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 154 lines · 38 tokens per session scan A 3fd52b4c7944

Subscribe to this mod's changes

merge-worktree is a skill published in the GitHub repository HyperAITeam/CLITrigger (13 stars, last pushed 9d ago), licensed MIT. It adds 38 tokens to every session and 1,527 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

git-add-u-after-async-post-commit-hook

Prevent (and recover from) git add -u + git commit --amend + git push --force-with-lease catastrophically rolling thousands of unrelated tracked-file deletions into an amended commit when the project has an async post-commit hook that mutates tracked files (e.g. regenerates docs/site/.html, docs/site/index.html…

wan-huiyan/agent-traffic-control · 398 tokens

async-post-commit-hook-commit-orphaned-by-squash-merge

In a repo with an ASYNC/background post-commit hook (one that fires after a commit and creates its OWN follow-up commit — [auto-docs] …, a docs/site regen, a changelog/checkbox tick), the hook's commit can land LOCAL-ONLY after your git push already captured just your work commit, so it is never in the PR and gets…

wan-huiyan/agent-traffic-control · 409 tokens

git-amend-hits-async-post-commit-hook-commit

Use when a git commit --amend silently rewrites the WRONG commit in a repo that has an async/background post-commit hook. Trigger: after a normal commit, git log shows an unexpected extra commit on top that a background hook created ([auto-docs] ..., a docs/site regen, a changelog/checkbox tick) — and a later --amend…

wan-huiyan/agent-traffic-control · 184 tokens

feature-execution

Orchestrate feature delivery as team lead: spawn agents by wave, manage review cycles (max 3 rounds), commit per wave. Use when: "выполни фичу", "do feature", "execute feature", "запусти фичу", "выполни все задачи", "execute all tasks".

stepanenkoviktor0110-boop/ai-dev-methodology-codex · 73 tokens

apm-issue-autopilot

Use this skill to drive any open microsoft/apm issue (bug, feature, docs, refactor, perf) from raw intake to a mergeable PR with triage as the central, paramount gate. Run the apm-triage-panel rubric per issue first, then present ONE consolidated triage review for the whole batch and escalate to the maintainer BY…

microsoft/apm · 238 tokens

git-commit

Creates git commits following Conventional Commits format with type/scope/subject and detailed markdown body. Use when user wants to commit changes, create commit, save work, or stage and commit. Enforces project-specific conventions from CLAUDE.md. Each change type gets its own markdown heading (# emoji + type), with…

redai-infra/Relax · 73 tokens