delegate-claude

fohte's avatarfrom fohte

別の worktree で別の Claude Code インスタンスにタスクを委任する。現在のセッションをブロックせずに並列で作業を進めたいときに使用する。

⭐1stars🔀0forks📁View on GitHub🕐Updated Jan 4, 2026

When & Why to Use This Skill

This Claude skill enables developers to delegate tasks to independent Claude Code instances by automatically creating separate Git worktrees. It facilitates parallel development and background task execution, allowing users to offload sub-tasks without blocking their current session or losing focus on their primary workflow.

Use Cases

  • Parallel Feature Implementation: Offload the development of a secondary feature or component to a new worktree while continuing work on the main branch in the current session.
  • Concurrent Bug Fixing: Delegate the investigation and fixing of a reported bug to a background instance to avoid manual context switching and environment setup.
  • Multi-Repository Task Management: Initiate tasks in different local repositories simultaneously by automating directory switching and worktree creation via CLI.
  • Context-Rich Task Delegation: Use the structured prompt template to provide background, current status, and constraints to a fresh Claude instance for complex, independent coding tasks.
namedelegate-claude
description別の worktree で別の Claude Code インスタンスにタスクを委任する。現在のセッションをブロックせずに並列で作業を進めたいときに使用する。

別の Claude Code インスタンスにタスクを委任する

a wm new --prompt を使って、別の worktree で別の Claude Code インスタンスに処理を委任する。

使い方

a wm new <branch-name> --prompt "<instructions>"
  • branch-name: 新しい環境用に作成するブランチ名
  • --prompt: 新しい Claude Code インスタンスへの指示

例

# 現在のリポジトリ
a wm new feature-login --prompt "メール/パスワード認証によるログイン機能を実装"

# 別のリポジトリ
cd ~/ghq/github.com/fohte/other-repo && a wm new feature-x --prompt "機能 X を実装"

実行すると:

  1. 指定したブランチで新しい git worktree を作成
  2. Neovim と Claude Code を含む新しい tmux ウィンドウを開く
  3. Claude Code にプロンプトを自動送信

委任時の注意事項

  • ブランチ名: ブランチ名に / を含めないこと。代わりにハイフンを使う (例: fix/login-bug ではなく fix-login-bug)。ブランチには fohte/ がプレフィックスとして付くため、fix/... だと fohte/fix/... になり冗長
  • 新しいインスタンスは独立した worktree で作業するため、現在の作業と競合しない

プロンプト構造 (必須)

委任先の Claude Code インスタンスは現在の会話の事前知識を持っていない。以下の構造を使って十分なコンテキストを含めること:

## 背景
[なぜこのタスクが必要か。何の問題を解決するのか。動機は何か]

## 現状
[現在の状態は? すでに決まっていることは? 関連ファイルやコードは?]

## タスク
[実装/修正/調査する具体的な指示]

## 期待する結果
[何が結果として得られるべきか。成功をどう確認するか]

## 制約 (あれば)
[注意すべき制限、依存関係、要件]

良い例

a wm new fix-auth-timeout --prompt "## 背景
ユーザーが 5 分間操作しないとセッションがタイムアウトするが、期待値は 30 分。

## 現状
- 認証は src/auth/session.ts で処理している
- セッション設定は config/auth.json にある
- 最近 JWT からセッションベース認証に移行した

## タスク
1. なぜ 5 分でセッションが切れるか調査
2. タイムアウト設定を修正
3. 30 分タイムアウトを検証するテストを追加

## 期待する結果
30 分間操作がなくてもセッションが維持される。テストが通る。

## 制約
- セッションストレージの仕組み (Redis) は変更しない
- 既存セッションとの後方互換性を維持"

悪い例 (コンテキスト不足)

# これはダメ - 新しいインスタンスは「そのバグ」や「さっき話した」が何か分からない
a wm new fix-bug --prompt "さっき話したバグを直して"