• Projects
  • Service
  • About
  • branding.bz
  • Podcast
  • Tips
  • FAQ
  • Recruit
  • Download
  • Contact
  • branding.bz(ブランド構築SaaS)
  • DESIGN NOW(デザインメディア)
  • X
  • LinkedIn
  • Spotify
  • Facebook

213-0011 神奈川県川崎市高津区久本3-6-7-303

© 2026 ID INC. All rights reserved

claude-skills/スキル
SKILLOfficialdevelopment

platform-deploy-validate

プラグイン
salesforce-development
ソース
GitHub で見る ↗
説明

Salesforce メタデータ(データベースの構造などの設定情報)をデプロイ前に検証します。 **使用場面:** - ユーザーがデプロイの検証、ドライラン(実行前の試験)、デプロイ前のチェック、または本番環境へのデプロイを依頼した場合 **動作:** - 本番環境をターゲットとする場合:`sf project deploy validate` コマンドを実行し、10日間有効なクイックデプロイ用のジョブIDを返却 - サンドボックス環境やスクラッチ環境をターゲットとする場合:`sf project deploy start --dry-run` コマンドを実行 **注意:** 実際のデプロイ操作には使用しないでください(その場合は platform-metadata-deploy を使用してください)。また、削除を伴う変更にも対応していません(その場合は platform-destructive-deploy を使用してください)。

原文を表示

Validate Salesforce metadata before deploying. TRIGGER when the user asks to validate a deploy, do a dry-run, check before deploying, or targets a Production org for any deploy operation. Routes prod targets to `sf project deploy validate` (returns a 10-day quick-deploy job ID) and sandbox/scratch targets to `sf project deploy start --dry-run`. DO NOT TRIGGER for actual deploys (use platform-metadata-deploy) or destructive changes (use platform-destructive-deploy).

ユースケース
  • デプロイ前の検証を実施したい
  • 本番環境へのドライランを試験したい
  • デプロイの影響範囲を確認したい
本文(日本語訳)

デプロイメントの検証

メタデータをデプロイする前に、サーバー側で検証を実行します。検証はメタデータを変更せずにエラーを特定でき、本番環境の場合は platform-quick-deploy で使用可能なジョブIDを生成して、テストなしの高速デプロイを実現します。

機能の選択基準

Tooling API(低レベルAPI)の代わりに、常に sf project deploy validate(本番)または sf project deploy start --dry-run(サンドボックス/スクラッチ環境)を優先してください。

ワークフロー

ステップ1 — 対象の組織を確認

ゲート(チェックポイント)の分類機能を使って組織を分類します。この機能が信頼できる情報源です(サンドボックス/スクラッチの区別、試用版やDeveloper Edition、開発ハブを判別し、production|sandbox|scratch|trial|devhub|unknown のいずれかを返します):

sf org display --target-org <alias> --json | "${CLAUDE_PLUGIN_ROOT}/scripts/sf-deploy-gate" classify

production と分類された場合のみステップ2bの本番パスへ進みます。それ以外はステップ2aのサンドボックス/スクラッチパスへ進みます。

ステップ2a — サンドボックス/スクラッチパス(ドライラン)

sf project deploy start --dry-run --target-org <alias> --json [scope flags]

スコープフラグ(以下から1つだけを選択):

  • --source-dir <path> — ディレクトリをデプロイ
  • --metadata <Type:Name> — 指定コンポーネントをデプロイ
  • --manifest manifest/package.xml — マニフェストファイルからデプロイ

デフォルトテストレベル:サンドボックスの場合は --test-level を省略(組織の初期値を使用)。ユーザーが明示的に要求した場合のみ --test-level RunLocalTests を追加します。

報告内容:成功/失敗、試行したコンポーネント、エラー内容。ドライランではジョブIDは返されません(これは正常な動作です)。

ステップ2b — 本番パス(検証)

sf project deploy validate --target-org <alias> --json [scope flags] --test-level RunLocalTests

本番環境の検証にはテストレベルの指定が必須です。デフォルトは RunLocalTests を使用します。ユーザーが明確にテストを指定した場合は RunSpecifiedTests --tests <ClassName>... に切り替えてください。

レスポンスはジョブID(result.id)を返します。このIDは10日間有効です。platform-quick-deploy で使用するため保存します:

mkdir -p .sfdx
echo '{"jobId":"<id>","createdAt":"<iso8601>","targetOrg":"<alias>","testLevel":"RunLocalTests"}' > .sfdx/last-validation.json

報告内容:

  • 検証結果(成功/失敗)
  • ジョブIDと10日間の有効期限
  • テスト結果サマリー(実行数/成功数/失敗数)
  • 推奨次ステップ:このジョブIDで platform-quick-deploy を実行すること

ステップ3 — 失敗時の対応

