ローカルのSalesforce開発環境を検証し、設定します。Salesforce CLI、Code Analyzer プラグイン(コード分析拡張機能)、Node.js、NPM、Git、Salesforce MCP、ソース追跡に必要なすべてのツールについて、🔴/🟡/🟢の状態を表示する事前確認スキャンを実行します。不足しているツールや古いバージョンのツールのインストール・更新を提案します。 **次のような場合に使用:** - ユーザーが /salesforce-development:platform-environment-validate を実行した - 「セットアップを確認して」「ツールを検証して」「前提条件を確認して」「正しくセットアップされている?」などと尋ねられた - ツールが見つからない、または動作していないと報告された **このスキルを使用しないでください:** - 組織の認証に関する問題(/salesforce-development:login を使用) - デプロイメント(展開)に関する問題(platform-metadata-deploy を使用) - 一般的な状態確認(/salesforce-development:status を使用)
Validate and configure the local Salesforce development environment. Runs a prerequisite scan showing 🔴/🟡/🟢 status for all required tools (Salesforce CLI, Code Analyzer plugin, Node.js, NPM, Git, Salesforce MCP, Source Tracking) and offers to install or update missing/outdated items. TRIGGER when the user runs /salesforce-development:platform-environment-validate, asks to 'check my setup', 'validate tools', 'verify prerequisites', 'am I set up correctly', or reports that a tool is missing or not working. DO NOT TRIGGER for: org authentication issues (use /salesforce-development:login), deployment problems (use platform-metadata-deploy), or general status checks (use /salesforce-development:status).
すべての必須準備が整っているかを確認し、明確で実行可能な状態レポートを表示します。このスキルはオンデマンド型です。セッション開始時には自動実行されません。明示的に実行して、ローカル設定を確認または修復してください。
ツール確認コマンドを実行してください:
${CLAUDE_PLUGIN_ROOT}/scripts/sf-context check-tools
出力は、tools配列を含むJSON形式です(重大な障害が生じた場合はdiagnosticブロックも含まれます)。
バナーは自動生成されます。自分で再現しないでください。 check-toolsを実行すると、プラグインは「Salesforce で開発を始めましょう?」というフレーム付きバナーを表示します。各ツールの状態を1行ずつ、その結果、ナビゲーション情報が表示されます。これは重要な表示項目です。JSONの内容を自分で理解するために読んでも構いませんが、バナー自体を再現・再描画・再レンダリングしてはいけません。結果が利用者にとって何を意味するかを簡潔に述べたら、フェーズ2に進んでください。
表示されるバナーは以下のような形式です(例示です。各行のバージョン・メッセージはJSONから直接取得されます):
──────────────────────────────────────────────────────────────
Ready to build on Salesforce? checking your toolchain…
──────────────────────────────────────────────────────────────
🟢 Salesforce CLI v2.144.6
🟢 Code Analyzer v5.14.0 · JIT, auto-installs on first use
🟢 Node.js v22.11.0 LTS
🟢 NPM v10.9.0
🟢 Git v2.50.1
🟢 Salesforce MCP (config) .mcp.json + proxy present
🟢 Salesforce MCP (endpoint) org instance reachable
ℹ️ Salesforce MCP (process) confirm with /mcp or /doctor
🟢 Source Tracking enabled
──────────────────────────────────────────────────────────────
✓ toolchain ready (skill: platform-environment-validate)
各行の状態アイコンが状態を示します:
critical(不足または最小要件以下 — Salesforce開発を続行できません)warn(インストール済みだが古い、非LTS版、または設定に問題あり)okinfo(MCPプロセスの正常性など、自動検証できない情報)フレーム下部には結果判定と最も関連する次のステップが表示されます。JSON のstatusフィールドが各ツールの信頼できる情報源です。簡潔なまとめを書く際はこの状態を参照してください。
バナーが表示されなかった場合(古い Claude Code、またはレンダリング失敗)、JSONから手作業でバナーを作成しないでください。代わりにこのコマンドで表示してください:
${CLAUDE_PLUGIN_ROOT}/scripts/sf-context readiness-banner
このコマンドはcheck-toolsが記録したスキャン結果を読み込み、同じフレーム付きバナーを表示します。行の順序、間隔、個数、次ステップはスクリプトで一度決定され、手作業で再導出されることはありません。check-toolsの JSON は機械可読の信頼できる結果として機能します。
決定的な結果 — 失敗を上書きしないでください: JSONレポートが信頼できる機械可読の結果です。ツールが🔴/🟡を示している場合は、そのまま報告してください。別の方法(PowerShell、直接シェルプローブ、別のコマンド)でツールを再実行し、結果を🟢として提示してはいけません。たまたまツールが見つかったというフォールバックは、その確認チェックが成功したことを意味しません。失敗したチェックは、同じcheck-toolsチェックが成功するまでは失敗のままです。レポートにdiagnosticブロック(重大な失敗時に付加)が含まれている場合は、それを表示してください。プラットフォーム、アクティブシェル、作業ディレクトリ、プラグインルート、解決されたツールの実行可能ファイルパスを含んでいます。これはツールが解決されなかった理由(Windows上のsf.cmdがPATHに無い場合など)を最速で確認する方法です。診断情報は設計上機密情報を含んでいません。トークンや組織認証を追加しないでください。
MCP は3つの独立した行として報告されます — お互いから推測しないでください:
Salesforce MCP (config)(.mcp.jsonとsf-mcp-proxy.bundled.jsがあるか?)Salesforce MCP (endpoint)(プラットフォームエンドポイントに到達できるか?)Salesforce MCP (process)(MCPプロセスが実際に健全か?)プロセス行は情報提供用(警告ではない)として報告されます — このスクリプトはClaudeが所有するMCPサブプロセスを確認できないため、設定とエンドポイントが緑でもMCPが機能していると提示してはいけません。プロセスの健全性を確認するには/mcpまたは/doctorを使用してください。エンドポイント行は、プラットフォーム-MCPエンドポイント自体ではなく、組織のインスタンスURLを接続性の代理として探索します。
| ツール | 最小要件 | 確認方法 |
|---|---|---|
| Salesforce CLI | インストール済み、かつ最新リリース版 | sf --version(更新が利用可能な場合は🟡) |
| Code Analyzer プラグイン | インストール済み または JIT登録済み(初回使用時に自動インストール) | sf plugins inspect @salesforce/plugin-code-analyzer、またはCLIのoclif.jitPluginsレジストリへのフォールバック |
| Node.js | >= 18(偶数番号またはLTS版) | node --version |
| NPM | >= 3.10 | npm --version |
| Git | インストール済み | git --version |
| Salesforce MCP (config) | .mcp.jsonが設定済み + プロキシバンドル存在 |
プラグインルート内の.mcp.json確認 + sf-mcp-proxy.bundled.jsの有無確認 |
| Salesforce MCP (endpoint) | 組織インスタンスURLに到達可能(接続性確認) | 組織インスタンスURLへのHTTPプローブ |
| Salesforce MCP (process) | ℹ️ 情報提供用 — ここでは検証不可 | /mcpまたは/doctorで確認してください |
| Source Tracking | 接続された組織で有効 | sf project deploy preview |
すべての外部ツール(sf、npm、node、git)はクロスプラットフォーム対応の単一リゾルバーを介して実行されます。shutil.whichがツールを検出し、Windows では.cmd/.batシムが COMSPEC でラップされた argv 配列を介して呼び出されます。シェル文字列ではなく、この確認とデフォルト組織の検出は Windows、macOS、Linux で正しく機能します。
Code Analyzer は JIT プラグイン — 登録 ≠ インストール済み。 Salesforce CLI は@salesforce/plugin-code-analyzerを「ジャストインタイム」(JIT)プラグインとして宣言しています。これはsf code-analyzerコマンドを初めて実行した時点で物理的にインストールされます。それまでは、sf plugins inspectは完全に利用可能であっても失敗します。したがって確認では JIT 登録を成功として扱います。inspectがバージョンを返さない場合、CLI 自身のoclif.jitPluginsレジストリ(sf plugins --jsonのルートエントリから読み込み)にフォールバックし、🟢 と固定バージョンおよび初回使用時に自動インストールされる旨のメモを報告します。インストールもJIT登録もされていないプラグインのみが🔴 です。
すべてが緑の場合: セットアップが完了したことを確認します。利用者は開発を開始できます。
警告または重大項目がある場合: ユーザーに選択肢を提示してください:
いくつかのツールが注意を要します。何をしたいですか?
[1] すべて修復
[2] 修復する項目を選択
[3] スキップ
ユーザーが修復を希望する各ツールについて、その OS に適したインストール/更新コマンドを提供してください。インストールコマンドは自動実行しないでください。コマンドを表示し、実行前にユーザーに確認を求めてください。
Salesforce CLI — インストールされていない:
# macOS/Linux (npm)
npm install --global @salesforce/cli
# macOS (Homebrew)
brew install sf
Salesforce CLI — 更新:
sf update
Code Analyzer プラグイン — インストールされていない:
sf plugins install @salesforce/plugin-code-analyzer
Code Analyzer プラグイン — 更新:
sf plugins update @salesforce/plugin-code-analyzer
Node.js — インストールされていない、または最小要件以下:
# macOS (nvm — 推奨、LTS をインストール)
nvm install --lts && nvm use --lts
# macOS (Homebrew)
brew install node
# Windows — https://nodejs.org からダウンロード(LTS版)
NPM — 更新:
npm install --global npm@latest
Git — インストールされていない:
# macOS (Xcode コマンドラインツール)
xcode-select --install
# macOS (Homebrew)
brew install git
# Windows — https://git-scm.com からダウンロード
Source Tracking — 有効化されていない:
sf org enable tracking --target-org <alias>
Salesforce MCP — 設定に問題がある: .mcp.jsonがない、または空の場合はプラグインを再読み込みしてください:
/reload-plugins
PATH を変更するツール(Node.js、SF CLI)をインストール後、ユーザーは Claude Code を終了し、再起動する必要がある場合があります。
Source Tracking は接続された組織が必須です。組織が設定されていない場合は、先に/salesforce-development:loginを実行するよう促してください。
組織認証の問題(セッション失効、組織間違い、INVALID_SESSION_ID)がある場合は、このスキルの代わりに/salesforce-development:loginを実行してください。
SF CLI が古い → 準備スキャンで🟡: 準備とは最新を意味します。CLI のキャッシュされた更新チェックが新しいリリースを報告すると、check-toolsは Salesforce CLI を🟡(インストール済みだが古い)として報告し、正しい更新コマンドを表示します。セッション開始時の通知とは異なり、この警告はバージョン別の通知非表示ゲートを無視します — 明示的な準備スキャンは常に実際の状態を報告します — ただし、ハードオプトアウトSFDX_SKIP_CLI_UPDATE_CHECK=1は尊重されます。
セッション開始時の SF CLI 更新通知: CLI が利用可能な更新を報告すると、sf-context detectのセッション開始フックが一度それを表示し、エージェントに更新を提供するよう依頼します(sf update、または npm グローバルインストール時はnpm install --global @salesforce/cli@latest)。拒否または更新失敗はバージョン別の通知非表示ゲート(.sf/sf-cli-update-state.json)を記録するため、同じバージョンは再度通知されませんが、新しいリリースは再度促します。SFDX_SKIP_CLI_UPDATE_CHECK=1を設定すると、チェック全体が無効化されます。
Validate all required prerequisites and surface a clear, actionable status report. This skill is on-demand — it does not run automatically on session start. Run it explicitly to check or repair your local setup.
Run the tool check:
${CLAUDE_PLUGIN_ROOT}/scripts/sf-context check-tools
The output is a JSON object with a tools array (plus a diagnostic block on any critical failure).
The banner is painted for you — do not reproduce it. When check-tools runs, the plugin paints the framed "Ready to build on Salesforce?" banner deterministically on the visible channel — one status row per tool, the footer verdict, and the wayfinding footer — exactly like the SessionStart banner. It is a Tier-1 surface: read the JSON for your own understanding, but do NOT reproduce, redraw, or re-render the banner. Add only a short read of what the result means for the user, then go to Phase 2.
The painted banner looks like this (illustrative — the version/message text in each row comes straight from the JSON: version for 🟢, message + fix hint for 🟡/🔴, the note for ℹ️; the values below show the style, not fixed strings):
──────────────────────────────────────────────────────────────
Ready to build on Salesforce? checking your toolchain…
──────────────────────────────────────────────────────────────
🟢 Salesforce CLI v2.144.6
🟢 Code Analyzer v5.14.0 · JIT, auto-installs on first use
🟢 Node.js v22.11.0 LTS
🟢 NPM v10.9.0
🟢 Git v2.50.1
🟢 Salesforce MCP (config) .mcp.json + proxy present
🟢 Salesforce MCP (endpoint) org instance reachable
ℹ️ Salesforce MCP (process) confirm with /mcp or /doctor
🟢 Source Tracking enabled
──────────────────────────────────────────────────────────────
✓ toolchain ready (skill: platform-environment-validate)
Each row's status dot carries the state — 🔴 critical (missing or below minimum — Salesforce development cannot proceed), 🟡 warn (installed but outdated, non-LTS, or misconfigured), 🟢 ok, ℹ️ info (a contextual note that can't be auto-verified, e.g. MCP process health) — and the framed footer gives the verdict plus the single most relevant Next: step. The JSON status field is the source of truth per tool; use these states when you write your short read.
If the banner did not paint (an older Claude Code build, or a paint fallback), do not hand-render it from the JSON. Print it with the deterministic renderer instead:
${CLAUDE_PLUGIN_ROOT}/scripts/sf-context readiness-banner
This reads the same scan result check-tools just recorded and prints the identical framed banner — rows in fixed order, the footer verdict, and the "you don't memorize commands here" wayfinding footer with its Next: step — so ordering, padding, counts, and next-step selection are decided once in the script, never re-derived by hand. The check-tools JSON stays the authoritative, machine-readable result.
Deterministic results — do NOT override a failure: the JSON report
is the authoritative, machine-readable result. If a tool reports 🔴/🟡, report it
as-is. Do not re-run the tool a different way (PowerShell, a raw shell probe,
a different command) and then present the result as 🟢 — a fallback that happens
to find the tool does not mean the deterministic check passed. A failed check
must stay failed until that same check-tools check passes. When the report
includes a diagnostic block (attached on any critical failure), surface it: it
carries the platform, active shell, working directory, plugin root, and the
resolved executable paths — the fastest way to see why a tool didn't resolve
(e.g. a Windows sf.cmd not on PATH). The diagnostic is secret-free by design;
never add tokens or org auth to it.
MCP is reported as three distinct rows — never inferred from one another:
Salesforce MCP (config) (is .mcp.json + the sf-mcp-proxy.bundled.js present?),
Salesforce MCP (endpoint) (is the platform endpoint reachable?), and
Salesforce MCP (process) (is the MCP process actually healthy?). The process row
is reported as ℹ️ informational (not a warning) — this script cannot see the
MCP subprocess that Claude Code owns, so a green config/endpoint must not be
presented as a working MCP. Confirm process health with /mcp or /doctor. The
endpoint row probes the org instance URL as a connectivity proxy, not the
platform-MCP endpoint itself.
| Tool | Minimum Requirement | Verification |
|---|---|---|
| Salesforce CLI | Present, and on the latest release | sf --version (🟡 when an update is available) |
| Code Analyzer plugin | Installed or JIT-registered | sf plugins inspect @salesforce/plugin-code-analyzer, falling back to the CLI's oclif.jitPlugins registry |
| Node.js | >= 18 (even/LTS) | node --version |
| NPM | >= 3.10 | npm --version |
| Git | Must be present | git --version |
| Salesforce MCP (config) | .mcp.json configured + proxy bundle present |
Plugin root .mcp.json check + sf-mcp-proxy.bundled.js presence |
| Salesforce MCP (endpoint) | Org instance URL reachable (connectivity proxy) | HTTP probe of org instance URL |
| Salesforce MCP (process) | ℹ️ informational — not verifiable here | Confirm with /mcp or /doctor |
| Source Tracking | Enabled for connected org | sf project deploy preview |
All external tools (sf, npm, node, git) are launched through a single
cross-platform resolver: shutil.which (PATHEXT-aware) finds the tool,
and a Windows .cmd/.bat shim (sf.cmd, npm.cmd) is invoked via a
COMSPEC-wrapped argv array — never a shell string — so this scan and
/salesforce-development:org detect sf/npm/the default org correctly on
Windows, macOS, and Linux.
Code Analyzer is a JIT plugin — registered ≠ installed. The Salesforce CLI
declares @salesforce/plugin-code-analyzer as a "just-in-time" (JIT) plugin: it
is only physically installed the first time a sf code-analyzer command runs.
Until then, sf plugins inspect fails for it even though it is fully
available to the user. The check therefore treats JIT registration as success —
if inspect returns no version, it falls back to the CLI's own
oclif.jitPlugins registry (read from the root entry of sf plugins --json) and
reports 🟢 with the pinned version and a note that it auto-installs on first use.
Only a plugin that is neither installed nor JIT-registered is 🔴 critical.
If all green: Confirm setup is complete. The user is ready to develop.
If warnings or critical items exist: Present the user with options:
Some tools need attention. What would you like to do?
[1] Fix all items
[2] Choose which items to fix
[3] Skip for now
For each tool the user wants to fix, provide the correct install/update command for their OS. Do not run install commands automatically — show the command and ask the user to confirm before running it.
Salesforce CLI — not installed:
# macOS/Linux (npm)
npm install --global @salesforce/cli
# macOS (Homebrew)
brew install sf
Salesforce CLI — update:
sf update
Code Analyzer plugin — not installed:
sf plugins install @salesforce/plugin-code-analyzer
Code Analyzer plugin — update:
sf plugins update @salesforce/plugin-code-analyzer
Node.js — not installed or below minimum:
# macOS (nvm — recommended, installs LTS)
nvm install --lts && nvm use --lts
# macOS (Homebrew)
brew install node
# Windows — download from https://nodejs.org (LTS version)
NPM — update:
npm install --global npm@latest
Git — not installed:
# macOS (Xcode CLT)
xcode-select --install
# macOS (Homebrew)
brew install git
# Windows — download from https://git-scm.com
Source Tracking — not enabled:
sf org enable tracking --target-org <alias>
Salesforce MCP — misconfigured: If .mcp.json is missing or empty, reload the plugin:
/reload-plugins
/salesforce-development:login first./salesforce-development:login instead of this skill.check-tools reports the Salesforce CLI as 🟡 (installed but outdated) with the correct update command, rather than 🟢. Unlike the session-start notice below, this warning ignores the per-version no-nag gate — an explicit readiness scan always reports the factual state — but it still honors the hard opt-out SFDX_SKIP_CLI_UPDATE_CHECK=1.sf-context detect SessionStart hook surfaces it once and asks the agent to offer the update (sf update, or npm install --global @salesforce/cli@latest for npm-global installs). Declining or a failed update records a per-version no-nag gate (.sf/sf-cli-update-state.json) so the same version won't nag again, but a newer release will re-prompt. Set SFDX_SKIP_CLI_UPDATE_CHECK=1 to disable the check entirely.原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。