jpskill.com
📦 その他 コミュニティ

rig-migrate

rig-coreや関連クレートのアップグレード時、破壊的変更の解決時、または非推奨APIの更新時に、Rigコードをバージョン間で移行するためのSkill。

📜 元の英語説明(参考)

Help migrate Rig code between versions. Use when upgrading rig-core or companion crates, resolving breaking changes, or updating deprecated APIs. Detects the current version from Cargo.toml automatically.

🇯🇵 日本人クリエイター向け解説

一言でいうと

rig-coreや関連クレートのアップグレード時、破壊的変更の解決時、または非推奨APIの更新時に、Rigコードをバージョン間で移行するためのSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o rig-migrate.zip https://jpskill.com/download/5979.zip && unzip -o rig-migrate.zip && rm rig-migrate.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/5979.zip -OutFile "$d\rig-migrate.zip"; Expand-Archive "$d\rig-migrate.zip" -DestinationPath $d -Force; ri "$d\rig-migrate.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して rig-migrate.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → rig-migrate フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-17
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

[Skill 名] rig-migrate

Rig 移行アシスタント

現在のプロジェクトの Rig バージョン (自動検出):

!`grep -E '^rig-core|^rig ' Cargo.toml 2>/dev/null || grep -rE 'rig-core\s*=' Cargo.toml */Cargo.toml 2>/dev/null | head -5 || echo "rig-core version not found in Cargo.toml"`

最新の Rig リリース:

!`cargo search rig-core --limit 1 2>/dev/null || echo "Could not fetch latest version. Check https://crates.io/crates/rig-core"`

移行ワークフロー

  1. 検出: 現在のバージョンとターゲットのバージョンを比較します。
  2. 監査: 非推奨のパターンと破壊的な API の使用箇所を検索します。
  3. 計画: 必要なすべてのファイルと変更をリストアップします。
  4. 移行: 変更を体系的に適用します。
  5. 検証: cargo fmtcargo clippy --all-targets --all-featurescargo test を実行します。

一般的な移行パターン

Send/Sync から WasmCompat へ (0.5+ で導入)

すべてのトレイト境界は WASM 互換のバリアントを使用する必要があります。

// Before
pub trait MyTrait: Send + Sync {
    fn method(&self) -> impl Future<Output = ()> + Send;
}

// After
use rig::{WasmCompatSend, WasmCompatSync};

pub trait MyTrait: WasmCompatSend + WasmCompatSync {
    fn method(&self) -> impl Future<Output = ()> + WasmCompatSend;
}

検索パターン: grep -rn ': Send\b\|+ Send\b\|: Sync\b\|+ Sync\b' --include='*.rs'

String エラー型から適切な Enum へ

// Before
fn process() -> Result<(), String> { ... }

// After
#[derive(Debug, thiserror::Error)]
enum ProcessError {
    #[error("Parse failed: {0}")]
    Parse(#[from] serde_json::Error),
}

fn process() -> Result<(), ProcessError> { ... }

検索パターン: grep -rn 'Result<.*,\s*String>' --include='*.rs' (誤検知を避けるため、結果は手動で確認する必要があります)

プロバイダー API の更新

プロバイダーが API を更新すると、Rig の型定義が変更されます。特定のフィールドの追加/削除については、CHANGELOG を確認してください。

典型的な変更:

  • リクエスト/レスポンス構造体に追加された新しいフィールド
  • モデル定数の名前変更 (例: GPT_4 -> GPT_4O)
  • 新しい機能宣言

CompletionRequest モデルのオーバーライド (新規)

CompletionRequest にオプションの model フィールドが追加されました。

// CompletionRequest を手動で構築する場合、フィールドを含めます:
let request = CompletionRequest {
    model: None,  // or Some("model-override".to_string())
    preamble: None,
    chat_history: OneOrMany::one("Hello".into()),
    // ... rest of fields
};

移行チェックリスト

移行時にこのチェックリストを使用してください:

  • [ ] すべての Cargo.toml ファイルで rig-core のバージョンを更新する
  • [ ] コンパニオンクレートのバージョン (rig-mongodbrig-lancedb など) を更新する
  • [ ] 非推奨の API パターンを検索する
  • [ ] Send/SyncWasmCompatSend/WasmCompatSync に置き換える
  • [ ] String エラー型を適切なエラー enum に置き換える
  • [ ] 失敗する可能性のある操作から .unwrap() / .expect() を削除する
  • [ ] モデル定数が名前変更されている場合は更新する
  • [ ] cargo fmt && cargo clippy --all-targets --all-features && cargo test を実行する
  • [ ] 例がまだコンパイルされることを確認する
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Rig Migration Assistant

Current project Rig version (auto-detected):

!`grep -E '^rig-core|^rig ' Cargo.toml 2>/dev/null || grep -rE 'rig-core\s*=' Cargo.toml */Cargo.toml 2>/dev/null | head -5 || echo "rig-core version not found in Cargo.toml"`

Latest Rig release:

!`cargo search rig-core --limit 1 2>/dev/null || echo "Could not fetch latest version. Check https://crates.io/crates/rig-core"`

Migration Workflow

  1. Detect: Compare current version against target version.
  2. Audit: Search for deprecated patterns and breaking API usages.
  3. Plan: List all files and changes required.
  4. Migrate: Apply changes systematically.
  5. Validate: Run cargo fmt, cargo clippy --all-targets --all-features, cargo test.

Common Migration Patterns

Send/Sync to WasmCompat (introduced in 0.5+)

All trait bounds must use WASM-compatible variants:

// Before
pub trait MyTrait: Send + Sync {
    fn method(&self) -> impl Future<Output = ()> + Send;
}

// After
use rig::{WasmCompatSend, WasmCompatSync};

pub trait MyTrait: WasmCompatSend + WasmCompatSync {
    fn method(&self) -> impl Future<Output = ()> + WasmCompatSend;
}

Search pattern: grep -rn ': Send\b\|+ Send\b\|: Sync\b\|+ Sync\b' --include='*.rs'

String Error Types to Proper Enums

// Before
fn process() -> Result<(), String> { ... }

// After
#[derive(Debug, thiserror::Error)]
enum ProcessError {
    #[error("Parse failed: {0}")]
    Parse(#[from] serde_json::Error),
}

fn process() -> Result<(), ProcessError> { ... }

Search pattern: grep -rn 'Result<.*,\s*String>' --include='*.rs' (results should be manually verified to avoid false positives)

Provider API Updates

When providers update their APIs, Rig's type definitions change. Check the CHANGELOG for specific field additions/removals.

Typical changes:

  • New fields added to request/response structs
  • Model constant renames (e.g., GPT_4 -> GPT_4O)
  • New capability declarations

CompletionRequest Model Override (new)

CompletionRequest now has an optional model field:

// When constructing CompletionRequest manually, include the field:
let request = CompletionRequest {
    model: None,  // or Some("model-override".to_string())
    preamble: None,
    chat_history: OneOrMany::one("Hello".into()),
    // ... rest of fields
};

Migration Checklist

Use this checklist when migrating:

  • [ ] Update rig-core version in all Cargo.toml files
  • [ ] Update companion crate versions (rig-mongodb, rig-lancedb, etc.)
  • [ ] Search for deprecated API patterns
  • [ ] Replace Send/Sync with WasmCompatSend/WasmCompatSync
  • [ ] Replace String error types with proper error enums
  • [ ] Remove .unwrap() / .expect() on fallible operations
  • [ ] Update model constants if renamed
  • [ ] Run cargo fmt && cargo clippy --all-targets --all-features && cargo test
  • [ ] Verify examples still compile