Token导航 LogoToken导航

Agent Skill · 研究检索

multi-worktree-dev(多工作树开发)

multi-worktree-dev 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

multi-worktree-dev 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证为 MIT,暂无第三方扫描结果,按安装量在研究检索类的 73,675 个 Skill 里排第 71,089。

总安装 196周安装 8GitHub Stars 公开资料未说明下载 63核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:multi-worktree-dev(多工作树开发)
来源仓库:https://github.com/mthines/gw-tools
仓库路径:skills/multi-worktree-dev
安装命令:
npx skills add mthines/gw-tools --skill "multi-worktree-dev"
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

AgentSkills.tonpx skills
npx skills add mthines/gw-tools --skill "multi-worktree-dev"

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

multi-worktree-dev 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词快速定位候选结果时使用。适用于研究检索类任务,可结合来源仓库和原始 README 核验具体用法。

通过 npx skills add mthines/gw-tools --skill "multi-worktree-dev" 安装。安装前建议确认权限范围、维护状态,以及是否会触发联网或文件读写操作。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/multi-worktree-dev

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add mthines/gw-tools --skill "multi-worktree-dev";命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

multi-worktree-dev 怎么安装?

在终端执行 npx skills add mthines/gw-tools --skill "multi-worktree-dev"。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

multi-worktree-dev 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

multi-worktree-dev 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add mthines/gw-tools --skill "multi-worktree-dev" 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

multi-worktree-dev 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

multi-worktree-dev 用的人多吗?

公开数据是累计安装 196 次,近一周安装 8 次,下载 63 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

multi-worktree-dev 安全吗?

没有查到第三方扫描结果,安全性无法从公开资料判断,安装前请自行审查源码、依赖和命令行为。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 许可证明确为 MIT,商用和分发边界好判断。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 没有第三方扫描结果,安全性只能靠自己读源码判断。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 要求有安全扫描结论才肯安装的团队。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
multi-worktree-dev

多工作树开发 · 本页

196—执行命令MIT未收录

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

name
@gw-multi-worktree-dev
description
Advanced patterns for developing across multiple Git worktrees simultaneously. Use this skill when managing dependencies across worktrees, synchronizing files, handling databases for multiple branches, running parallel tests, or orchestrating services across worktrees. Triggers on tasks involving multi-branch development, dependency sharing, database isolation, or service orchestration with gw.
license
MIT
metadata
author
mthines
version
1.0.0

Multi-Worktree Development - Comprehensive Guide

Advanced patterns for developing across multiple Git worktrees simultaneously.

Table of Contents

  1. Parallel Development Workflows
  2. Dependency Management
  3. File Synchronization
  4. Database and Service Management
  5. Testing Workflows
  6. Build Artifact Management
  7. Team Collaboration
  8. Performance and Optimization

1. Parallel Development Workflows

Benefits of Parallel Development

Working on multiple branches simultaneously eliminates:

  • Context switching overhead
  • IDE reindexing delays
  • Stashing/committing incomplete work
  • Mental context loss

Setting Up Multiple Worktrees

# Create worktrees for different features
gw add feat/user-auth
gw add feat/payment-gateway
gw add feat/email-notifications

# List all worktrees
gw list

Managing Mental Context

Strategy 1: Dedicated terminals

# Terminal 1: User Auth
gw cd feat/user-auth
npm run dev

# Terminal 2: Payment Gateway
gw cd feat/payment-gateway
npm run dev

Strategy 2: Terminal multiplexer (tmux)

# Create named sessions
tmux new -s auth
gw cd feat/user-auth

tmux new -s payments
gw cd feat/payment-gateway

# Switch between sessions
tmux attach -t auth
tmux attach -t payments

Strategy 3: IDE workspaces

VS Code multi-root workspace:

{
  "folders": [
    {"name": "Auth Feature", "path": "../feat/user-auth"},
    {"name": "Payments", "path": "../feat/payment-gateway"}
  ]
}

Quick Context Switching

# Fast navigation with partial matching
gw cd auth     # Matches feat/user-auth
gw cd pay      # Matches feat/payment-gateway

2. Dependency Management

Understanding the Problem

Each worktree has independent working files, including node_modules:

repo.git/
├── main/
│   └── node_modules/     # ~500MB
├── feat/user-auth/
│   └── node_modules/     # ~500MB (duplicate!)
└── feat/payment-gateway/
    └── node_modules/     # ~500MB (duplicate!)

With 5 worktrees: 2.5GB of duplicated dependencies!

Strategy 1: Accept Duplication (Simplest)

Pros: Full isolation, no conflicts Cons: Disk space usage

