Worktree Setupのロゴ

Worktree Setup

コミュニティ
robinebers
worktree-setup

Generate setup scripts/configs for AI agent worktrees and isolated environments across Cursor, Codex, Conductor, and Claude Code. Use when wiring up a project so AI agents start with the same dependencies, env files, and tool configs as the main repo.

概要

公開者robinebers
リポジトリskills
スキル名worktree-setup
スター
49
フォーク
5
同梱ファイル
指示のみ
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    robinebersがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルWorktree SetupをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/robinebers/skills/tree/main/skills/worktree-setup
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/robinebers/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/worktree-setup .claude/skills/worktree-setup
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでWorktree Setupを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にWorktree Setupを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Worktree Setupは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Worktree Setup

Generate the right config so AI agents start in their isolated worktrees / environments with the same setup as the main repo: dependencies installed, env files in place, tool configs copied over.

  1. Unless the context already provides an answer, explicitly ask the user which tool the setup is for: Cursor, Codex, Conductor, or Claude Code.

  2. Map out the project (web, native, Rust, Swift, etc.) and make judgement calls on the right setup/install, run/actions, and teardown/archive commands.

Not all projects use bun. Some use make, cargo, bun tauri dev, swift build, npm, pnpm, pip, etc. Read the README, package.json scripts, top-level Makefile, or Cargo.toml to figure it out.

What each tool reads

  • Cursor: Local parallel-agent worktrees in .cursor/worktrees.json.
  • Codex: Setup script + actions in .codex/environments/environment.toml.
  • Conductor: Workspace setup in conductor.json.
  • Claude Code: .worktreeinclude at the repo root (gitignored files to copy into each worktree) + .claude/settings.json SessionStart hook for install.

The shared pattern

Across Cursor, Codex, and Conductor, the setup script usually does the same 3 things:

  1. Install dependencies - run appropriate commands by project type, like Bun, Tauri, make, cargo, swift, etc. Read the README, package.json, Makefile, Cargo.toml, or similar to figure out what's right.
  2. Copy AI-tool config dirs - .agents, .claude, .codex, .cursor from the source repo into the new environment.
  3. Copy env files - .env, .env.local, .env.development, etc.

CRITICAL: the setup script always lives project-scoped, not global.

Claude Code is the exception: it auto-copies tracked files into each worktree and uses a declarative include list (.worktreeinclude) for gitignored files plus a SessionStart hook for install — no imperative setup script. See its section below.

Reusable copy snippet

Replace $SOURCE and $DEST with the right env vars for the platform (see the table near the bottom):

bash
for d in .agents .claude .codex .cursor; do
    [ -d "$SOURCE/$d" ] && mkdir -p "$DEST/$d" && rsync -a "$SOURCE/$d/." "$DEST/$d/"
done
[ -f "$SOURCE/{ENV_FILE}" ] && cp "$SOURCE/{ENV_FILE}" "$DEST/{ENV_FILE}" || true

Templates

Replace {INSTALL_CMD}, {RUN_CMD}, and {ENV_FILE} per project.

Cursor

Cursor exposes $ROOT_WORKTREE_PATH (the source repo root). Scripts run inside the new worktree, so the destination is just the current working directory.

For OS-specific setups, use setup-worktree-unix or setup-worktree-windows. setup-worktree is the cross-platform fallback.

json
{
    "setup-worktree": [
        "{INSTALL_CMD}",
        "for d in .agents .claude .codex .cursor; do [ -d \"$ROOT_WORKTREE_PATH/$d\" ] && mkdir -p \"$d\" && rsync -a \"$ROOT_WORKTREE_PATH/$d/.\" \"$d/\"; done",
        "[ -f \"$ROOT_WORKTREE_PATH/{ENV_FILE}\" ] && cp \"$ROOT_WORKTREE_PATH/{ENV_FILE}\" \"{ENV_FILE}\" || true"
    ]
}

Codex

The file is autogenerated by the Codex desktop app - don't hand-edit it lightly, but it's plain TOML and committed to git. Schema:

toml
version = 1
name = "{PROJECT_NAME}"

[setup]
script = '''
#!/usr/bin/env bash
set -euo pipefail

{INSTALL_CMD}

# Sync config dirs from source tree into the worktree
for d in .agents .claude .codex .cursor; do
    if [ -d "$CODEX_SOURCE_TREE_PATH/$d" ]; then
        mkdir -p "$CODEX_WORKTREE_PATH/$d"
        rsync -a "$CODEX_SOURCE_TREE_PATH/$d/." "$CODEX_WORKTREE_PATH/$d/"
    fi
done

# Copy env file if present
if [ -f "$CODEX_SOURCE_TREE_PATH/{ENV_FILE}" ]; then
    cp "$CODEX_SOURCE_TREE_PATH/{ENV_FILE}" "$CODEX_WORKTREE_PATH/{ENV_FILE}"
fi
'''

