worktree

GitHub

管理 Git worktree,支持创建或复用隔离分支以进行特性开发、修复或审查,保留现有更改并可选启动开发环境。

agents/skills/worktree/SKILL.md AgentsMesh/AgentsMesh

触发场景

用户请求创建新的 worktree 需要为特性、修复或审查建立隔离工作环境

安装

npx skills add AgentsMesh/AgentsMesh --skill worktree -g -y
更多选项

非标准路径

npx skills add https://github.com/AgentsMesh/AgentsMesh/tree/main/agents/skills/worktree -g -y

不安装直接使用

npx skills use AgentsMesh/AgentsMesh@worktree

指定 Agent (Claude Code)

npx skills add AgentsMesh/AgentsMesh --skill worktree -a claude-code -g -y

安装 repo 全部 skill

npx skills add AgentsMesh/AgentsMesh --all -g -y

预览 repo 内 skill

npx skills add AgentsMesh/AgentsMesh --list

SKILL.md

Frontmatter
{
    "name": "worktree",
    "description": "Creates or reuses an isolated AgentsMesh Git worktree from a verified base branch, preserves existing changes, and optionally starts the worktree-scoped development environment. Use when the user asks for a new worktree or isolated work for a feature, fix, investigation, or review."
}

AgentsMesh Worktree

Create worktrees next to the main checkout under AgentsMesh-Worktrees.

Workflow

  1. Determine the requested branch name, base branch (default main), and whether the task actually needs a running development stack.

  2. Inspect repository state and identify the base remote from the user's request, the base branch upstream, or its URL:

    git status --short --branch
    git remote -v
    git worktree list
    

    Preserve all existing changes. Do not stash, reset, commit, or clean the main checkout as a side effect of worktree creation.

  3. Fetch the selected base:

    git fetch <base-remote> <base-branch>
    
  4. Derive a filesystem-safe directory name by replacing / in the branch with -. Use $(dirname "$repo_root")/AgentsMesh-Worktrees; do not embed a user-specific absolute path.

  5. Check whether the branch or path already exists. If the branch is new:

    git worktree add -b <branch-name> \
      <worktree-root>/<directory-name> \
      <base-remote>/<base-branch>
    

    If the branch already exists and is not checked out elsewhere, attach it without -b. Never delete or reset an existing branch to make the command succeed.

  6. In the new worktree, verify:

    git status --short --branch
    git log --oneline -3
    git merge-base --is-ancestor <base-remote>/<base-branch> HEAD
    
  7. Start the environment only when runtime verification is needed. Read references/dev-environment.md, run the appropriate Bazel lifecycle target, then load and report the generated deploy/dev/.env values.

Result

Report the absolute worktree path, branch, base ref and commit, whether the development stack was started, and the generated ports when applicable. Do not remove the worktree automatically; cleanup must preserve uncommitted or unpushed work.

版本历史

  • 9fc2f49 当前 2026-07-24 21:57

同 Skill 集合

agents/skills/arch-check/SKILL.md
agents/skills/e2e/SKILL.md
agents/skills/gh-merge/SKILL.md
agents/skills/github-gitlab-mirror/SKILL.md

元信息

文件数
0
版本
1f90b14
Hash
5134b14c
收录时间
2026-07-24 21:57

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-17 20:13
浙ICP备14020137号-1