Agent Skillstimeplus-io/proton › create-worktree

create-worktree

GitHub

用于在Git仓库中创建隔离的工作树,支持子模块复用以优化速度和磁盘占用。适用于需要独立分支、干净工作副本或隔离构建测试的场景,确保源码、子模块和构建产物互不干扰。

.claude/skills/create-worktree/SKILL.md timeplus-io/proton

触发场景

用户希望在新分支上隔离工作 需要干净的本地工作副本 提及 worktree 或工作树 要在独立目录中处理特定Issue

安装

npx skills add timeplus-io/proton --skill create-worktree -g -y
更多选项

非标准路径

npx skills add https://github.com/timeplus-io/proton/tree/develop/.claude/skills/create-worktree -g -y

不安装直接使用

npx skills use timeplus-io/proton@create-worktree

指定 Agent (Claude Code)

npx skills add timeplus-io/proton --skill create-worktree -a claude-code -g -y

安装 repo 全部 skill

npx skills add timeplus-io/proton --all -g -y

预览 repo 内 skill

npx skills add timeplus-io/proton --list

SKILL.md

Frontmatter
{
    "name": "create-worktree",
    "description": "Create a Proton git worktree with local submodule reuse. Make sure to use this skill whenever the user wants to work on a separate branch in isolation, needs a clean working copy, or mentions worktrees, even if they just say 'I want to start working on issue X in a separate directory'."
}

Create Worktree

Default policy

Use a dedicated worktree by default for any task that writes code, creates a branch/commit, or needs isolated build/test output.

Do not pay the worktree cost for pure read-only tasks such as code search, documentation lookup, or review-only requests unless the user explicitly asks for isolation.

What it does

Creates a worktree without re-downloading the repo's submodule data. This repo has a large contrib/ tree, so submodule reuse matters for both speed and disk usage.

The script isolates three things together:

  • source-tree changes
  • submodule working trees
  • build/test artifacts that must stay bound to one source root

Usage

Run the bundled script:

bash .claude/skills/create-worktree/scripts/create_worktree.sh <branch> [worktree-path]
  • branch (required): branch name (e.g. bugfix/issue-3446-session-watermark-regression)
  • worktree-path (optional): defaults to .worktrees/<safe-branch> under the repo root

The script will:

  1. Resolve paths and validate inputs
  2. Create the worktree (using existing local branch, remote tracking branch, or origin/develop as base)
  3. Reuse submodule git data via hardlinks when possible (falls back to full copy)
  4. Fix core.worktree pointers to reference the new worktree
  5. Materialize submodule working trees
  6. Validate submodule state
  7. Report the result with next steps

After the script completes

Initialize a build directory inside the worktree:

cd <worktree-path>
mkdir -p build && cd build && ../build.sh Debug

Do not replace this with direct cmake configure commands unless the user explicitly asks for that.

Do not reuse build* directories from the main checkout — CMake/Ninja build directories embed absolute source paths, so reusing them will either build the wrong tree or overwrite the original checkout's configuration.

Examples

# Feature branch with default worktree path
bash .claude/skills/create-worktree/scripts/create_worktree.sh bugfix/issue-3446-session-watermark-regression

# Custom worktree path
bash .claude/skills/create-worktree/scripts/create_worktree.sh chore/worktree-skill-build-isolation ../proton-worktree-skill-build-isolation

Notes

  • This is local-only and should not need network access if the main repo already has submodules initialized.
  • Build artifacts are not shared across source roots. Reconfigure/build inside the worktree you are validating.
  • Prefer this skill instead of inlining raw git worktree add.
  • To remove a clean worktree later (run from the main checkout, not from inside the worktree):
git -C /path/to/main/repo worktree remove <worktree-path>
  • If removal is blocked by uncommitted or untracked files, inspect or back up that work first. Only use forced cleanup when you intentionally want to discard it:
git worktree remove --force <worktree-path>

版本历史

  • 7be2219 当前 2026-08-20 08:20

同 Skill 集合

.claude/skills/alloc-profile/SKILL.md
.claude/skills/build-and-verify/SKILL.md
.claude/skills/ci-diagnostics/SKILL.md
.claude/skills/cpp-coding/SKILL.md
.claude/skills/review/SKILL.md
.claude/skills/sql-usage/SKILL.md

元信息

文件数
0
版本
7be2219
Hash
df15c18d
收录时间
2026-08-20 08:20

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-31 08:29
浙ICP备14020137号-1 $访客地图$