Salesforce プロジェクトを Salesforce Well-Architected フレームワーク(信頼性・使いやすさ・適応性)に照らして分析します。 **次のような場合に使用:** 開発者が「アーキテクチャをレビューしてほしい」「Well-Architected チェックを実行してほしい」「このプロジェクトを監査してほしい」「このプロジェクトは Well-Architected に沿っているか」「プロジェクト全体のセキュリティ・ガバナンスの制限・パッケージ化(配布用に整理されたコード群)のリスク評価をしてほしい」と依頼したり、コードとメタデータ(設定情報)全体の健全性を総合的にレポートしてほしい場合 **機能の詳細:** コードとメタデータから確認できる項目(データ共有設定・アクセス制御・一括処理の効率化・SOQL(データ取得方法)の最適化・トリガー処理の設計・古い技術の使用・パッケージ化への対応状況)をファイルと行番号を示しながら採点します。 一方、ガバナンス・プロセスの柱のうち確認できない項目(セキュリティ管理体制・事業継続計画・技術ロードマップ・AI 運用ルール)については、人間が確認用のチェックリストを生成します。 **特徴:** `dx-code-analyzer-run`(Apex コードの単一ツール分析)とは異なり、複数の分析スキルを組み合わせた多角的なアーキテクチャレビューです。Well-Architected フレームワークに基づいた判定を行います。読み取り専用のツールであり、採点と助言のみで、コードの修正はしません。
Analyze a Salesforce project against the Salesforce Well-Architected framework (Trusted / Easy / Adaptable). Use when the developer asks to "review the architecture", "run a Well-Architected check", "audit this project", "is this project well-architected?", "assess security/governor-limit/packageability risk across the project", or wants a holistic code-and-metadata health report. Grades the criteria that are observable from code and metadata (sharing/FLS, bulkification, selective SOQL, trigger-handler separation, legacy tech, packageability) with file:line evidence, and emits a human checklist for governance/process pillars it cannot see (security matrix, BCP, roadmaps, AI governance). Distinct from `dx-code-analyzer-run` (single-tool Code Analyzer scan of Apex) — this skill is a multi-pillar architectural review that orchestrates several analysis skills and maps findings to Well-Architected. Read-only: it grades and advises, never edits.
Salesforce DX プロジェクトを Salesforce Well-Architected フレームワーク(クラウドシステムの設計原則)に照らして評価し、根拠に基づいた正直なレポートを作成します。コードとメタデータから観察できた項目を柱ごとにスコアリングした表と、ローカルリポジトリでは判定できないガバナンス・プロセス上の課題を人手で確認するためのチェックリストを含みます。
このスキルは**オーケストレータ(複数のツールを統合・調整する中枢)**です。静的解析を自分で実装するのではなく、プラグインに搭載されている既存の分析スキルを呼び出し、その結果を Well-Architected の各柱に割り当てます。読み取り専用で、評価と改善提案はしますが、コード編集・デプロイ・削除は行いません。
また architecture-review エージェント(専用の読み取り専用レビュアー)を支えており、このワークフロー全体を実行します。エージェントを使用して包括的なレビューを実施するか、このスキルを直接使用して現在のセッション内でワークフローを実行します。
スコアリングの前に、3 つのリファレンスファイル(評価の根拠)をお読みください:
references/well-architected-rubric.md — 柱 → 小柱 → 評価項目の完全なツリー。各項目は [observable](観察可能)または [manual](人手判定)タグが付いています。references/observable-checks.md — 各 [observable] 評価項目が、どのスキル・MCP ツール・grep パターンで検出され、どの悪いパターンが検出されるかを示します。references/manual-review-checklist.md — [manual] 評価項目をガバナンスチェックリストとしてコピペできる形で提供。# パッケージディレクトリ + API バージョン
cat sfdx-project.json
次の項目を確認します:
packageDirectories[].path から)— ソースコードの格納場所find <pkgdir> -name '*.cls' | wc -l
find <pkgdir> -name '*.trigger' | wc -l
find <pkgdir> -name '*.js-meta.xml' | wc -l # LWC バンドル
*Test.cls, __tests__/)、CI(継続的インテグレーション・.github/workflows/)、リンター(eslintrc*, .prettierrc*)、package.xml 方式 vs ソース/パッケージ方式の戦略があるかsf org display --json が成功 → OWD(組織全体のデフォルト共有設定)、パーミッションセット(アクセス権限グループ)に関するチェックが利用可能。失敗 → これらは人手判定にマークしますレポートのヘッダーに対象範囲を記録します。
references/observable-checks.md を参照しながら進めます。重い処理は委譲します:
dx-code-analyzer-run:sf code-analyzer を実行し、検出内容を重大度で分類します。ルールを評価基準にマップ:
ApexSOQLInjection、ApexCRUDViolation、ApexInsecureEndpoint、ApexBadCrypto → Secure(安全性)ApexSharingViolations → Secure(共有)/ Composable(組み合わせやすさ)(分離)OperationWithLimitsInLoop、OperationWithHighCostInLoop → Reliable(信頼性) / Automated(自動化対応)AvoidDebugStatements → Automatedplatform-lsp-integrate(apex_diagnostics、lwc_diagnostics、check_soql_selectivity)を lsp_health が正常なときに使用 → Reliable / Automatedplatform-metadata-retrieve + sf org 検査。組織が接続されている場合のみ → Secure軽量な構造シグナルについては直接 grep を使用します(パターンは references/observable-checks.md に記載):
# Secure — 共有キーワードのないクラス
grep -rLE 'with(out)? sharing|inherited sharing' --include='*.cls' <pkgdir>
# Intentional(意図的な使用) — レガシー技術がまだ存在
find <pkgdir> -name '*.workflow-meta.xml' -o -name '*.flowDefinition-meta.xml'
grep -rl '@future' --include='*.cls' <pkgdir>
# Composable — デプロイ戦略
ls manifest/package.xml 2>/dev/null # package.xml 方式(PoC(概念実証)以降は非推奨)
grep -l '"path"' sfdx-project.json # ソース/パッケージ方式
# Composable — カスタム設定 vs メタデータ(実行時設定)
find <pkgdir> -path '*objects*' -name '*.object-meta.xml' | xargs grep -l 'CustomSetting' 2>/dev/null
すべての検出結果を ファイル:行番号 の根拠とともに記録します。チェック項目に根拠がない場合、それは合格でも不合格でもなく「観察不可」であり、人手チェックリストに移します。
references/observable-checks.md の閾値に従い、小柱ごとに ✅ / ⚠️ / ❌ を割り当てます:
その後、小柱の判定を柱の判定に集約します(最悪の判定を採用。注記付き)。
references/manual-review-checklist.md から [manual] 項目をレポートにコピーします。チェック対象外のボックスとして、柱ごとにグループ化。セクションを明確に表示:「自動評価外 — チームで確認してください」。推測で埋めないこと。このセクションの目的は、開発者に構造化されたガバナンスチェックリストを提供することで、スコアを偽造することではありません。
以下の形式を使用した 1 つのレポートを作成します。柱の判定を先頭に置き、その後、観察可能な検出結果(信頼性・セキュリティを優先し、スタイル警告の下に埋めない)、人手チェックリスト、推奨される次のステップ(各修正に適用するスキル名を記載)の順にします。
Well-Architected レビュー — <プロジェクト名>
対象範囲: <パッケージディレクトリ>, <N 個 Apex クラス / M 個トリガ / K 個 LWC>, テスト: <有/無>, CI: <有/無>, 組織: <接続エイリアス / なし>
柱の判定
🛡️ Trusted(信頼性) <✅|⚠️|❌> (Secure …, Compliant …, Reliable …)
⚡ Easy(使いやすさ) <✅|⚠️|❌> (Intentional …, Automated …, Engaging …)
🔁 Adaptable(適応性) <✅|⚠️|❌> (Resilient …, Composable …)
観察可能な検出結果(コード・メタデータから評価)
小柱 | 判定 | 検出内容 | 根拠(ファイル:行番号 / ツール)
人手レビュー(自動評価外 — チームで確認してください)
[ ] <項目> …
推奨される次のステップ
- <最優先の修正> → `<スキル>` を使用
プロジェクトの範囲を確定し、すべての観察可能なチェック項目を実行(Apex 分析は dx-code-analyzer-run に委譲)し、3 つの柱すべてをスコアリングし、完全な人手チェックリストを出力し、レポートを作成します。これがデフォルトの全体レビューです。
Secure と Reliable/Automated の小柱に範囲を絞ります:セキュリティ・パフォーマンス選択肢で dx-code-analyzer-run を実行し、platform-lsp-integrate の check_soql_selectivity で抽出度を確認し、共有キーワードのないクラスを grep で検索します。これらの小柱をスコアリング。Secure/Compliant の人手項目(セキュリティマトリックス、暗号化戦略)は出力します。別途要望がない限り Adaptable の深掘りはスキップ。
全体レビュー。Composable(パッケージ化対応度 — メタデータ vs カスタム設定、疎結合、LATEST エイリアス、package.xml 方式デプロイなし)と Resilient(ソース追跡対応、CI、デプロイ失敗なし)を重視。レポートの先頭にパッケージ化対応度の判定を掲載します。
| 症状 | 原因 | 対応 |
|---|---|---|
dx-code-analyzer-run でアナライザーが未インストール |
Code Analyzer v5 がない | レポートに記載。Apex・メタデータの構造チェックは grep で代替。PMD(静的コード解析ツール)のみの項目は「観察不可」とマーク |
sf org display 失敗 |
組織が接続されていない | OWD・パーミッションセット・組織メタデータの項目を人手判定にマーク。ファイルベースの項目のみ評価 |
LSP ツールが lsp_disabled / no_apex_workspace を返す |
LSP 無効またはワークスペースなし | LSP ベースのチェック項目をスキップ。dx-code-analyzer-run + grep で対応。ギャップを記載 |
sfdx-project.json がない |
SFDX プロジェクトでない | 停止。このスキルは SFDX プロジェクト向けです。開発者に伝えます |
| 大規模なリポジトリでスキャンが遅い | 全体 PMD・グラフ構築 | dx-code-analyzer-run をパッケージディレクトリに限定。ファイル横断的(sfge)の検出は部分的な可能性を記載 |
references/*.md ファイルをお読みください — 評価基準がマスタースペックですGrade a Salesforce DX project against the Salesforce Well-Architected framework and produce an honest, evidence-backed report: a pillar-scored table for what's observable in code and metadata, plus a human checklist for the governance/process concerns a local repo can't reveal.
This skill is an orchestrator. It does not re-implement static analysis — it drives the analysis skills the plugin already ships and maps their output onto the Well-Architected pillars. It is read-only: it grades and recommends; it never edits, deploys, or deletes.
It also backs the architecture-review agent, which runs this exact workflow as a dedicated read-only reviewer. Invoke the agent for an end-to-end review; use this skill directly when you want the workflow inline in the current session.
Before scoring, read the three reference files — they are the source of truth:
references/well-architected-rubric.md — the full pillar → sub-pillar → criteria tree, each criterion tagged [observable] or [manual].references/observable-checks.md — each [observable] criterion mapped to its detection (skill / MCP tool / grep pattern) and the anti-pattern it flags.references/manual-review-checklist.md — the [manual] criteria as a copy-pasteable governance checklist.# Package directories + API version
cat sfdx-project.json
Establish:
packageDirectories[].path) — where the source lives.find <pkgdir> -name '*.cls' | wc -l
find <pkgdir> -name '*.trigger' | wc -l
find <pkgdir> -name '*.js-meta.xml' | wc -l # LWC bundles
*Test.cls, __tests__/), CI (.github/workflows/), linting (.eslintrc*, .prettierrc*), a package.xml vs source/package strategy?sf org display --json succeeds → org-dependent checks (OWD, permission sets) are in play; otherwise mark them manual.Record the scope line for the report header.
Work through references/observable-checks.md. For the heavy lifting, delegate:
dx-code-analyzer-run. It runs sf code-analyzer and classifies findings by severity. Map its rules onto the rubric:
ApexSOQLInjection, ApexCRUDViolation, ApexInsecureEndpoint, ApexBadCrypto → SecureApexSharingViolations → Secure (sharing) / Composable (separation)OperationWithLimitsInLoop, OperationWithHighCostInLoop → Reliable / AutomatedAvoidDebugStatements → Automatedplatform-lsp-integrate (apex_diagnostics, lwc_diagnostics, check_soql_selectivity) when lsp_health is green → Reliable / Automated.platform-metadata-retrieve + sf org inspection, only if an org is connected → Secure.For the lightweight structural signals, grep directly (patterns in references/observable-checks.md), e.g.:
# Secure — classes missing a sharing keyword
grep -rLE 'with(out)? sharing|inherited sharing' --include='*.cls' <pkgdir>
# Intentional — legacy tech still present
find <pkgdir> -name '*.workflow-meta.xml' -o -name '*.flowDefinition-meta.xml'
grep -rl '@future' --include='*.cls' <pkgdir>
# Composable — deploy strategy
ls manifest/package.xml 2>/dev/null # package.xml-driven (anti-pattern past PoC)
grep -l '"path"' sfdx-project.json # source/package strategy
# Composable — runtime config in custom settings vs CMT
find <pkgdir> -path '*objects*' -name '*.object-meta.xml' | xargs grep -l 'CustomSetting' 2>/dev/null
Collect every finding with file:line evidence. A check with no evidence is not a pass and not a fail — it's "not observable" and moves to the manual checklist.
Assign ✅ / ⚠️ / ❌ per sub-pillar using the thresholds in references/observable-checks.md:
Then roll the sub-pillar verdicts up to a pillar verdict (worst-of, with a note).
Copy the [manual] criteria from references/manual-review-checklist.md into the report as unchecked items, grouped by pillar. Label the section clearly: "not auto-graded — assess with your team." Do not guess at these; the point is to hand the developer a structured governance checklist, not to fake a score.
Produce one report using the format below. Lead with pillar verdicts, then observable findings (Trusted/Secure first — never bury security under style), then the manual checklist, then recommended next steps that name the skill which would apply each fix.
Well-Architected Review — <project name>
Scope: <pkg dirs>, <N classes / M triggers / K LWC>, tests: <y/n>, CI: <y/n>, org: <connected alias / none>
PILLAR VERDICTS
🛡️ Trusted <✅|⚠️|❌> (Secure …, Compliant …, Reliable …)
⚡ Easy <✅|⚠️|❌> (Intentional …, Automated …, Engaging …)
🔁 Adaptable <✅|⚠️|❌> (Resilient …, Composable …)
OBSERVABLE FINDINGS (graded from code + metadata)
Sub-pillar | Verdict | Finding | Evidence (file:line / tool)
MANUAL REVIEW (not auto-graded — assess with your team)
[ ] <item> …
RECOMMENDED NEXT STEPS
- <highest-signal fix> → via `<skill>`
Scope the project, run all observable checks (delegating Apex analysis to dx-code-analyzer-run), score all three pillars, emit the full manual checklist, and report. This is the default full review.
Narrow to the Secure and Reliable/Automated sub-pillars: run dx-code-analyzer-run with a security + performance selector, use platform-lsp-integrate check_soql_selectivity for selectivity, grep for missing sharing keywords. Score those sub-pillars; still emit the Secure/Compliant manual items (security matrix, encryption strategy). Skip the Adaptable deep-dive unless asked.
Full review, weighting Composable (packageability — CMT vs custom settings, loose coupling, LATEST aliasing, no package.xml-driven deploys) and Resilient (source-tracked, CI, no failed deploys). Lead the report with the packageability readiness verdict.
| Symptom | Cause | Recovery |
|---|---|---|
dx-code-analyzer-run reports the analyzer isn't installed |
Code Analyzer v5 missing | Note it in the report; fall back to grep-based structural checks for Apex and mark PMD-only criteria "not observable". |
sf org display fails |
No org connected | Mark OWD / permission-set / org-metadata criteria as manual; grade only file-based criteria. |
LSP tools return lsp_disabled / no_apex_workspace |
LSP off or no workspace | Skip the LSP-grounded checks; rely on dx-code-analyzer-run + grep. Note the gap. |
No sfdx-project.json |
Not an SFDX project | Stop — this skill reviews SFDX projects. Tell the developer. |
| Huge repo, scan is slow | Project-wide PMD + graph build | Scope dx-code-analyzer-run to the package dir; note that cross-file (sfge) findings may be partial. |
references/*.md files before scoring — the rubric is the source of truth.file:line (or tool-result) evidence. No evidence → manual checklist, not the scored table.[manual] governance criterion from inference — list it for human review.platform-apex-generate for Apex authoring / trigger refactoring); never edit, deploy, or delete.原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。