[[actions]]
name = "Dev Server"
icon = "run"
command = "{RUN_CMD}"

[[actions]]
name = "Build"
icon = "build"
command = "{BUILD_CMD}"

The [setup] script runs at the start of every new worktree / task. The [[actions]] blocks each become a named shortcut in the Codex UI. Common icons: run, build, debug, logs, check, package.

Conductor

conductor.json lives at the repo root and gets shared with teammates so everyone gets the same workspace setup.

Fields:

FieldTypeDescription
scripts.setupstringCommand to run when setting up a new workspace.
scripts.runstringCommand to start the dev server.
scripts.archivestringCommand to run when archiving a workspace.
runScriptMode"concurrent" | "nonconcurrent"Whether to kill in-progress run scripts before starting a new one.

Template:

json
{
    "scripts": {
        "setup": "{INSTALL_CMD}; for d in .agents .claude .codex .cursor; do [ -d \"$CONDUCTOR_ROOT_PATH/$d\" ] && mkdir -p \"$CONDUCTOR_WORKSPACE_PATH/$d\" && rsync -a \"$CONDUCTOR_ROOT_PATH/$d/.\" \"$CONDUCTOR_WORKSPACE_PATH/$d/\"; done; [ -f \"$CONDUCTOR_ROOT_PATH/{ENV_FILE}\" ] && cp \"$CONDUCTOR_ROOT_PATH/{ENV_FILE}\" \"$CONDUCTOR_WORKSPACE_PATH/{ENV_FILE}\"",
        "run": "{RUN_CMD}"
    }
}

Claude Code

Claude Code's worktree manager auto-copies all tracked files (including .claude/) into each new worktree, so no rsync of config dirs is needed. Only gitignored files need to be listed explicitly, and install runs through a session hook.

Three artifacts, all at the repo root:

.worktreeinclude — one line per gitignored file to copy into every new worktree:

{ENV_FILE}

.claude/settings.json — runs {INSTALL_CMD} on every new Claude session and every fresh worktree. matcher: "startup" skips --resume so it doesn't fire on session resumes:

json
{
    "hooks": {
        "SessionStart": [
            {
                "matcher": "startup",
                "hooks": [
                    {
                        "type": "command",
                        "command": "{INSTALL_CMD}",
                        "timeout": 120
                    }
                ]
            }
        ]
    }
}

timeout is in seconds. Bump it for projects with cold-build steps (Tauri, Rust, Swift cold builds can run several minutes).

.gitignore — under a # claude code runtime block so the runtime worktree directory and lock file aren't committed:

# claude code runtime
/.claude/scheduled_tasks.lock
/.claude/worktrees/

Environment variables by platform

  • Cursor: $ROOT_WORKTREE_PATH / (cwd is the new worktree, no separate destination var)
  • Codex: $CODEX_SOURCE_TREE_PATH / $CODEX_WORKTREE_PATH
  • Conductor: $CONDUCTOR_ROOT_PATH / $CONDUCTOR_WORKSPACE_PATH
  • Claude Code: none — declarative (.worktreeinclude) + session hook; no source/dest vars.

Vendors rename these. Always check the platform's docs before writing them.

Usage

CRITICAL: The user is a non-technical, non-engineer. Avoid technical jargon and help them set up the correct setup scripts for their setup.

  1. Identify which environment the project needs (per the user's answer).
  2. Detect project type and pick {INSTALL_CMD} / {RUN_CMD} / {ENV_FILE} from the table above (or read the README).
  3. Generate the matching config file from Templates.
  4. Offer to git commit for teams to have access to it too.
  5. Offer to also generate the same for other agents that this skill supports.

よくある質問

AIスキル「Worktree Setup」では何ができますか?

Generate setup scripts/configs for AI agent worktrees and isolated environments across Cursor, Codex, Conductor, and Claude Code. Use when wiring up a project so AI agents start with the same dependencies, env files, and tool configs as the main repo.

TypingMindでWorktree Setupを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Worktree Setupはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにWorktree Setupをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/robinebers/skills/tree/main/skills/worktree-setupを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Worktree Setupを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Worktree Setupは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもWorktree Setupを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Worktree Setup」は無料ですか?

robinebersがGitHubで公開しています。ライセンス条件はリポジトリでご確認ください。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