# Each worktree installs independently
gw add feat/new-feature
gw cd feat/new-feature
npm install

Best for: Testing different dependency versions, small projects.

Strategy 2: Use pnpm (Recommended)

pnpm uses a content-addressable store that deduplicates packages:

# Install pnpm
npm install -g pnpm

# In each worktree
gw cd feat/user-auth
pnpm install  # Uses shared store

gw cd feat/payment-gateway
pnpm install  # Reuses cached packages

Result: Near-zero duplication, full isolation.

Strategy 3: Symlink node_modules (Advanced)

Warning: Only works if all worktrees need identical dependencies.

# In feature worktree
gw cd feat/user-auth
rm -rf node_modules
ln -s ../main/node_modules node_modules

Risks:

  • Package version conflicts
  • Native modules may break
  • Hoisting issues

Best for: Read-only testing, identical environments.

Strategy 4: Post-Add Hook for Auto-Install

gw init --post-add "npm install"

Now every gw add automatically installs dependencies.


3. File Synchronization

Using gw sync

Sync files between worktrees without recreating them:

# Sync all autoCopyFiles from config
gw sync feat/user-auth

# Sync specific file from main to feature branch
gw sync feat/user-auth .env

# Sync from specific source
gw sync --from staging feat/user-auth .env

# Sync multiple files
gw sync feat/user-auth .env secrets/ config/local.json

Common Sync Patterns

Pattern 1: Update secrets across all worktrees

# After updating .env in main - sync autoCopyFiles to all worktrees
for worktree in $(gw list | grep -v main | awk '{print $1}' | xargs -n1 basename); do
  gw sync "$worktree"
done

# Or sync specific file
for worktree in $(gw list | grep -v main | awk '{print $1}' | xargs -n1 basename); do
  gw sync "$worktree" .env
done

Pattern 2: Propagate config changes

# Updated shared config in main
gw cd feat/user-auth
gw sync --from main feat/user-auth config/shared.json

Pattern 3: Hot-swap environment

# Test feature with production-like config
gw sync --from production-mirror feat/user-auth .env

Dry Run Mode

Preview what would be synced:

gw sync --dry-run feat/user-auth .env secrets/

4. Database and Service Management

Database Isolation Strategies

Strategy 1: Separate databases per worktree

# In feat/user-auth/.env
DATABASE_URL=postgresql://localhost:5432/myapp_auth

# In feat/payment-gateway/.env
DATABASE_URL=postgresql://localhost:5432/myapp_payments

Strategy 2: Docker Compose per worktree

Create docker-compose.worktree.yml:

version: '3.8'
services:
  db:
    image: postgres:15
    ports:
      - "${DB_PORT:-5432}:5432"
    environment:
      POSTGRES_DB: myapp_${WORKTREE_NAME:-dev}
# In each worktree
export WORKTREE_NAME=$(basename $PWD)
export DB_PORT=5433  # Different port per worktree
docker-compose -f docker-compose.worktree.yml up -d

Strategy 3: Shared database with schema prefixes

-- feat/user-auth uses schema: auth_feature
CREATE SCHEMA auth_feature;

-- feat/payment-gateway uses schema: payments_feature
CREATE SCHEMA payments_feature;

Port Management

Avoid port conflicts between worktrees:

# main/.env
PORT=3000
DB_PORT=5432

# feat/user-auth/.env
PORT=3001
DB_PORT=5433

# feat/payment-gateway/.env
PORT=3002
DB_PORT=5434

Service Orchestration

Running frontend and backend in separate worktrees:

# Terminal 1: API (main branch)
gw cd main
npm run dev:api  # Port 3001

# Terminal 2: Frontend (feature branch)
gw cd feat/new-ui
API_URL=http://localhost:3001 npm run dev:web  # Port 3000

5. Testing Workflows

Parallel Testing Across Environments

Test the same feature in multiple environments:

# Create test worktrees
gw add test-node18 --force
gw add test-node20 --force

# Terminal 1: Node 18
gw cd test-node18
nvm use 18
npm install && npm test

# Terminal 2: Node 20
gw cd test-node20
nvm use 20
npm install && npm test

CI/CD Integration

GitHub Actions with worktrees:

jobs:
  test:
    strategy:
      matrix:
        node: [18, 20, 22]
    steps:
      - uses: actions/checkout@v4
      - name: Setup Node ${{ matrix.node }}
        uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node }}
      - run: npm install
      - run: npm test

Local simulation:

#!/bin/bash
# test-matrix.sh
for version in 18 20 22; do
  gw add "test-node$version" --force
  (
    gw cd "test-node$version"
    nvm use "$version"
    npm install
    npm test
  ) &
