claude-skills/

Anthropic公式スキル・プラグインの日本語ディレクトリ

last sync 22h ago
スキルOfficialdevelopment

aidp-migrator-bootstrap

説明

Oracle AIDP Databricks マイグレーターのワンショット環境準備チェックツールです。 Python の依存関係、OCI 認証、AIDP クラスターへの疎通確認、および環境座標ファイル(env-coords ファイル)の検証を行います。 次のような場合に使用: ユーザーがワークステーション上で初めてマイグレーターを起動するとき、またはいずれかの Skill が認証エラーや接続エラーで失敗したとき。

原文を表示

One-shot environment readiness check for the Oracle AIDP Databricks migrator. Verifies Python deps, OCI auth, AIDP cluster reachability, and your env-coords file. Use the first time the user invokes the migrator on a workstation, or when any other skill fails with an auth / connectivity error.

ユースケース

  • マイグレーター初回起動時の環境準備確認
  • 認証エラー発生時の原因調査
  • 接続エラー発生時の疎通確認
  • 依存関係とenv-coordsファイルの検証

本文(日本語訳)

aidp-migrator-bootstrap — 環境準備チェック

他のスキルが実際の処理を開始する前に、マイグレーターが必要とするすべての準備が整っているかを確認します。 冪等性あり — 設定のずれが疑われる場合はいつでも再実行可能です。

次のような場合に使用

  • このワークステーションでマイグレーターを初めて実行する場合
  • 他のいずれかのスキルが OCI 認証エラー、ネットワークエラー、またはクラスター未検出エラーで失敗した場合
  • 新しいリージョン / DataLake / ワークスペースに移動し、再検証が必要な場合

必須の環境座標 (env-coords)

以下のいずれかのチェックを実行する前に、ユーザーは 以下のすべて を記載した env-coords.md(または任意のプレーンテキストのメモファイル)を用意しておく必要があります。 不足している項目がある場合は処理を拒否してユーザーに確認してください — 絶対に推測で補わないこと。

座標 値の形式の例(これらはプレースホルダーです。実際には使用しないこと)
AIDP REST ベース URL https://aidp.<region>.oci.oraclecloud.com/20240831
DataLake OCID ocid1.aidataplatform.oc1.<region>.<id>
ワークスペース UUID <8-4-4-4-12> UUID 形式
クラスター ID <8-4-4-4-12> UUID 形式
OCI プロファイル名 <your-profile>(例:~/.oci/config 内のセクション名)
出力ワークスペースパス Shared/aidp-migration-tool-output/(またはチームのパス)

これらをプロジェクトルートの env-coords.md ファイルに保存し、.gitignore に追加してください。 このプラグイン内の他のすべてのスキルは、これらの値をそのまま引き継ぎます。 完全なスキャフォールドについては references/env-coords.template.md を参照してください。

手順

1. Python 前提条件

マイグレーターエンジンはこのプラグインに同梱されており、${CLAUDE_PLUGIN_ROOT}/engine/ 以下に格納されています。 Python 依存パッケージを一度インストールしてください:

python3 --version          # 3.10 以上
pip install -r ${CLAUDE_PLUGIN_ROOT}/engine/requirements.txt

必要なパッケージ: ocirequestswebsocket-clientanthropiccryptography。 不足しているものがあればインストール後に再試行してください。

2. ANTHROPIC_API_KEY 環境変数

echo $ANTHROPIC_API_KEY | wc -c    # 50文字より大きい値であること

空の場合、マイグレーターの Pass-2 セルごとのループがクラッシュします。 ユーザーに export ANTHROPIC_API_KEY=sk-ant-... を実行するよう案内してください。

3. OCI 認証

有効なパスは 2 つあります — ユーザーがどちらを使用しているか確認してください:

API キー(無人実行に推奨)

oci iam region list --profile <profile-name>     # 成功するとリージョン一覧が返される

セッショントークン(インタラクティブ使用のみ、有効期限は約 1 時間)

oci session validate --profile <profile-name>
# 期限切れの場合:
oci session authenticate --profile <profile-name> --region <region>

いずれかが 401/403 または「Security Token expired」を返した場合は、ユーザーが実行すべき正確なコマンドを提示してください — 成功したように見せかけないこと。

4. AIDP クラスターの到達性と状態

curl -s -H "..." \
  "<AIDP_BASE>/dataLakes/<DATALAKE_OCID>/workspaces/<WORKSPACE_UUID>/clusters/<CLUSTER_ID>" \
  | python3 -c "import json,sys; d=json.load(sys.stdin); print(d.get('lifecycleState'))"

Active が期待される値です。許容される一時的な状態は StartingUpdating です。 Stopped または Failed の場合は、Pass-2 を実行する前に AIDP コンソールからクラスターを起動するよう案内してください。

