Skip to main content
skill CX Codex

platform-architecture-analyze — Claude Code skill: how to install

Audits a Salesforce DX project against the Salesforce Well-Architected framework. It checks code and metadata, scores pillars, and leaves repo files untouched.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add forcedotcom/sf-skills --skill platform-architecture-analyze -a claude-code
Open on GitHub

What platform-architecture-analyze does

The skill orchestrates an architecture review of a Salesforce DX codebase against the Salesforce Well-Architected framework. It evaluates observable code and metadata signals across pillars such as Trusted and Adaptable. The review inspects sharing declarations and SOQL selectivity, attaching exact file:line references to every finding.

Instead of running a separate static scanner from scratch, it delegates heavy checks to dx-code-analyzer-run and language server checks via platform-lsp-integrate. Direct grep and find commands catch lightweight structural anti-patterns, such as Apex classes missing sharing keywords and legacy workflow metadata. When an active org connection exists via sf org display, it inspects OWD settings and permission sets.

The skill runs strictly in read-only mode: it never edits code or deploys metadata, meaning developers must apply all recommended fixes manually. Running it requires the Salesforce CLI (sf version >=2.0.0). Governance criteria that cannot be verified directly in local files are shifted into a separate checklist for manual review.

What it helps with

  • Audit a Salesforce DX repository against Well-Architected pillars
  • Spot Apex classes missing with sharing or inherited sharing declarations
  • Identify SOQL queries inside loops and unindexed queries
  • Generate a governance checklist for manual team review
  • Detect legacy workflow metadata and @future annotations across packages

Example prompts for the agent

  • Review the architecture of this Salesforce project
  • Run a Well-Architected check on this repository
  • Audit this project for security and governor limit risks

How to install platform-architecture-analyze

1Skills CLI (Vercel)

npx skills add forcedotcom/sf-skills --skill platform-architecture-analyze -a claude-code

2Manually: put the files in place

~/.claude/skills/platform-architecture-analyze/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/platform-architecture-analyze/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about platform-architecture-analyze

How to install platform-architecture-analyze in Claude Code?

Run npx skills add forcedotcom/sf-skills --skill platform-architecture-analyze -a claude-code in your terminal.

What does platform-architecture-analyze do?

It evaluates a Salesforce DX codebase against the Salesforce Well-Architected framework. The skill scores observable code criteria, highlights risks with line numbers, and outputs a checklist for team governance.

Does platform-architecture-analyze modify files or deploy to an org?

No, the skill is strictly read-only. It inspects metadata and code to generate a report, but never edits files or deploys changes.

Source text

SKILL.md · Apache-2.0
---
name: platform-architecture-analyze
description: "Use when the developer asks to \"review the architecture\", \"run a Well-Architected check\", \"audit this project\", \"is this project well-architected?\", or wants to assess security/governor-limit/risk as a holistic code-and-metadata health report. Grades observable criteria (sharing/FLS, bulkification, SOQL selectivity, packageability) with file:line evidence; emits a governance checklist for what it can't see. Read-only, never edits. DO NOT TRIGGER for single-tool Apex scans (dx-code-analyzer-run)."
allowed-tools:
  - Bash
  - Read
  - Glob
  - Grep
metadata:
  cliTools:
    - tool: ["sf"]
      semver: ">=2.0.0"
  relatedSkills:
    - "dx-code-analyzer-run"
    - "platform-lsp-integrate"
    - "platform-metadata-retrieve"
    - "platform-apex-generate"
---

# Analyzing Architecture (Well-Architected Review)

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.

## Capability resolution

1. **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.
2. **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.
3. **API** — not applicable.

## The rubric (read these first)

Before scoring, read the three reference files — they are the source of truth:

