platform-architecture-analyze
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAnalyzing Architecture (Well-Architected Review)
架构分析(Well-Architected审查)
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 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.
architecture-review依据Salesforce Well-Architected框架对Salesforce DX项目进行评分,并生成一份真实、有证据支撑的报告:包含代码和元数据中可观测项的支柱评分表,以及本地仓库无法揭示的治理/流程相关人工检查清单。
此功能是一个协调器。它不会重新实现静态分析——而是驱动插件已内置的分析能力,并将其输出映射到Well-Architected框架的各个支柱。它具备只读属性:仅进行评分和建议;绝不编辑、部署或删除任何内容。
它还为 Agent提供支持,该Agent会以专用只读审查者的身份运行此精确工作流。若需要端到端审查,可调用该Agent;若希望在当前会话中直接执行工作流,则可直接使用此功能。
architecture-reviewCapability resolution
能力适配方案
- Skill-orchestrated review (this skill) — runs the observable checks by delegating to existing skills/MCP tools, scores each sub-pillar, and emits the manual checklist.
- Direct CLI / grep — used only for the lightweight structural signals the rubric names (sharing keywords, legacy-tech file types, deploy strategy). Fine standalone, but skips the pillar scoring and the governance checklist this skill provides.
- API — not applicable.
- 功能协调式审查(本功能)——通过调用现有功能/MCP工具执行可观测检查,为每个子支柱评分,并生成人工检查清单。
- 直接CLI / grep命令——仅用于评分标准中提及的轻量级结构信号(共享关键字、遗留技术文件类型、部署策略)。单独使用时效果尚可,但缺少本功能提供的支柱评分和治理检查清单。
- API——不适用。
The rubric (read these first)
评分标准(请先阅读)
Before scoring, read the three reference files — they are the source of truth:
- — the full pillar → sub-pillar → criteria tree, each criterion tagged
references/well-architected-rubric.mdor[observable].[manual] - — each
references/observable-checks.mdcriterion mapped to its detection (skill / MCP tool / grep pattern) and the anti-pattern it flags.[observable] - — the
references/manual-review-checklist.mdcriteria as a copy-pasteable governance checklist.[manual]
评分前,请阅读三份参考文件——它们是权威依据:
- — 完整的支柱→子支柱→标准体系,每个标准标记为
references/well-architected-rubric.md(可观测)或[observable](人工)。[manual] - — 每个
references/observable-checks.md标准对应其检测方式(功能/MCP工具/grep模式)以及它标记的反模式。[observable] - — 以可复制粘贴的治理检查清单形式呈现
references/manual-review-checklist.md标准。[manual]
Workflow
工作流程
Step 1 — Scope the project
步骤1 — 确定项目范围
bash
undefinedbash
undefinedPackage directories + API version
包目录 + API版本
cat sfdx-project.json
Establish:
- **Package dirs** (from `packageDirectories[].path`) — where the source lives.
- **Inventory** — count Apex classes, triggers, LWC bundles, Aura, Flows, objects:
```bash
find <pkgdir> -name '*.cls' | wc -l
find <pkgdir> -name '*.trigger' | wc -l
find <pkgdir> -name '*.js-meta.xml' | wc -l # LWC bundles- Tooling signals — does the repo have tests (,
*Test.cls), CI (__tests__/), linting (.github/workflows/,.eslintrc*), a.prettierrc*vs source/package strategy?package.xml - Org connection — succeeds → org-dependent checks (OWD, permission sets) are in play; otherwise mark them manual.
sf org display --json
Record the scope line for the report header.
cat sfdx-project.json
确认以下信息:
- **包目录**(来自`packageDirectories[].path`)——源代码所在位置。
- **资源清单**——统计Apex类、触发器、LWC包、Aura、Flow、对象的数量:
```bash
find <pkgdir> -name '*.cls' | wc -l
find <pkgdir> -name '*.trigger' | wc -l
find <pkgdir> -name '*.js-meta.xml' | wc -l # LWC包- 工具信号——仓库是否包含测试文件(、
*Test.cls)、CI配置(__tests__/)、代码检查(.github/workflows/、.eslintrc*),以及采用.prettierrc*还是源码/包策略?package.xml - 组织连接——执行成功 → 可进行依赖于组织的检查(OWD、权限集);否则将这些检查标记为人工项。
sf org display --json
记录范围信息,用于报告标题。
Step 2 — Run the observable checks (delegate; don't re-scan)
步骤2 — 执行可观测检查(调用其他功能,不重复扫描)
Work through . For the heavy lifting, delegate:
references/observable-checks.md- Apex security + performance → . It runs
dx-code-analyzer-runand classifies findings by severity. Map its rules onto the rubric:sf code-analyzer- ,
ApexSOQLInjection,ApexCRUDViolation,ApexInsecureEndpoint→ SecureApexBadCrypto - → Secure (sharing) / Composable (separation)
ApexSharingViolations - ,
OperationWithLimitsInLoop→ Reliable / AutomatedOperationWithHighCostInLoop - → Automated
AvoidDebugStatements
- Inline SOQL parse + selectivity, compile-level diagnostics → (
platform-lsp-integrate,apex_diagnostics,lwc_diagnostics) whencheck_soql_selectivityis green → Reliable / Automated.lsp_health - OWD / sharing model / permission sets → +
platform-metadata-retrieveinspection, only if an org is connected → Secure.sf org
For the lightweight structural signals, grep directly (patterns in ), e.g.:
references/observable-checks.mdbash
undefined按照执行检查。对于繁重的任务,调用其他功能:
references/observable-checks.md- Apex安全 + 性能 → 。它会运行
dx-code-analyzer-run并按严重程度分类结果。将其规则映射到评分标准:sf code-analyzer- 、
ApexSOQLInjection、ApexCRUDViolation、ApexInsecureEndpoint→ 可信(Secure)ApexBadCrypto - → 可信(Secure,共享)/ 可组合(Composable,分离)
ApexSharingViolations - 、
OperationWithLimitsInLoop→ 可靠(Reliable)/ 自动化(Automated)OperationWithHighCostInLoop - → 自动化(Automated)
AvoidDebugStatements
- 内联SOQL解析 + 选择性、编译级诊断 → 当为绿色时,使用
lsp_health(platform-lsp-integrate、apex_diagnostics、lwc_diagnostics)→ 可靠(Reliable)/ 自动化(Automated)。check_soql_selectivity - OWD / 共享模型 / 权限集 → 仅当已连接组织时,使用+
platform-metadata-retrieve检查 → 可信(Secure)。sf org
对于轻量级结构信号,直接使用grep命令(模式见),例如:
references/observable-checks.mdbash
undefinedSecure — classes missing a sharing keyword
可信 — 缺少共享关键字的类
grep -rLE 'with(out)? sharing|inherited sharing' --include='*.cls' <pkgdir>
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>
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
ls manifest/package.xml 2>/dev/null # 基于package.xml的策略(PoC之后属于反模式)
grep -l '"path"' sfdx-project.json # 源码/包策略
Composable — runtime config in custom settings vs CMT
可组合 — 自定义设置与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.find <pkgdir> -path 'objects' -name '*.object-meta.xml' | xargs grep -l 'CustomSetting' 2>/dev/null
收集每个带有`file:line`证据的检查结果。无证据的检查项**既不通过也不失败**——标记为「不可观测」并移至人工检查清单。Step 3 — Score each observable sub-pillar
步骤3 — 为每个可观测子支柱评分
Assign ✅ / ⚠️ / ❌ per sub-pillar using the thresholds in :
references/observable-checks.md- ✅ no anti-patterns found in the observable checks for that sub-pillar.
- ⚠️ low/moderate findings, or only some criteria observable.
- ❌ critical/high findings (e.g. SOQL injection, FLS bypass, SOQL-in-loop at scale).
Then roll the sub-pillar verdicts up to a pillar verdict (worst-of, with a note).
依据中的阈值,为每个子支柱分配✅ / ⚠️ / ❌:
references/observable-checks.md- ✅ 该子支柱的可观测检查中未发现反模式。
- ⚠️ 存在低/中度问题,或仅部分标准可观测。
- ❌ 存在严重/高危问题(如SOQL注入、FLS绕过、循环中的SOQL大规模使用)。
然后将子支柱的结论汇总为支柱结论(取最差结果,并附带说明)。
Step 4 — Emit the manual checklist
步骤4 — 生成人工检查清单
Copy the criteria from 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.
[manual]references/manual-review-checklist.md将中的标准复制到报告中,作为未勾选的项,按支柱分组。明确标记该部分:「未自动评分 — 请与团队一起评估。」 请勿猜测这些项的结果;此部分的目的是为开发者提供结构化的治理检查清单,而非伪造评分。
references/manual-review-checklist.md[manual]Step 5 — Report
步骤5 — 生成报告
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.
text
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>`使用以下格式生成一份报告。首先展示支柱结论,然后是可观测结果(优先展示可信/安全项——绝不要将安全问题隐藏在风格细节之下),接着是人工检查清单,最后是推荐的后续步骤,并指明可应用修复的功能名称。
text
Well-Architected审查 — <项目名称>
范围:<包目录>,<N个类 / M个触发器 / K个LWC>,测试:<是/否>,CI:<是/否>,组织:<已连接别名 / 无>
支柱结论
🛡️ 可信 <✅|⚠️|❌> (安全…,合规…,可靠…)
⚡ 易用 <✅|⚠️|❌> (明确…,自动化…,有吸引力…)
🔁 可适配 <✅|⚠️|❌> (弹性…,可组合…)
可观测结果 (基于代码 + 元数据评分)
子支柱 | 结论 | 发现问题 | 证据(文件:行号 / 工具)
人工审查 (未自动评分 — 请与团队一起评估)
[ ] <项> …
推荐后续步骤
- <最高优先级修复> → 通过`<功能>`实现Examples
示例
Example 1 — "Is this project well-architected?"
示例1 — 「该项目架构是否合规?」
Scope the project, run all observable checks (delegating Apex analysis to ), score all three pillars, emit the full manual checklist, and report. This is the default full review.
dx-code-analyzer-run确定项目范围,执行所有可观测检查(将Apex分析委托给),为三个支柱评分,生成完整的人工检查清单并报告。这是默认的全面审查。
dx-code-analyzer-runExample 2 — "Review my project's security and governor-limit risk"
示例2 — 「审查我项目的安全和Governor限制风险」
Narrow to the Secure and Reliable/Automated sub-pillars: run with a security + performance selector, use 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.
dx-code-analyzer-runplatform-lsp-integratecheck_soql_selectivity缩小范围至安全和可靠/自动化子支柱:运行带有安全+性能选择器的,使用的检查选择性,使用grep查找缺失的共享关键字。为这些子支柱评分;仍需生成安全/合规的人工项(安全矩阵、加密策略)。除非特别要求,否则跳过可适配的深入分析。
dx-code-analyzer-runplatform-lsp-integratecheck_soql_selectivityExample 3 — "Run a Well-Architected check before we package this for release"
示例3 — 「在打包发布前执行Well-Architected检查」
Full review, weighting Composable (packageability — CMT vs custom settings, loose coupling, aliasing, no -driven deploys) and Resilient (source-tracked, CI, no failed deploys). Lead the report with the packageability readiness verdict.
LATESTpackage.xml全面审查,重点关注可组合(可打包性——CMT vs 自定义设置、松耦合、别名、无基于的部署)和弹性(源码跟踪、CI、无部署失败)。报告开头展示可打包性就绪结论。
LATESTpackage.xmlFailure modes
故障模式
| Symptom | Cause | Recovery |
|---|---|---|
| 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". |
| No org connected | Mark OWD / permission-set / org-metadata criteria as manual; grade only file-based criteria. |
LSP tools return | LSP off or no workspace | Skip the LSP-grounded checks; rely on |
No | Not an SFDX project | Stop — this skill reviews SFDX projects. Tell the developer. |
| Huge repo, scan is slow | Project-wide PMD + graph build | Scope |
| 症状 | 原因 | 恢复方案 |
|---|---|---|
| 缺少Code Analyzer v5 | 在报告中注明;回退到基于grep的Apex结构检查,并将仅PMD的标准标记为「不可观测」。 |
| 未连接组织 | 将OWD / 权限集 / 组织元数据相关标准标记为人工项;仅对基于文件的标准评分。 |
LSP工具返回 | LSP关闭或无工作区 | 跳过基于LSP的检查;依赖 |
无 | 不是SFDX项目 | 终止——此功能仅审查SFDX项目。告知开发者。 |
| 仓库规模大,扫描缓慢 | 全项目PMD + 图构建 | 将 |
Rules
规则
- Read the three files before scoring — the rubric is the source of truth.
references/*.md - Delegate observable detection to existing skills/MCP tools; grep only for the lightweight structural signals the rubric names.
- Every observable finding carries (or tool-result) evidence. No evidence → manual checklist, not the scored table.
file:line - Never score a governance criterion from inference — list it for human review.
[manual] - Read-only: recommend fixes and name the skill that applies them (for Apex authoring / trigger refactoring); never edit, deploy, or delete.
platform-apex-generate - Lead with Trusted/Secure findings; don't bury security under style nits.
- Surface zero-finding sub-pillars briefly ("no issues found in observable checks") rather than omitting them.
- 评分前请阅读三份文件——评分标准是权威依据。
references/*.md - 将可观测检测委托给现有功能/MCP工具;仅对评分标准中提及的轻量级结构信号使用grep。
- 每个可观测结果都需附带(或工具结果)证据。无证据→移至人工检查清单,而非评分表。
file:line - 绝不要通过推断为治理标准评分——将其列出供人工审查。
[manual] - 只读属性:推荐修复方案并指明可应用修复的功能(如使用进行Apex编写/触发器重构);绝不编辑、部署或删除任何内容。
platform-apex-generate - 优先展示可信/安全结果;不要将安全问题隐藏在风格细节之下。
- 简要提及无问题的子支柱(「可观测检查中未发现问题」),而非省略。