auth=signer(マイグレーターのヘルパー)を使った curl が正しい方法です。 正確なワンライナーが必要な場合は、Python での実行を提案してください (env-coords.md の 4 つのプレースホルダー値を埋めてください):

import oci, requests

# env-coords.md から設定してください (references/env-coords.template.md 参照):
profile = "<your-profile-name>"
base    = "<AIDP_BASE>"          # 例: https://aidp.<region>.oci.oraclecloud.com/20240831
lake    = "<DATALAKE_OCID>"
ws      = "<WORKSPACE_UUID>"
cl      = "<CLUSTER_ID>"

cfg = oci.config.from_file(profile_name=profile)
signer = oci.signer.Signer(cfg["tenancy"], cfg["user"], cfg["fingerprint"], cfg["key_file"])
r = requests.get(f"{base}/dataLakes/{lake}/workspaces/{ws}/clusters/{cl}", auth=signer)
print(r.json().get("lifecycleState"))

5. ワークスペースへの書き込み権限

オペレーターが対象の出力パス配下に書き込めるかを確認します:

python3 -c "
import oci, requests, urllib.parse, os
cfg = oci.config.from_file(profile_name='<profile>')
signer = oci.signer.Signer(cfg['tenancy'], cfg['user'], cfg['fingerprint'], cfg['key_file'])
base = '<AIDP_BASE>'
lake = '<DATALAKE_OCID>'
ws = '<WORKSPACE_UUID>'
path = '<output-workspace-path>'
r = requests.get(f'{base}/dataLakes/{lake}/workspaces/{ws}/objects',
                 params={'path': path}, auth=signer)
print(r.status_code, r.text[:200])
"
  • 200 → 正常
  • 404 → AIDP コンソールから、または POST .../objectstype=FOLDER)でフォルダーを作成するよう案内
  • 401/403 → オペレーターの OCI プリンシパルに、このワークスペースへの workspace.write 権限がありません

6. マイグレーター Python コンパイルの健全性チェック

python3 -m py_compile ${CLAUDE_PLUGIN_ROOT}/engine/scripts/build_dag.py ${CLAUDE_PLUGIN_ROOT}/engine/scripts/check_data_availability.py \
                      ${CLAUDE_PLUGIN_ROOT}/engine/scripts/job_migrate.py ${CLAUDE_PLUGIN_ROOT}/engine/scripts/migrate_catalog.py

正常であれば何も出力されません。Python バージョンの不一致が報告された場合、ユーザーは誤ったインタープリターを使用しています。

出力テンプレート

実行後、以下の形式の単一テーブルをユーザーに報告してください:

| チェック項目              | 状態 | 備考 |
|---|---|---|
| Python 依存パッケージ     |  OK  | 3.13.x、5パッケージすべて存在 |
| ANTHROPIC_API_KEY         |  OK  | 設定済み、100文字以上 |
| OCI 認証 (api_key)        |  OK  | プロファイル <name>、リージョン <region> |
| クラスター状態            |  OK  | Active |
| ワークスペース書き込み    |  OK  | 出力ベースに到達可能 |
| マイグレーターコンパイル  |  OK  | 4つのエントリーポイントすべてコンパイル成功 |

FAIL の行がある場合 → 修正のためにユーザーが実行すべき正確なコマンドを提示してください。 いずれかのチェックが失敗した場合は、他のスキルへ進まないでください。

注意事項

  • このスキルは何も変更しません。読み取り専用です。
  • ユーザーがセッショントークンを使用しており、有効期限が近づいている場合(oci session validate で残り 10 分未満が表示される場合)は警告を出し、aidp-migrate-job のような長時間実行スキルを呼び出す 前に トークンを更新するよう提案してください。
  • リージョン、DataLake、ワークスペース、またはクラスターに変更があった場合は再実行してください。
原文(English)を表示

aidp-migrator-bootstrap — environment readiness check

Confirms everything the migrator needs is in place before any of the other skills attempt real work. Idempotent — re-runnable whenever you suspect drift.

When to use

  • The user is running the migrator for the first time on this workstation.
  • Any other skill fails with an OCI auth, network, or cluster-not-found error.
  • The user moved to a new region / DataLake / workspace and you need to re-verify.

Required env-coords

Before any check below works, the user MUST have an env-coords.md (or any plain notes file) listing all of these. Refuse to proceed and ask for them if any are missing — never guess.