done
wait
echo "All tests complete"

Test Isolation

Each worktree can have different test configurations:

# In feat/user-auth
npm test -- --testPathPattern="auth"

# In feat/payment-gateway
npm test -- --testPathPattern="payment"

6. Build Artifact Management

Separate Build Outputs

Each worktree maintains independent build artifacts:

repo.git/
├── main/
│   └── dist/        # Production build
├── feat/user-auth/
│   └── dist/        # Feature build
└── feat/payment-gateway/
    └── dist/        # Different feature build

Sharing Build Caches

Turborepo/Nx caching:

# Turbo's cache is shared automatically
gw cd feat/user-auth
pnpm turbo build  # Fast: uses cache from main

Manual cache sharing:

# Share .next/cache between worktrees
ln -s ../main/.next/cache .next/cache

Clean Build Strategies

When you need guaranteed clean builds:

# Remove build artifacts
rm -rf dist/ .next/ build/

# Fresh install and build
rm -rf node_modules/
npm install
npm run build

7. Team Collaboration

Code Review Workflows

Reviewer worktree pattern:

# Create worktree from PR branch
gw add review-pr-123
gw cd review-pr-123

# Review code, run tests
npm install
npm test
npm run dev  # Manual testing

# Leave review comments
# ...

# Clean up
gw remove review-pr-123

Pair Programming

Each developer in their own worktree:

# Developer A
gw add pair/feature-x-alice
gw cd pair/feature-x-alice
# Work on frontend...

# Developer B
gw add pair/feature-x-bob
gw cd pair/feature-x-bob
# Work on backend...

# Sync changes via git
git pull origin pair/feature-x

Demo Environments

One worktree per demo:

# Create demo worktrees
gw add demo/client-a
gw add demo/client-b

# Each with different configuration
# demo/client-a/.env
FEATURE_FLAGS=clientA

# demo/client-b/.env
FEATURE_FLAGS=clientB

8. Performance and Optimization

Monitoring Disk Usage

# Check worktree sizes
du -sh /path/to/repo.git/*/

# Find large node_modules
du -sh /path/to/repo.git/*/node_modules/ | sort -h

Cleanup Strategies

Quick cleanup:

If you need to quickly remove all temporary worktrees:

# Preview what would be removed
gw prune --clean --dry-run

# Remove all worktrees that are clean (no uncommitted/unpushed changes)
gw prune --clean

This is useful when:

  • Switching between projects
  • Low on disk space
  • Want to start fresh with minimal worktrees
  • Before archiving a project

Age-based cleanup (regular maintenance):

# Remove worktrees older than configured threshold (default: 7 days)
gw clean --dry-run  # Preview
gw clean            # Remove

Prune stale references:

# Clean up administrative data for deleted worktrees
gw prune

Resource Balancing

Limit concurrent worktrees:

  • Development machine: 3-5 active worktrees
  • CI machine: As many as needed (ephemeral)

Memory considerations:

  • Each running dev server uses memory
  • Each node_modules uses disk space
  • Database containers use memory + disk

Recommended setup:

# Keep essential worktrees
main/           # Always ready
feat/current/   # Active feature
review/         # Code review (temporary)
hotfix/         # Emergency fixes (temporary)

When NOT to Use Multiple Worktrees

Consider alternatives when:

  • Single small fix → Just commit and switch back
  • Same file being edited → Use branches instead
  • Limited disk space → Use branch switching
  • Team uses different workflow → Align first

Summary

You now understand:

  • ✅ Managing parallel development workflows effectively
  • ✅ Dependency strategies (pnpm recommended)
  • ✅ Keeping files in sync with gw sync
  • ✅ Database and service isolation patterns
  • ✅ Parallel testing across environments
  • ✅ Build artifact management
  • ✅ Team collaboration patterns
  • ✅ Performance optimization techniques

Next Steps

  1. Set up pnpm for efficient dependency management
  2. Configure post-add hooks for automatic setup
  3. Create team guidelines for worktree usage
  4. Implement cleanup automation

Additional Resources


*Part of the gw-tools skills collection*

平台分布

cline

31.9%
按下载量换算20

OpenCode

22.23%
按下载量换算14

github-copilot

17.02%
按下载量换算11

Claude Code

12.7%
按下载量换算8

Antigravity

7.98%
按下载量换算5

Gemini CLI

3.85%
按下载量换算2

安全审计

暂无安全审计结果可展示。

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add mthines/gw-tools --skill "multi-worktree-dev" 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills