delegate-implement
Skill3 starsChanged 5 months agoMITView on GitHub
token cost の削減を第一目標として、コードの実装・修正を安価なモデルの subagent に委譲するスキル。 複数ファイルまたは既存パターン調査を伴う実装タスク(機能追加・バグ修正・リファクタ等)を、 親エージェントの context を汚さずに処理したいときに使う。単一ファイルの小変更、明確な一括置換、 main が既に読んだ箇所の数行修正、設計判断が未確定な実装には使わない。 read-only の調査は delegate-explore、git/PR 操作は親エージェントが直接扱うこと。 implement の作業を委譲する場合は、この skill を使う。generic な subagent で代替しない。
1 other project uses a version of this.
Adopted by
Most recently taken up by
- briggsd/skillstheir own version, first seen Jun 20, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- briggsd/skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- delegate-choreSkill
- delegate-exploreSkill
- delegate-htmldocSkill
- delegate-imagegenSkill
- delegate-proseSkill
- delegate-reviewSkill
- delegate-x-researchSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 38
run は内部で prepare → dispatch → read-response を順に実行し、stdout は成功・失敗とも単一 JSON(exit_code / status / content / content_truncated / response_file …
- Very specific: line 68
follow-up run: 親の差分確認で不具合が見つかった場合のみ使う。prepare.sh の第 6 引数に followup=<前回observe_file> を渡す。exit 5 は検証失敗なので中止し、通常 delegate として出し直す。暗黙 fallback …
- Very specific: line 72
follow-up request には、親が見つけた不具合、最新 git diff の見るべき範囲、前回 response_file の参照を必ず含める。worker の古い会話文脈だけに依存させない。
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
delegate-implement
コード実装を委譲する。task_type=implement、既定モデル sonnet(編集の判断を要するため)。実行系分岐(Codex / Devin / Cursor / Claude / OpenCode)は dispatch.sh が行う。opencode/<provider>/<model> を使う場合は opencode CLI(ログイン済み)が必要。
スクリプトパス
- Claude Code:
skill_dir=.claude/skills/delegate-implement - Codex:
skill_dir=.agents/skills/delegate-implement
以降のコマンド例は Claude Code の .claude/skills/delegate-implement を使う。Codex で使う場合は、同じ相対構造の .agents/skills/delegate-implement に読み替える。
モデル価格参照
コスト分析・単価比較が必要な場合のみ、<skill_dir>/model-token-prices.json を読む。このデータは参照用であり、delegate の起動可否判定には使わない。
委譲する前に(コストゲート)
implement は、調査・編集・検証を worker にまとめて任せる価値がある規模の実装に使う。複数ファイルにまたがる変更、既存パターン調査を伴う変更、worker が検証コマンドまで実行でき、main が git diff / Verification / Summary の確認に集中できる変更を発火条件にする。一方、単一ファイルの小変更、明確な一括置換、main が既に読んだ箇所の数行修正、設計判断が未確定な実装は委譲せず main が直接処理する。
実行フロー(one-shot)
- リクエスト作成: Objective / Scope / Context / Acceptance criteria / Verification / Constraints の Markdown を stdin で渡す。Verification には worker が自ら実行すべき検証コマンド(
vp check/ テスト)を記し、その結果を報告 Markdown の Verification section(実行コマンドと exit code を含む)に収めるよう指示する。request は terse に書く: Context にファイル内容を貼らず、パス(必要なら行範囲)で参照させる(main の出力=課金トークンを増やさないため)。- ユーザーが会話でモデルや effort を指定した場合は、run 呼び出しにインライン env を前置する(例:
DELEGATE_IMPLEMENT_MODEL=gpt-5.5@high bash .../run.sh ...)。exit 6 の場合は、許容値列挙を含む stderr の 1 行をそのままユーザーへの説明に使う。
- ユーザーが会話でモデルや effort を指定した場合は、run 呼び出しにインライン env を前置する(例:
- 実行:
out="$(printf '%s' "$req_md" | bash .claude/skills/delegate-implement/scripts/run.sh implement DELEGATE_IMPLEMENT_MODEL sonnet "$PARENT_TASK_TYPE_CHAIN" "$REQUESTER_SESSION_ID")"(top-level 起動なら$PARENT_TASK_TYPE_CHAINは空でよい)。- run は内部で prepare → dispatch → read-response を順に実行し、stdout は成功・失敗とも単一 JSON(
exit_code/status/content/content_truncated/response_file/observe_file/run_dir)を返す。 - selector 省略時の既定は
auto。第 6 位置引数は read-response の selector であり、prepare.sh の第 6 位置引数 session_mode とは意味が異なる。 - exit code は内部スクリプトを透過する。exit 3=前提不足 / exit 4=委譲サイクルなら中止する。
run.shは dispatch 前にobserve_file: <path>を stderr へ先出しする。run.shが Bash timeout で background へ退避しただけの場合は再実行しない(再実行は worker の二重起動になり、implement / chore では同一 worktree の同時書き換えになる)。復旧はbash .claude/skills/delegate-implement/scripts/read-json.sh .state.phase "$observe_file"を見て分岐する。ended/stalled/interruptedなら終端なので、いずれでもbash .claude/skills/delegate-implement/scripts/read-json.sh .run.response_file "$observe_file"で応答パスを取得してbash .claude/skills/delegate-implement/scripts/read-response.shで読む(stalledでは failed response が書かれる。interruptedは dispatcher が終端を書けずに落ちた run を wrapper が代わりに記録したもので、.state.response_presentがtrueなら完走した response がある)。runningの間は.heartbeat.tsが進んでいれば待つ。runningのまま.heartbeat.tsがDELEGATE_OBSERVE_HEARTBEAT_INTERVAL(既定 10 秒)を大きく超えて進まない場合は dispatcher が終端を書けずに落ちている。wrapper も同時に落ちていれば phase は終端へ遷移しないので、待っても応答は来ない。新しい run を出す前に順に確認する。(1)read-json.sh .run.response_file "$observe_file"を読む。dispatcher だけが死んだ場合、wrapper が完全な response を書き終えていることがある。(2) response がChild CLI failed or did not write a response.の stub なら、read-json.sh .run.run_dir "$observe_file"の<run_dir>/worker-stdout.captureに子 CLI の生 stream が残っている。wrapper が finalize まで到達していれば observe の.streams.stdout.contentにもDELEGATE_OBSERVE_STREAM_MAX_BYTES(既定 65536 バイト)まで入る。構造化された response ではないが、長い run では再実行より安く回収できる。(3)read-json.sh .heartbeat.child_pid "$observe_file"の pid の生存を確認する。wrapper は dispatcher と別プロセスなので孤児化して動き続けることがあり、生きている間に implement / chore で新しい run を出すと同一 worktree の二重書き換えになる。確認後に新しい run を出す。background 退避した出力ファイルは stdout と stderr が合流するが、read-json.shは既知の harness 行(空行 /observe_file:行 /[exited with ...]行)に囲まれた JSON object を切り出して読める。- 非対話モードの親(
claude -p等)では run を必ずフォアグラウンドで実行し、委譲所要時間より長い Bash timeout(Claude Code ならBASH_DEFAULT_TIMEOUT_MS/BASH_MAX_TIMEOUT_MSまたは Bash tool の timeout 引数)を設定する。
- run は内部で prepare → dispatch → read-response を順に実行し、stdout は成功・失敗とも単一 JSON(
- レスポンス消費と検証:
status="$(printf '%s' "$out" | bash .claude/skills/delegate-implement/scripts/read-json.sh .status)"/content="$(printf '%s' "$out" | bash .claude/skills/delegate-implement/scripts/read-json.sh .content)"を読む。content_truncatedがtrueならresponse_file="$(printf '%s' "$out" | bash .claude/skills/delegate-implement/scripts/read-json.sh .response_file)"を取り出し、bash .claude/skills/delegate-implement/scripts/read-response.sh "$response_file" <N>で Verification / Changed files など必要 section だけ段階読みする。読了後、worker の本文を 要約し直さない(echo しない)。statusがfailedなら Error section をユーザーへ伝える。completedでも Summary 先頭に警告行があればその旨を伝える(警告は response 本体に載るので selector に関わらず Summary とともに返る)。statusがcompletedでない時、pass 申告の裏取りが要る時、差分が広い時、worker が Verification にリスクや未検証項目を書いた時は main 側でgit diff/ test result を裏取りする。
高度なフロー(個別スクリプト)
dispatch 中の observe 監視、background 実行、resumable / follow-up など、途中で親の判断を挟むフローでは従来の個別スクリプトを使う。
- 準備(集約): 前提チェック→モデル解決→チェーン確認→リクエスト生成を
prepare.sh1 本に畳む。Objective / Scope / Context / Acceptance criteria / Verification / Constraints の Markdown を stdin で渡す。Verification には worker が自ら実行すべき検証コマンド(vp check/ テスト)を記し、その結果を報告 Markdown の Verification section(実行コマンドと exit code を含む)に収めるよう指示する。request は terse に書く: Context にファイル内容を貼らず、パス(必要なら行範囲)で参照させる(main の出力=課金トークンを増やさないため)。exit 3=前提不足 / exit 4=委譲サイクルなら中止。- ユーザーが会話でモデルや effort を指定した場合は、prepare 呼び出しにインライン env を前置する(例:
DELEGATE_IMPLEMENT_MODEL=gpt-5.5@high bash .../prepare.sh ...)。prepare が exit 6 の場合は、許容値列挙を含む stderr の 1 行をそのままユーザーへの説明に使う。 out="$(printf '%s' "$req_md" | bash .claude/skills/delegate-implement/scripts/prepare.sh implement DELEGATE_IMPLEMENT_MODEL sonnet "$PARENT_TASK_TYPE_CHAIN" "$REQUESTER_SESSION_ID")"(top-level 起動なら$PARENT_TASK_TYPE_CHAINは空でよい)model="$(printf '%s' "$out" | bash .claude/skills/delegate-implement/scripts/read-json.sh .model)"/request_file="$(printf '%s' "$out" | bash .claude/skills/delegate-implement/scripts/read-json.sh .request_file)"/response_file="$(printf '%s' "$out" | bash .claude/skills/delegate-implement/scripts/read-json.sh .response_file)"/run_dir="$(printf '%s' "$out" | bash .claude/skills/delegate-implement/scripts/read-json.sh .run_dir)"/observe_file="$(printf '%s' "$out" | bash .claude/skills/delegate-implement/scripts/read-json.sh .observe_file)"
- ユーザーが会話でモデルや effort を指定した場合は、prepare 呼び出しにインライン env を前置する(例:
- 実行:
bash .claude/skills/delegate-implement/scripts/dispatch.sh "$model" implement "$request_file" "$response_file" "$run_dir" "$observe_file"。モデル名プレフィックスによる実行系分岐(Codex / Devin / Cursor / Claude / OpenCode)は dispatch.sh が行う。stdout は response_file のパスのみ。非対話モードの親(claude -p等)では dispatch を必ずフォアグラウンドで実行し、委譲所要時間より長い Bash timeout(Claude Code ならBASH_DEFAULT_TIMEOUT_MS/BASH_MAX_TIMEOUT_MSまたは Bash tool の timeout 引数)を設定する。実行中の通常監視はobserve_fileからstate.phase/state.started_at/heartbeat.ts/heartbeat.stdout_bytes/heartbeat.stderr_bytes/heartbeat.last_stream_change_atだけを read-json.sh で読む。state.phaseはprepared | running | superseded | stalled | interrupted | ended。prepared/supersededは dispatch されなかった observe(state.started_at == null、usageは未設定で read-json.sh では null 相当)なので、usage を集計する場合は分母から除外する。 - レスポンス読み取り:
bash .claude/skills/delegate-implement/scripts/read-response.sh "$response_file" auto。autoは response が小さい(既定 10KB 未満)なら status と全 section を 1 回で丸読みし、大きい場合は status + index + Summary section を返すので、Verification / Changed files など必要 section だけ... "$response_file" <N>で追加取得する。読了後、worker の本文を 要約し直さない(echo しない)。statusがfailedなら Error section をユーザーへ伝える。completedでも Summary 先頭に警告行があればその旨を伝える(警告は response 本体に載るので selector に関わらず Summary とともに返る)。main のユーザー向け応答は Summary を指す 1 行に留める(main の出力=課金トークンを増やさないため。spec.md §6)。 - 検証フェーズ(必須):
statusを先に確認し、必要時のみ Verification / Changed files section を引く。決定論的検証(vp checkの lint/型・テスト)の exit code は信頼し、意味的・受け入れ基準は Summary とgit diffを中心に確認する。statusがcompletedでない時、pass 申告の裏取りが要る時、差分が広い時、worker が Verification にリスクや未検証項目を書いた時は main 側でgit diff/ test result を裏取りする
セッション再利用(resumable / follow-up)
resumable / follow-up は one-shot 対象外のため、個別スクリプトを使う。
既定は通常 run。複数ファイル実装や大きめ修正など、親レビューで差し戻す可能性が高い場合だけ初回から resumable initial run を明示する。過剰使用しない。Claude / Codex / Devin / Cursor / OpenCode が resumable / follow-up に対応する。
- resumable initial run:
prepare.shの第 6 引数にresumableを渡す。dispatch は第 7 引数にresumable、第 8・9 引数に空文字を渡す。out="$(printf '%s' "$req_md" | bash .claude/skills/delegate-implement/scripts/prepare.sh implement DELEGATE_IMPLEMENT_MODEL sonnet "$PARENT_TASK_TYPE_CHAIN" "$REQUESTER_SESSION_ID" resumable)"session_mode="$(printf '%s' "$out" | bash .claude/skills/delegate-implement/scripts/read-json.sh .session_mode)"/lineage_id="$(printf '%s' "$out" | bash .claude/skills/delegate-implement/scripts/read-json.sh .lineage_id)"bash .claude/skills/delegate-implement/scripts/dispatch.sh "$model" implement "$request_file" "$response_file" "$run_dir" "$observe_file" "$session_mode" "" ""- response 読了後に
bash .claude/skills/delegate-implement/scripts/read-json.sh .backend_session.persistence "$observe_file"を確認する。resumable以外なら follow-up 不可としてその場で判断し、後から暗黙 fallback を期待しない。
- follow-up run: 親の差分確認で不具合が見つかった場合のみ使う。
prepare.shの第 6 引数にfollowup=<前回observe_file>を渡す。exit 5 は検証失敗なので中止し、通常 delegate として出し直す。暗黙 fallback しない。out="$(printf '%s' "$req_md" | bash .claude/skills/delegate-implement/scripts/prepare.sh implement DELEGATE_IMPLEMENT_MODEL sonnet "$PARENT_TASK_TYPE_CHAIN" "$REQUESTER_SESSION_ID" "followup=$previous_observe_file")"session_mode="$(printf '%s' "$out" | bash .claude/skills/delegate-implement/scripts/read-json.sh .session_mode)"/resume_id="$(printf '%s' "$out" | bash .claude/skills/delegate-implement/scripts/read-json.sh .resume_id)"/backend_session_home="$(printf '%s' "$out" | bash .claude/skills/delegate-implement/scripts/read-json.sh .backend_session_home)"bash .claude/skills/delegate-implement/scripts/dispatch.sh "$model" implement "$request_file" "$response_file" "$run_dir" "$observe_file" "$session_mode" "$resume_id" "$backend_session_home"- follow-up request には、親が見つけた不具合、最新
git diffの見るべき範囲、前回response_fileの参照を必ず含める。worker の古い会話文脈だけに依存させない。
待ち時間の隠蔽(対話親向け)
対話親では体感待ち時間を隠蔽できる。経路は起動スクリプトで異なる。dispatch.sh 経由は prepare.sh で response_file を事前取得済みなので、dispatch.sh を background で実行し、observe_file の state.phase / heartbeat を確認して ended / stalled / interrupted になった後に read-response.sh する。run.sh 経由は response_file を事前に取得できないので、run.sh を background で実行した場合は read-json.sh .run.response_file "$observe_file" で応答パスを取るか、合流した出力 JSON をそのまま read-json.sh で読む。総所要時間(wall time)は変わらない体感改善であり、非対話モードの親では従来どおりフォアグラウンド実行必須。
制約
- 編集は可。ただし push はしない(push・PR は親エージェントが直接扱う)
- task_type_chain 内種別への再委譲はしない(別種別 delegate は可)
- main は worker 出力を echo / 再要約しない。ユーザー向けは Summary を指す 1 行に留める(出力=課金トークンを増やさないため。spec.md §6)
- OpenCode: cwd 外への出力は保証されない(direct な edit / write と明示パスの読み取りは拒否され、bash のリダイレクトは通る)。出力先を cwd 外に指定すると成功は保証されない。request が
DELEGATE_REQUEST_INLINE_MAXを超えると child 起動前に fail-closed する - OpenCode の read-only 抑止は管理者設定のない環境を前提とする(管理者設定は注入した permission を override し得る)
- この種別は project plugin を継承する。
DELEGATE_OPENCODE_PUREが1/true/yesなら--pureを付けて無効化する(read-only 種別と htmldoc は既定で--pure)。DELEGATE_OPENCODE_MCP_SOURCE(claude/cursor/codex)で MCP 入力元を明示し、未指定なら注入しない
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