Coordinate Example shape (do NOT use any of these literal values — these are placeholders)
AIDP REST base URL https://aidp.<region>.oci.oraclecloud.com/20240831
DataLake OCID ocid1.aidataplatform.oc1.<region>.<id>
Workspace UUID <8-4-4-4-12> UUID format
Cluster ID <8-4-4-4-12> UUID format
OCI profile name <your-profile> (e.g. the section name in ~/.oci/config)
Output workspace path Shared/aidp-migration-tool-output/ (or your team's path)

Save these into a env-coords.md file at the project root, gitignored. Every other skill in this plugin threads these through verbatim. See references/env-coords.template.md for a complete scaffold.

Step-by-step

1. Python prereqs

The migrator engine ships bundled with this plugin under ${CLAUDE_PLUGIN_ROOT}/engine/. Install its Python dependencies once:

python3 --version          # 3.10+
pip install -r ${CLAUDE_PLUGIN_ROOT}/engine/requirements.txt

Expected packages: oci, requests, websocket-client, anthropic, cryptography. If any is missing, install + retry.

2. ANTHROPIC_API_KEY env var

echo $ANTHROPIC_API_KEY | wc -c    # should be >50 chars

If empty, the migrator's Pass-2 cell-by-cell loop will crash. Ask the user to export ANTHROPIC_API_KEY=sk-ant-....

3. OCI authentication

Two valid paths — confirm which the user is using:

API key (recommended for unattended runs)

oci iam region list --profile <profile-name>     # returns a region list on success

Session token (interactive only, expires ~1 hr)

oci session validate --profile <profile-name>
# if expired:
oci session authenticate --profile <profile-name> --region <region>

If either returns 401/403 or "Security Token expired", surface the exact command the user should run — do not pretend success.

4. AIDP cluster reachability + state

curl -s -H "..." \
  "<AIDP_BASE>/dataLakes/<DATALAKE_OCID>/workspaces/<WORKSPACE_UUID>/clusters/<CLUSTER_ID>" \
  | python3 -c "import json,sys; d=json.load(sys.stdin); print(d.get('lifecycleState'))"

Expect Active. Acceptable transient states are Starting, Updating. If Stopped or Failed, instruct the user to start the cluster from AIDP console before any Pass-2 run.

Curl with auth=signer (the migrator's helper) is the proper way; if the user wants an exact one-liner, suggest it in Python (fill the four placeholder values from your env-coords.md):

import oci, requests

# Fill these from env-coords.md (see references/env-coords.template.md):
profile = "<your-profile-name>"
base    = "<AIDP_BASE>"          # e.g. https://aidp.<region>.oci.oraclecloud.com/20240831
lake    = "<DATALAKE_OCID>"
ws      = "<WORKSPACE_UUID>"
cl      = "<CLUSTER_ID>"

cfg = oci.config.from_file(profile_name=profile)
signer = oci.signer.Signer(cfg["tenancy"], cfg["user"], cfg["fingerprint"], cfg["key_file"])
r = requests.get(f"{base}/dataLakes/{lake}/workspaces/{ws}/clusters/{cl}", auth=signer)
print(r.json().get("lifecycleState"))

5. Workspace write permission

Confirm the operator can write under the target output path:

python3 -c "
import oci, requests, urllib.parse, os
cfg = oci.config.from_file(profile_name='<profile>')
signer = oci.signer.Signer(cfg['tenancy'], cfg['user'], cfg['fingerprint'], cfg['key_file'])
base = '<AIDP_BASE>'
lake = '<DATALAKE_OCID>'
ws = '<WORKSPACE_UUID>'
path = '<output-workspace-path>'
r = requests.get(f'{base}/dataLakes/{lake}/workspaces/{ws}/objects',
                 params={'path': path}, auth=signer)
print(r.status_code, r.text[:200])
"

200 → good. 404 → ask the user to create the folder via AIDP console or via POST .../objects with type=FOLDER. 401/403 → the operator's OCI principal lacks workspace.write on this workspace.

6. Migrator pyc compile sanity

python3 -m py_compile ${CLAUDE_PLUGIN_ROOT}/engine/scripts/build_dag.py ${CLAUDE_PLUGIN_ROOT}/engine/scripts/check_data_availability.py \
                      ${CLAUDE_PLUGIN_ROOT}/engine/scripts/job_migrate.py ${CLAUDE_PLUGIN_ROOT}/engine/scripts/migrate_catalog.py

Should be silent. If a Python-version mismatch is reported, the user is on the wrong interpreter.

Output template

After running, report back to the user as a single table:

| Check               | Status | Notes |
|---|---|---|
| Python deps         |  OK    | 3.13.x, all 5 deps present |
| ANTHROPIC_API_KEY   |  OK    | set, 100+ chars |
| OCI auth (api_key)  |  OK    | profile <name>, region <region> |
| Cluster state       |  OK    | Active |
| Workspace write     |  OK    | output base reachable |
| Migrator compile    |  OK    | all 4 entrypoints compile |

Any FAIL row → emit the exact command the user needs to run to fix it. Do not proceed to other skills if any check failed.

Notes

  • This skill never modifies anything. It is read-only.
  • If the user is on a session token and it's about to expire (oci session validate shows <10 minutes remaining), warn them and suggest refresh BEFORE invoking a long-running skill like aidp-migrate-job.
  • Re-run after any change in region, DataLake, workspace, or cluster.

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。