検証が失敗した場合、result.details.componentFailures と result.details.runTestResult.failures を解析して以下を表示します:

  • トップ5のコンポーネントエラー(完全なメッセージ付き)
  • トップ5のテスト失敗(スタックトレース付き)
  • 改善案(コンポーネント名 → 考えられる原因:依存関係不足、フィールドレベルセキュリティ、構文エラー など)

検証結果に含まれていない無関係なメタデータを変更することは提案しないでください。検証報告の範囲内にとどめてください。

ルール

  • すべてのCLI呼び出しで 必ず --json を使用
  • 本番環境を対象にする場合、検証をスキップしないでください(このスキルから本番環境に対して sf project deploy start を実行しないこと)
  • 検証中に --ignore-errors や --ignore-warnings を使用しないでください。これらのフラグは実際のデプロイ用であり、検証は対象外です
  • ユーザーが検証なしに「本番環境にデプロイ」を要求した場合、まず検証を実行してから platform-quick-deploy に引き継いでください(本番環境への通常デプロイを開始しないこと)
  • 検証ジョブIDを .sfdx/last-validation.json に保存して、クイックデプロイスキルが参照できるようにしてください

出力

常に以下の形式で終了してください:

  • ✅ 検証成功 → platform-quick-deploy へのリンク(ジョブID+有効期限付き)、または本番以外の場合は platform-metadata-deploy へのリンク
  • ❌ 検証失敗 → カテゴリ分けされたエラー一覧と改善案
原文(English)を表示

Validating Deployment

Run a server-side validation before deploying metadata. Validation surfaces errors without modifying the org and — for production targets — produces a job ID usable with platform-quick-deploy for a fast, test-free deploy.

Capability Resolution

Always prefer sf project deploy validate (prod) or sf project deploy start --dry-run (sandbox/scratch) over the Tooling API directly.

Workflow

Step 1 — Confirm the target org

Classify the org with the gate's classifier — it is the authoritative source of truth (it handles sandbox/scratch markers, trial and Developer Edition hosts, and dev hubs, and returns one of production|sandbox|scratch|trial|devhub|unknown):

sf org display --target-org <alias> --json | "${CLAUDE_PLUGIN_ROOT}/scripts/sf-deploy-gate" classify

Only production takes the production path (Step 2b); every other result takes the sandbox/scratch path (Step 2a).

Step 2a — Sandbox/Scratch path (dry-run)

sf project deploy start --dry-run --target-org <alias> --json [scope flags]

Scope flags (use exactly one, not all):

  • --source-dir <path> — deploy a directory
  • --metadata <Type:Name> — deploy specific components
  • --manifest manifest/package.xml — deploy from manifest

Default test level: omit --test-level for sandboxes (defers to org default). Add --test-level RunLocalTests only if the user asks.

Report back: success/failure, components attempted, any errors. No job ID is returned for dry-runs (this is expected).

Step 2b — Production path (validate)

sf project deploy validate --target-org <alias> --json [scope flags] --test-level RunLocalTests

Production validations REQUIRE a test level. Use RunLocalTests by default; switch to RunSpecifiedTests --tests <ClassName>... if the user has explicitly listed tests.

The response returns a job ID (result.id) valid for 10 days. Persist it for platform-quick-deploy:

mkdir -p .sfdx
echo '{"jobId":"<id>","createdAt":"<iso8601>","targetOrg":"<alias>","testLevel":"RunLocalTests"}' > .sfdx/last-validation.json

Report:

  • Validation result (passed / failed)
  • Job ID and 10-day expiry date
  • Test results summary (run / passed / failed)
  • Recommended next step: platform-quick-deploy with this job ID

Step 3 — Failure triage

If validation fails, parse result.details.componentFailures and result.details.runTestResult.failures and surface:

  • Top 5 component errors with full message
  • Top 5 test failures with stack
  • Suggested fix (component name → likely cause: missing dependency, FLS, syntax, etc.)

Do NOT propose fixes that change unrelated metadata. Stay scoped to what the validation reported.

Rules

  • ALWAYS use --json on every CLI call
  • NEVER skip validation when targeting Production (do not run sf project deploy start against prod from this skill)
  • NEVER use --ignore-errors or --ignore-warnings during validation; those flags belong to actual deploys, not validation
  • If the user asks to "deploy to prod" without prior validation, FIRST run validation, THEN hand off to platform-quick-deploy (do not start a regular deploy against prod)
  • Persist the validation job ID to .sfdx/last-validation.json so the quick-deploy skill can find it

Output

Always end with:

  • ✅ Validation passed → next-step pointer to platform-quick-deploy (with job ID + expiry) OR to platform-metadata-deploy for non-prod
  • ❌ Validation failed → categorized error list and suggested next iteration

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