🔄output-dev-upgrade-prompt-models
- プラグイン
- outputai
- ソース
- GitHub で見る ↗
説明
プロンプトファイル(.prompt)全体にわたって、各プロンプトが属するモデルファミリーの最新バージョンへ `model` フィールドを一括アップグレードします。 次のような場合に使用: - プロンプトのモデルバージョンがずれてしまっている場合(例: sonnet-4 → sonnet-4-6) - フレームワークの更新を長期間行っていなかった場合 - 定期的なモデル鮮度チェックの一環として実施する場合 同一ファミリー内のアップグレードのみを対象とし、プロバイダーやモデルのティアを変更することは一切ありません。
原文を表示
Bulk-upgrade the model field across .prompt files to the latest version of each prompt's existing family. Use when prompt models have drifted (eg sonnet-4 → sonnet-4-6), after a long pause between framework updates, or as part of a periodic model-freshness pass. Within-family only — never changes provider or tier.
ユースケース
- ✓モデルバージョンがずれている場合
- ✓フレームワーク更新後の対応
- ✓定期的なモデル鮮度チェック
本文(日本語訳)
プロンプトモデルのインプレースアップグレード
プロジェクト内(またはスコープを絞ったサブツリー内)のすべての .prompt ファイルを走査し、各モデルをプロバイダー+ファミリーのバケットに分類します。次に output-dev-model-selection のスナップショットを使って同バケット内の最新安定版モデルを調べ、model: の行を書き換えます。プロバイダーとファミリーのティアは維持されます — Haiku は Haiku のまま、Anthropic は Anthropic のままです。
このスキルは、意図的にプロバイダーの切り替えやティアのエスカレーション(例: Haiku → Sonnet)を行いません。それらは人間が別途判断すべき意思決定です。
呼び出すタイミング
次のような場合に使用:
- 定期的なリフレッシュ: 「すべてのプロンプトモデルを最新版にアップグレードしたい」
- フレームワーク更新の間隔が長く空いてしまい、日付入りのスナップショット ID(例:
claude-sonnet-4-20250514)が古くなっている場合 - CLI スキャフォルダーで新しいプロジェクトを作成した直後に、テンプレートのデフォルト値をすべて現在の最新版に更新したい場合
ワークフロー
ステップ 1 — 探索
対象スコープ内のすべての .prompt ファイルを探します。
デフォルトスコープはプロジェクトの src/ ツリーです。ユーザーが特定のワークフローのみにスコープを絞ることもできます。
ステップ 2 — 現在のモデルを解析
各ファイルについて、YAML フロントマター(最初の --- の間の部分)を読み込み、provider: と model: を取得します。
ステップ 3 — ファミリーを分類
既存のモデルをファミリーバケットに照合します。 ファミリーはアップグレードを通じて保持されます。
| パターン | ファミリー |
|---|---|
claude-opus-* |
anthropic-opus |
claude-sonnet-* |
anthropic-sonnet |
claude-haiku-* |
anthropic-haiku |
gpt-*-pro |
openai-pro |
gpt-*-mini |
openai-mini |
gpt-*-nano |
openai-nano |
gpt-N.M(サフィックスなし) |
openai-default |
gemini-*-flash-lite* |
google-flash-lite |
gemini-*-flash* |
google-flash |
gemini-*-pro* |
google-pro |
どのパターンにも一致しないモデルは、そのファイルをスキップして警告をログに記録します。推測で処理してはいけません。
ステップ 4 — ファミリー内の最新版を調べる
各プロンプトについて、output-dev-model-selection を参照し、同じファミリー内の最新安定版モデルを探します。スナップショットを取得し、フィルタールール(preview / alpha / beta はスキップ、バージョンなしのエイリアスを優先)を適用して、選択した id をプロンプトファイル形式に変換します。
以下のファミリー → スナップショットキー + id 正規表現マップを使用して、ルックアップを既存ティアに固定してください:
| ファミリー | スナップショットキー | id 正規表現 |
|---|---|---|
anthropic-opus |
anthropic |
claude-opus- |
anthropic-sonnet |
anthropic |
claude-sonnet- |
anthropic-haiku |
anthropic |
claude-haiku- |
openai-pro |
openai |
-pro$ |
openai-default |
openai |
^openai/gpt-[0-9.]+$ |
openai-mini |
openai |
-mini$ |
openai-nano |
openai |
-nano$ |
google-pro |
google |
-pro(-flash を除く) |
google-flash |
google |
-flash$|-flash-[0-9] |
google-flash-lite |
google |
-flash-lite |
あるファミリーで安定版の一致が存在しない場合(プレリリースエントリーしかない場合)は、その旨をユーザーに伝え、推測したり別ファミリーにダウングレードしたりせずにそのファイルをスキップしてください。
スナップショットの取得に失敗した場合は、大きな声で中断してください。
スナップショットの取得自体が何も返さなかった場合(ネットワーク障害、ゲートウェイの仕様変更、curl や jq が見つからないなど)は、ステップ 5 に進む前に処理を中断してください。空のスナップショットのまま「アップグレード不要」と報告し続けることは 絶対にしてはいけません。それは嘘になります。プロンプトは実際にはチェックされていないからです。スナップショットの取得が失敗したことをユーザーに伝え、output-dev-model-selection の手動フォールバック手順を案内してから終了してください。
ステップ 5 — 差分確認
現在のモデルと解決済みの latest を比較したファイルごとのレポートを作成します:
src/workflows/foo/prompts/bar@v1.prompt claude-sonnet-4-20250514 → claude-sonnet-4-6
src/workflows/foo/prompts/baz@v1.prompt claude-haiku-4-5 ✓ already latest
レポート全体を出力します。ファイルへの書き込みは、ユーザーの明示的な確認を得てから行ってください。 CI / 非インタラクティブな環境では、デフォルトでドライランとします。
ステップ 6 — 編集
確認済みの各ファイルについて、YAML フロントマターのみを編集します:
model:の行を解決済みの最新 ID に置き換える。# current as of YYYY-MM-DD …というコメントが存在する場合(output-dev-prompt-fileの例や CLI スキャフォルドで使われる規約)、その日付を今日の日付(date +%Y-%m-%d)に更新する。コメントの照合はcurrent as ofという文字列プレフィックスで行い、日付部分のみ書き換える — それ以降のテキストはそのまま残す。provider:、temperature:、maxTokens:、providerOptions:、メッセージ本文には一切触れない。
同じ編集で日付コメントも更新することで、「as of」の規約が一貫して保たれます。更新しない場合、アップグレードされたプロンプトに新しいモデルと古い日付が混在してしまいます。
ステップ 7 — 検証
バッチ処理後に以下を行います:
- いくつかのファイルをスポットチェックして、YAML にフロントマターの区切り文字とメッセージ本文が残っていることを確認する。
- プロジェクトの lint およびビルドを実行する(リポジトリルートで
pnpm run lint、pnpm run build:packages)。
Output SDK はビルド時にプロンプトのモデル ID を検証しません(sdk/llm/src/ai_model.js)— 無効な ID は最初の実行時にのみ発覚します。スモークテストが利用可能な場合は、アップグレードしたファミリーごとに少なくとも 1 つのワークフローを実行してください。
注意事項
- ファミリー内のみ。 このスキルは Sonnet → Opus へのアップグレードや、Anthropic から OpenAI への切り替えを行いません。ティアやプロバイダーを変更する場合は、手動でプロンプトを編集するか、
output-dev-prompt-fileを使用してください。 - 日付付きスナップショットはバンプされます。
claude-sonnet-4-20250514のようなピンは、バージョンなしのエイリアスclaude-sonnet-4-6になります。そのピンが再現性のために重要だった場合は、その旨を伝えてファイルをスキップしてください。 @vertexおよびbedrock名前空間サフィックス。claude-sonnet-4-20250514@vertexやanthropic.claude-sonnet-4-20250514-v1:0のようなモデルは手動でアップグレードが必要です。AI ゲートウェイのリストはダイレクトプロバイダー ID のみを対象としています。- models.dev の価格情報の遅延。 アップグレード後も、models.dev が追いつくまでの間、新しいモデルに対して
calculateLLMCallCostがtotal: nullを返すことがあります。ランタイムの呼び出し自体は正常に動作します。
関連情報
output-dev-model-selection— このスキルが使用する正規スナップショットと選択ルールoutput-dev-prompt-file—.promptファイルの構造
原文(English)を表示
Upgrade Prompt Models In-Place
Walks every .prompt file in a project (or scoped subtree), classifies each model into its provider+family bucket, looks up the latest stable model in that bucket via the output-dev-model-selection snapshot, and rewrites the model: line. Provider and family tier are preserved — a Haiku stays a Haiku, an Anthropic stays an Anthropic.
This skill explicitly does not swap providers or escalate tiers (eg Haiku → Sonnet). Those are deliberate human decisions handled separately.
When to invoke
- A periodic refresh: "upgrade all my prompt models to the latest"
- After a long break between framework updates, where dated snapshot IDs (eg
claude-sonnet-4-20250514) have aged out - Right after creating a new project from the CLI scaffolder, to pull every templated default forward to the current best
Workflow
Step 1 — Discover
Find every .prompt file under the target scope. Default scope is the project's src/ tree; the user may scope to a single workflow.
Step 2 — Parse current model
For each file, read the YAML frontmatter (between the first pair of --- lines) and pull out provider: and model:.
Step 3 — Classify family
Match the existing model into a family bucket. Family is preserved across the upgrade.
| Pattern | Family |
|---|---|
claude-opus-* |
anthropic-opus |
claude-sonnet-* |
anthropic-sonnet |
claude-haiku-* |
anthropic-haiku |
gpt-*-pro |
openai-pro |
gpt-*-mini |
openai-mini |
gpt-*-nano |
openai-nano |
gpt-N.M (no suffix) |
openai-default |
gemini-*-flash-lite* |
google-flash-lite |
gemini-*-flash* |
google-flash |
gemini-*-pro* |
google-pro |
If a model doesn't match any pattern, skip the file and log a warning. Do not guess.
Step 4 — Look up latest in family
For each prompt, find the latest stable model in the same family by following output-dev-model-selection — fetch its snapshot, apply its filter rules (skip preview/alpha/beta, prefer unversioned aliases), and translate the chosen id to prompt-file form.
Use this family → snapshot-key + id regex map to pin the lookup to the existing tier:
| Family | Snapshot key | id regex |
|---|---|---|
anthropic-opus |
anthropic |
claude-opus- |
anthropic-sonnet |
anthropic |
claude-sonnet- |
anthropic-haiku |
anthropic |
claude-haiku- |
openai-pro |
openai |
-pro$ |
openai-default |
openai |
^openai/gpt-[0-9.]+$ |
openai-mini |
openai |
-mini$ |
openai-nano |
openai |
-nano$ |
google-pro |
google |
-pro (excluding -flash) |
google-flash |
google |
-flash$|-flash-[0-9] |
google-flash-lite |
google |
-flash-lite |
If no stable match exists for a family (only pre-release entries available), surface that to the user and skip the file rather than guessing or downgrading to a different family.
Bail loudly on a failed snapshot. If the snapshot fetch itself returned nothing — network down, gateway shape changed, curl or jq missing — abort the run before Step 5. Do not continue with an empty snapshot and report "no upgrades needed", because that lies: the prompts weren't actually checked. Tell the user the snapshot fetch failed, point them at the manual-fallback steps in output-dev-model-selection, and exit.
Step 5 — Diff & confirm
Build a per-file report comparing the current model to the resolved latest:
src/workflows/foo/prompts/bar@v1.prompt claude-sonnet-4-20250514 → claude-sonnet-4-6
src/workflows/foo/prompts/baz@v1.prompt claude-haiku-4-5 ✓ already latest
Print the full report. Wait for explicit user confirmation before writing. In CI / non-interactive contexts, default to dry-run.
Step 6 — Edit
For each confirmed file, edit only the YAML frontmatter:
- Replace the
model:line with the resolved latest ID. - If a
# current as of YYYY-MM-DD …comment is present (the convention used inoutput-dev-prompt-fileexamples and CLI scaffolds), update its date to today's (date +%Y-%m-%d). Match the comment by the literalcurrent as ofprefix and only rewrite the date — leave the trailing text intact. - Leave
provider:,temperature:,maxTokens:,providerOptions:, and the message body untouched.
Refreshing the dated comment in the same edit keeps the "as of" convention coherent — without it, an upgraded prompt would have a fresh model paired with a stale date.
Step 7 — Verify
After the batch:
- Spot-check a handful of files to confirm the YAML still has a frontmatter delimiter and message body.
- Run the project's lint and build (
pnpm run lint,pnpm run build:packagesfrom the repo root).
The Output SDK doesn't validate prompt model IDs at build time (sdk/llm/src/ai_model.js) — invalid IDs only surface at first run. If smoke-tests are available, run at least one workflow per upgraded family.
Caveats
- Within-family only. This skill never upgrades Sonnet → Opus, never swaps Anthropic for OpenAI. To change tier or provider, edit prompts manually or use
output-dev-prompt-file. - Dated snapshots get bumped. A pin like
claude-sonnet-4-20250514becomes the unversioned aliasclaude-sonnet-4-6. If the pin was load-bearing for reproducibility, surface that and skip the file. @vertexandbedrocknamespace suffixes. Models likeclaude-sonnet-4-20250514@vertexoranthropic.claude-sonnet-4-20250514-v1:0need manual upgrade. The AI Gateway listing covers direct provider IDs only.- Models.dev pricing lag. Even after the upgrade,
calculateLLMCallCostmay returntotal: nullfor the brand-new model until models.dev catches up. The runtime call still works.
See also
output-dev-model-selection— canonical snapshot + selection rules this skill consumesoutput-dev-prompt-file—.promptfile structure
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。