- [`references/well-architected-rubric.md`](references/well-architected-rubric.md) — the full pillar → sub-pillar → criteria tree, each criterion tagged `[observable]` or `[manual]`.
- [`references/observable-checks.md`](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`](references/manual-review-checklist.md) — the `[manual]` criteria as a copy-pasteable governance checklist.

## Workflow

### Step 1 — Scope the project

```bash
# Package directories + API version
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`, `__tests__/`), CI (`.github/workflows/`), linting (`.eslintrc*`, `.prettierrc*`), a `package.xml` vs source/package strategy?
- **Org connection** — `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.

### Step 2 — Run the observable checks (delegate; don't re-scan)

Work through `references/observable-checks.md`. For the heavy lifting, delegate:

- **Apex security + performance** → `dx-code-analyzer-run`. It runs `sf code-analyzer` and classifies findings by severity. Map its rules onto the rubric:
  - `ApexSOQLInjection`, `ApexCRUDViolation`, `ApexInsecureEndpoint`, `ApexBadCrypto` → **Secure**
  - `ApexSharingViolations` → **Secure** (sharing) / **Composable** (separation)
  - `OperationWithLimitsInLoop`, `OperationWithHighCostInLoop` → **Reliable** / **Automated**
  - `AvoidDebugStatements` → **Automated**
- **Inline SOQL parse + selectivity, compile-level diagnostics** → `platform-lsp-integrate` (`apex_diagnostics`, `lwc_diagnostics`, `check_soql_selectivity`) when `lsp_health` is green → **Reliable** / **Automated**.
- **OWD / sharing model / permission sets** → `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.:

```bash
# 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.

### Step 3 — Score each observable sub-pillar

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).

### Step 4 — Emit the manual checklist

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.

### Step 5 — Report

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>`
```

## Examples

### Example 1 — "Is this project well-architected?"

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.

### Example 2 — "Review my project's security and governor-limit risk"

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.

### Example 3 — "Run a Well-Architected check before we package this for release"

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.

## Failure modes

| 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. |

## Rules

- Read the three `references/*.md` files before scoring — the rubric is the source of truth.
- Delegate observable detection to existing skills/MCP tools; grep only for the lightweight structural signals the rubric names.
- Every observable finding carries `file:line` (or tool-result) evidence. No evidence → manual checklist, not the scored table.
- Never score a `[manual]` governance criterion from inference — list it for human review.
- Read-only: recommend fixes and name the skill that applies them (`platform-apex-generate` for Apex authoring / trigger refactoring); never edit, deploy, or delete.
- 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.

© forcedotcom · Apache-2.0 · forcedotcom/sf-skills

Similar skills

All skills for Code review and refactoring →

From the same set181

platform-manifest-generate Writes a Salesforce package.xml or a destructive manifest from a source folder, a component list, or org introspection. Handy when the deploy is ready but the manifest is not. CX Codex +1 3,000installs platform-sandbox-configure Manages Salesforce sandboxes via Connect REST API. It handles inventory listing, license checks, creation, refreshes, activation, and deletion directly in the agent chat. CX Codex +1 3,000installs platform-deploy-validate Runs a server-side validation of Salesforce metadata before deploying. Errors show up, the org stays untouched, and production returns a job ID for a quick deploy. CX Codex +1 3,000installs dx-devops-work-item-manage Runs the DevOps Center work item lifecycle from the terminal: list, create, commit to the branch, move status, open a pull request. CX Codex +1 3,000installs sales-agentforce-pipeline-management-configure Configures and repairs Agentforce Pipeline Management and the Sales Management agent in a Salesforce org. Use it to set up Opportunity field suggestions and connected data sources. CX Codex +1 2,900installs platform-report-generate This skill writes and validates Salesforce Lightning report metadata: columns, groupings, filters, charts. Useful when a .report-meta.xml deploy keeps failing. CX Codex +1 2,900installs platform-capability-search This skill tells you where you are in the Connect → Project → Build → Test → Deploy → Observe journey and finds a plugin for a task no installed skill covers. CX Codex +1 2,800installs experience-lwr-site-generate Builds and edits Salesforce Experience Cloud LWR sites through DigitalExperience metadata: pages, routes, themes, guest access. CX Codex +1 2,700installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor