Setup

From daiki-beppu/youtube-automation · View interactive version

Setup is an AI agent skill from the GitHub repository daiki-beppu/youtube-automation. Use when ツール導入と GCP / OAuth の設定、新規 YouTube チャンネル開設、既存チャンネル取り込み、config 再生成、または YouTube 側設定同期を行うとき。「セットアップして」「環境構築」「新チャンネル」「既存チャンネル」「チャンネル取り込み」「config 再生成」「設定反映」「チャンネル設定更新」「branding push」「ローカライゼーション同期」「meta.json を YouTube に反映」「/setup」「旧 /onboard」で発動。排他的な --tool / --channel / --import / --regenerate /

How to use this skill

Skill file

前後工程

成果物

モード判定

$ARGUMENTS から mode flag(--tool / --channel / --import / --regenerate / --push)の出現数を、reference の Read や成果物確認・変更より先に次の read-only guard で数える。

if ! command -v python3 >/dev/null 2>&1; then
  printf '%s\n' 'STOP: setup mode guardにはPython 3が必要です。runtimeを用意してから再実行してください。' >&2
  exit 2
fi
python3 .claude/skills/setup/references/setup-mode-guard.py $ARGUMENTS

guardは標準ライブラリだけを使い、uv・pyproject.toml・automation packageを必要としない。Python未導入・起動失敗を含め非0なら、その出力だけを提示して即時停止する。runtime不足時にguardを省略したり、ファイル作成・repo初期化・インストールを始めたりしない。

guardが成功した後、uv未導入なら選択modeの成果物操作より先に references/tool.md のbootstrap手順へ進む。導入後は元の引数でmode guardから再開し、指定modeを変えない。フラグなしの場合も後述の一括実行のtool bootstrapへ進む。

| mode | 読む reference |

|---|---|

| --tool | references/tool.md |

| --channel | references/channel-mode.md |

| --import | references/import-mode.md |

| --regenerate | references/regeneration-mode.md |

| --push | references/push-mode.md |

--tool は uv run yt-setup-dirs と doctor wizard でツール導入、マシン層の認証・設定、チャンネル層の OAuth / Reporting job を進める。GCP 層の project / billing / API / IAM は上流 Terraform が管理し、doctor は検証と誘導を行う。

Google Auth Platform の Branding / Audience / Clients 設定と client_secrets.json、運用設定の workflow.post_publish.skip_approvals は references/tool.md で扱う。--tool では config/channel/*.json を生成しない。

OAuth client の Console 操作が必要なら OAuth client wizard を対話 session で起動する。

--channel は references/channel-mode.md を唯一の正として読み、その Step 1〜10 と完了条件を実行する。TTP hearing、seed confirmation、config、duration、persona、branding、readiness、initial save の順序、success / failure / blocked / resume / idempotency、不可逆操作前の承認 gate と成果物契約を変えない。

--import / --regenerate / --push はそれぞれ対応 reference を唯一の正として読み、取り込み Step 1 前段〜Step 8、Step R1〜R8、設定同期の dry-run・承認・反映・失敗停止契約を実行する。市場・収集済みデータ分析は /channel-research --market、方向性検討は /channel-strategy --direction が所有し、ここへ吸収しない。

一括実行

references/setup-chain-state.py は references/setup-chain-manifest.json を実行前に strict 検証する。chainId、tool → channel の順序、未知・重複 step、prerequisite / output artifact、approval gate、状態判定 script のいずれかが不正なら error で停止する。旧 enabled だけの gate は skip = not enabled として解決し、skip と enabled の同時指定は拒否する。

最初の bootstrap で uv、pyproject.toml、automation package のいずれかが無く状態判定 script を起動できない場合は、tool だけを run として references/tool.md を実行する。script が起動可能になったら先頭から状態判定を再開する。起動可能ならチャンネルルートで manifest 順に各 step を判定する。

uv run python .claude/skills/setup/references/setup-chain-state.py \
  --channel-dir . --step <tool|channel>

| exit | decision | 処理 |

|---:|---|---|

| 0 | skip | 完了済みとして次の step へ進む。最終 step なら終了する |

| 10 | run | tool は references/tool.md、channel は references/channel-mode.md を読み、その一段だけ実行する |

| 20 | blocked | prerequisite 未完了として停止し、後段を実行しない |

| 2 | error | manifest / doctor / script のエラーとして停止し、後段を実行しない |

各 step の実行後は同じ状態判定を再実行し、exit 0 にならなければ停止する。tool 完了済みなら channel から再開し、channel 完了済みならどの副作用も再実行しない。既存の stale analytics 完了例外も tool の exit 0 とする。途中失敗時はその段で止め、後段を実行せず、再発動時は状態判定から再開する。

明示 mode はこの一括実行へ入らない。選択した reference の完了条件だけを実行・判定し、もう一段を暗黙実行しない。各 reference 内の不可逆操作・外部反映の承認 gate は chain の approvalGate.skip では省略されない。

想定 API call 数

| API | call 数 / 実行 | 変動要因 |

|---|---|---|

| YouTube Data API(oauth_token 手順の接続テスト) | 約 1 call | OAuth 認証の実行有無 |

| YouTube Reporting API | 数 call(quota 課金なし) | Reporting job の作成有無 |

| Vertex AI(Gemini / Veo / Lyria) | 0 | API 有効化のみで生成呼び出しなし |

完了条件

実行または skip と、状態判定の reason を短く報告する。

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.