Dev.Worktreesのロゴ

Dev.Worktrees

コミュニティ
kevinslin
dev.worktrees

Create, inspect, remove, or transactionally clean landed Git worktrees.

概要

公開者kevinslin
リポジトリagstack
スキル名dev.worktrees
スター
26
フォーク
1
同梱ファイル
2
リンク
  • Markdown形式の指示

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

  • どのLLMでも利用可能

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

  • 2個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

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

インストール

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

1

TypingMindにインストール

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

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

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

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

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

TypingMindで使用

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

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

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

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

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

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

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

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

スキルの指示

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

dev.worktrees

Overview

Create and manage Git worktrees under ~/.worktrees. Use cleanup-landed only after a caller has independently proved that the work landed and may be discarded.

Conventions

  • Resolve the repo name from the main repo directory basename (folder containing .git), unless the user provides an override.
  • Always store worktrees under ~/.worktrees/<repo>/<branch-name>.
  • Keep the branch name as-is; if it contains /, it naturally becomes nested folders.
  • Run worktree commands from the main repo unless the user specifies a different worktree.
  • If the user requests a different location, confirm the deviation before proceeding.
  • Use absolute paths for removal and cleanup targets.
  • Never remove the current, primary, locked, or dirty worktree through the ordinary removal path.

Quick Tasks

Create worktree for an existing branch

bash
mkdir -p ~/.worktrees/<repo>
git worktree add ~/.worktrees/<repo>/<branch-name> <branch-name>

Create worktree for a new branch

bash
mkdir -p ~/.worktrees/<repo>
git worktree add -b <branch-name> ~/.worktrees/<repo>/<branch-name> [start-point]

List worktrees

bash
git worktree list --porcelain

Ordinary Removal

Use ordinary removal only when the worktree is already clean and unlocked. Inspect tracked and untracked state immediately before removal. If it is dirty, stop and preserve it; do not force removal or infer that its contents landed.

bash
git -C <worktree> status --short
git -C <repo> worktree remove <absolute-worktree-path>

Delete the local branch only when the caller separately established that it is no longer needed:

bash
git -C <repo> branch -d -- <branch-name>

cleanup-landed

Use ./scripts/cleanup_worktree.py to remove one exact worktree and its local branch after the caller has proved the change landed. This path is destructive: it resets tracked changes and deletes untracked and ignored files before removing the worktree.

Before invoking it, record:

  • a retained repository checkout outside the target worktree;
  • the exact absolute target path, or --no-worktree for a branch checked out nowhere;
  • the expected local branch or detached state;
  • the full expected HEAD object ID;
  • a refreshed local base branch;
  • the full landed commit object ID contained by that base; and
  • the actual merge mode: merge, squash, or rebase.

Run a dry run first and require JSON status ready or noop:

bash
python3 ./scripts/cleanup_worktree.py \
  --repo <retained-checkout> \
  --worktree <absolute-worktree-path> \
  --expected-branch <branch> \
  --expected-head <full-object-id> \
  --base-ref <refreshed-local-base-branch> \
  --landed-commit <full-landed-object-id> \
  --merge-mode <merge|squash|rebase>

Rerun the exact command with --execute. Require final JSON status complete or noop, with the path, registration, and local branch absent and the base still containing the landed commit.

  • Replace --expected-branch <branch> with --detached for a detached target.
  • Replace --worktree <path> with --no-worktree for branch-only cleanup; detached cleanup is invalid in that mode.
  • Treat blocked, partial, a nonzero exit, identity drift, or failed postconditions as a cleanup blocker.
  • Preserve the reported journal after partial execution and rerun the exact command after resolving the blocker.
  • If matching legacy and current journals both exist, stop and reconcile them; the executor fails closed rather than choosing one.
  • Do not reproduce the reset, clean, removal, orphan recovery, or branch deletion steps manually.

The script serializes each target, revalidates identity under the lock, and journals new transactions under the Git common directory's worktree-cleanup/ directory. It resumes matching legacy fin-cleanup/ journals in place. It never refreshes the base, proves external finalization, runs repository hooks, prunes unrelated registrations, or mutates remote branches; callers own those policies.

Prune Stale Metadata

Prune only when the user explicitly requests repository-wide stale metadata cleanup. Preview first and do not use pruning as a substitute for targeted removal or journal recovery.

bash
git -C <repo> worktree prune --dry-run
git -C <repo> worktree prune

Notes

  • Never place worktrees inside the main repo or other worktrees.
  • Prefer explicit paths and branch names in responses to avoid ambiguity.
  • Keep bulk Codex worktree garbage collection in codex-clean-worktrees; cleanup-landed owns one exact, proof-locked transaction.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Dev.Worktrees」では何ができますか?

Create, inspect, remove, or transactionally clean landed Git worktrees.

TypingMindでDev.Worktreesを使うメリットは何ですか?

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

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

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/kevinslin/agstack/tree/main/active/dev.worktreesを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Dev.Worktreesを使えるAIモデルはどれですか?

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

Dev.Worktreesは何個のAIモデルで使えますか?

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

AIスキル「Dev.Worktrees」は無料ですか?

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

AIスキルとは何ですか?

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

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

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

すべて見る

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

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