forcedotcom/sf-skills / skills/dx-org-analyze
dx-org-analyze
VerifiedCompare two Salesforce orgs side-by-side and produce a comparison report with drift score, or analyze a single org to produce an inventory covering metadata components, org permissions, system permissions, profiles, installed packages, licenses, and org limits. Use this skill when the user wants to compare orgs, diff orgs, audit configuration drift, find what changed between two environments, compare sandbox against production, or analyze a single org. Trigger phrases include: 'compare orgs', 'compare these 2 orgs', 'compare my orgs', 'diff orgs', 'org diff', 'what is different between these orgs', 'compare metadata', 'org comparison', 'audit org differences', 'compare sandbox to production', 'introspect org', 'org inventory', 'what is in my org', 'analyze org', 'org analysis', 'analyze my org', 'analyze my Salesforce org'. Do NOT use for retrieving metadata (use platform-metadata-retrieve), deploying metadata (use platform-metadata-deploy), or switching orgs (use dx-org-switch).
| File | Kind | Size |
|---|---|---|
| README.md | markdown | 13.3 KB |
| SKILL.md | skill md | 10.7 KB |
| references/collection-details.md | markdown | 3.3 KB |
| references/report-format.md | markdown | 3.0 KB |
| scripts/collect_org_data.pyexecutable | script | 36.5 KB |
| scripts/compute_diff.pyexecutable | script | 46.5 KB |
| scripts/introspect_org.pyexecutable | script | 15.5 KB |
| tests/README.md | markdown | 1.8 KB |
| tests/fixtures/org_a.json | config | 2.6 KB |
| tests/fixtures/org_b.json | config | 2.3 KB |
| tests/test_compute_diff.shexecutable | script | 10.2 KB |
| tests/test_consistency.shexecutable | script | 13.4 KB |
references/report-format.md
View on GitHub# Report Format
The `scripts/compute_diff.py` script computes the diff between two collected org data sets.
## Usage
```bash
python3 ./scripts/compute_diff.py \
--org-a /tmp/source \
--org-b /tmp/target \
--output /tmp/org-diff \
--format both \
--org-a-label "Source" \
--org-b-label "Target"
```
| Flag | Purpose |
|------|---------|
| `--org-a` | Path to org A data directory or JSON file (required) |
| `--org-b` | Path to org B data directory or JSON file (required) |
| `--output` | Output path prefix (required) |
| `--format` | `markdown`, `json`, or `both` (default: `both`) |
| `--org-a-label` | Display name for org A (default: "Source") |
| `--org-b-label` | Display name for org B (default: "Target") |
| `--show-shared` | Include shared components in the detailed breakdown |
## Drift Score Formula
```text
Overall = 60% × Metadata Drift + 30% × Permission Drift + 10% × Profile Drift
```
| Range | Level | Meaning |
|-------|-------|---------|
| 0–10% | LOW | Nearly identical orgs |
| 11–30% | MODERATE | Some features differ |
| 31–60% | HIGH | Significant divergence |
| 61–100% | CRITICAL | Fundamentally different orgs |
## Report Sections
1. **Header** — Org IDs, names, editions, discovery method
2. **Drift Score** — Overall weighted score with per-dimension breakdown
3. **Summary Statistics** — Table with per-type counts (A count, B count, Shared, A Only, B Only, Identical, Different)
4. **Key Metrics** — Total unique components, percentages, permission/package summary
5. **Metadata Components by Type** — Detailed per-type listing of only-in-A, only-in-B names
6. **Profiles** — Shared, A-only, B-only profile names
7. **Installed Packages** — A-only, B-only, version mismatches, identical packages
8. **Package Components** — Namespaced components grouped by namespace with per-type breakdown
9. **Org Permissions** — Enabled/disabled diffs categorized (Commerce, Platform/API, Security, Einstein/AI, Service, Data, Sales, etc.), plus non-boolean value diffs
10. **System Permissions** — PermissionsXxx per PermissionSet diffs, aggregate unique permissions
11. **Org Values & Limits** — Categorized (Identity, Storage, Feature Limits, API) value differences
12. **Deep Diff** — Apex body/API version/LOC diffs, custom field type changes, validation rule active state, flow process type, object/field permissions, named credentials
13. **Licenses** — User, Permission Set, Package license quantity diffs
14. **Notes** — Read-only disclaimer, collection warnings
## Deep Data Enrichment
The diff script enriches the summary statistics table with content-level information from deep data. The Identical/Different columns reflect actual body hash, API version, and active state comparisons — not just name-level overlap.
Enrichment mapping:
- `ApexClass` → body hash + API version + LOC
- `ApexTrigger` → body hash
- `Flow` → process type + API version
- `ValidationRule` → active state
- `CustomObject` → custom field set differences
- `NamedCredential` → endpoint URL
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |