forcedotcom/sf-skills / skills/dx-apexguru-scan
dx-apexguru-scan
VerifiedRun an ApexGuru performance scan on a Salesforce Apex project via the ApexGuru SFAP Scan API. Zips the project's Apex (any layout), submits it, polls to completion, decodes the base64 report, and presents performance antipattern violations (SOQL in loop, DML in loop, Schema.getGlobalDescribe(), SOQL without WHERE/LIMIT, unused SOQL fields) grouped by rule with severity, file:line, and suggested fixes — clearly attributed as 'Static only' or 'Production insights'. TRIGGER when the user says 'run ApexGuru', 'ApexGuru scan', 'check Apex performance', 'find governor-limit / performance antipatterns', 'SOQL in loop', 'scan my Apex for performance', or 'ApexGuru performance insights'. DO NOT TRIGGER for general static analysis or security scans (use dx-code-analyzer-run), for fixing code without scanning, or for onboarding an org to ApexGuru.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 20.4 KB |
| examples/README.md | markdown | 2.8 KB |
| examples/sample-decoded-summary.json | config | 4.3 KB |
| examples/sample-full-no-runtime-response.json | config | 27.6 KB |
| examples/sample-succeeded-response.json | config | 1.7 KB |
| references/api-reference.md | markdown | 2.5 KB |
| references/authentication.md | markdown | 7.1 KB |
| references/error-handling.md | markdown | 3.7 KB |
| references/violation-catalog.md | markdown | 2.1 KB |
| scripts/build-zip.shexecutable | script | 3.8 KB |
| scripts/decode-report.jsexecutable | script | 19.4 KB |
| scripts/resolve-token.shexecutable | script | 9.8 KB |
| scripts/run-scan.shexecutable | script | 6.5 KB |
| scripts/scan.shexecutable | script | 3.7 KB |
| scripts/validate-token.js | script | 5.5 KB |
examples/README.md
View on GitHub# Examples — dx-apexguru-scan
Sample data and eval prompts for the ApexGuru performance-scan skill.
## Files
| File | Purpose |
|------|---------|
| [`sample-succeeded-response.json`](sample-succeeded-response.json) | A realistic API `SUCCEEDED` body (`analysisMode: static`) with a base64-encoded `report`. Feed it to `decode-report.js` to validate parsing offline. |
| [`sample-decoded-summary.json`](sample-decoded-summary.json) | The bare (non-`--present`) JSON output of `decode-report.js` on the sample response — the shape drill-down queries (Step 5) work against. |
| [`sample-full-no-runtime-response.json`](sample-full-no-runtime-response.json) | A real production `SUCCEEDED` body from scanning the eval seed class (`analysisMode: full`, no runtime metrics → renders as **Static only**). Use it to exercise `decode-report.js --present` offline, without a live org. Contains no token/secret. |
## Try it offline (no token / no API needed)
```bash
node ../scripts/decode-report.js sample-succeeded-response.json --present # rendered markdown (default presentation)
node ../scripts/decode-report.js sample-succeeded-response.json # bare JSON
node ../scripts/decode-report.js sample-succeeded-response.json --group file --top 5
node ../scripts/decode-report.js sample-succeeded-response.json --rule DML_IN_LOOP --full
```
## How the eval scores this skill
The eval judges the `dx-apexguru-scan` agent's output against each dataset's `prompt.md`
and `instruction.md` rubric — grouped-by-rule findings with severity, `file:line`, and a
suggested fix — rather than diffing against a fixed reference file. This suits the scan,
whose output varies per run and per org.
The sample JSON fixtures here are for exercising `decode-report.js` offline (see
"Try it offline" above); they are not eval references.
## Eval prompts
Per the authoring quality bar, the skill should pass at least these three evals.
### 1. Happy path (should trigger)
> "Run ApexGuru on my Apex project and show me the performance issues."
Expected: zips the project's Apex, submits, polls to `SUCCEEDED`, decodes the report, and
presents violations grouped by rule with severity, `file:line`, and fixes — labeled
**Static only** or **Production insights** per `analysisMode`.
### 2. Edge case (should trigger, handle gracefully)
> "ApexGuru scan — but I expected production insights and only got static results."
Expected: recognizes `analysisMode: static`, explains the org isn't onboarded to
ApexGuru, does **not** treat it as an error or retry. (Also covers the token-missing
and 401/403/404/400 paths → surface the hint from `run-scan.sh`.)
### 3. Should NOT trigger
> "Run a security scan on my Apex classes and check for CRUD/FLS violations."
Expected: defers to `dx-code-analyzer-run` (security/lint/PMD) — this skill is
performance-antipattern-only and should not activate.
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 |