Run and interpret the ApexGuru engine in Salesforce Code Analyzer v5 for Apex performance and scalability findings: verify the authenticated target org, scope .cls/.trigger files, capture JSON evidence, triage line-level recommendations, validate fixes, and avoid claiming runtime telemetry the report does not contain. Trigger keywords: ApexGuru scan, apexguru Code Analyzer, Apex performance findings, SOQL scalability issue, AI Apex optimization. NOT for general PMD/security lint — use devops/salesforce-code-analyzer. NOT for Apex debug-log or production transaction profiling.
Use ApexGuru as one evidence source for Apex performance work. In Salesforce Code Analyzer v5 it is an AI-driven remote analysis engine that requires an authenticated Salesforce org, scans Apex .cls and .trigger files, and returns line-level JSON findings. A connected org is required for the service; that fact alone does not prove the report contains production runtime telemetry.
Preconditions
Confirm all of the following before scanning:
Check
Required evidence
Stop condition
Code Analyzer generation
sf code-analyzer --help or installed plugin version confirms v5 commands
Legacy sfdx scanner:* only
Target identity
Exact org alias/username resolved by Salesforce CLI
Alias absent, ambiguous, or unauthenticated
ApexGuru availability
Org supports and has ApexGuru activated
Engine unavailable or activation unknown for a required scan
Workspace
Explicit project/workspace root
Accidental scan of a home or monorepo root
Targets
Bounded .cls and .trigger files inside the workspace
Request expects Flow, metadata XML, objects, or other unsupported files
Baseline
Current commit/hash, tests, and scan output path
Findings cannot be tied to source revision
Authority
Read/analysis operation only; no production mutation implied
Request asks the scan to approve or deploy a fix
Authentication is reused from the Salesforce CLI session. Do not put usernames, passwords, access tokens, or refresh tokens in code-analyzer.yml.
Reproducible CLI Scan
Use Code Analyzer v5 and write machine-readable output:
The shown timeout/backoff values are documented defaults. Change them only for an observed need and keep api_max_retry_ms >= api_initial_retry_ms. The overall api_timeout_ms remains the hard budget.
Prefer an explicit --target-org in CI when multiple authenticated orgs exist; it is easier to audit than relying on a developer's default org. Never commit secret material.
Evidence Mode and Attribution
Classify the output before interpreting it:
Mode
What may be claimed
Code Analyzer ApexGuru JSON
ApexGuru analyzed the identified source revision through the authenticated org service and returned these findings
Report explicitly carries analysisMode: static
Preserve the label Static only; do not infer production behavior
Report explicitly carries analysisMode: full or a documented equivalent
Preserve the report's exact label and evidence; identify which metrics are actually present
No mode field or runtime metrics
Label Source analysis; do not call it production telemetry, hotspot frequency, or measured runtime impact
Debug logs, Event Monitoring, APM, or transaction traces
Treat as separate runtime evidence and link it to the source finding without attributing it to ApexGuru unless the report says so
A finding's severity is the engine's prioritization, not a measured CPU/heap/query cost. Validate impact in the relevant transaction and data-volume context.
JSON Result Contract
Code Analyzer v5 JSON contains a root object with runDir, violationCounts, versions, and violations. Each violation should preserve:
rule and engine;
numeric severity 1–5;
message and tags;
all locations plus primaryLocationIndex;
resource links and available suggestions/fixes;
source revision, workspace, target org identity, command, and scan timestamp stored beside the report.
Do not flatten multi-location findings to one line when the analysis path matters. CSV includes only the primary location; JSON or SARIF is preferable for review and automation.
Normalize and group findings with the bundled checker while preserving original JSON. Group by rule, affected transaction/entry point, shared query/DML pattern, and severity—not severity alone.
Inspect code context around every primary and related location, and confirm that the finding applies to a reachable path.
Cross-check runtime relevance using tests, data volume, query plans, debug logs, transaction traces, or production insights when authorized and available.
Choose a disposition and design the smallest safe change: fix, validate, suppress-with-rationale, defer, or not-applicable. Preserve sharing, CRUD/FLS, transaction semantics, bulk behavior, ordering, and error handling.
Test and rescan positive, negative, bulk, and failure paths, then rerun the same targets with the same engine/config and compare result hashes/findings.
Record residual risk and supporting evidence. A zero-finding scan is not proof of runtime performance or absence of all Apex defects.
Disposition Criteria
Disposition
Use when
Required record
fix
Finding is applicable and a safe change is understood
Change, tests, before/after scan, runtime or scale rationale
validate
Applicability or impact depends on data shape or call path
Exact experiment/query plan/log evidence needed
suppress-with-rationale
Finding is accepted, false positive, generated code, or unavoidable under a documented constraint
The checker validates the Code Analyzer JSON shape, severity/location data, Apex file scope, and evidence-mode labeling. It does not contact Salesforce or judge whether a recommendation is correct.
Related Skills
devops/salesforce-code-analyzer — install/configure v5, combine engines, output formats, CI gates, and suppression policy.
apex/apex-performance-profiling — measure actual transaction behavior and governor consumption.
apex/soql-optimization — validate query selectivity and redesign query patterns.
apex/bulkification-patterns — remediate loop/query/DML patterns while preserving semantics.
apex/apexguru-performance-analysis does not deploy, approve, or certify code.
See the bundled references for triage examples, attribution failures, and the official source map.
1---2name: apexguru-performance-analysis3description: "Run and interpret the ApexGuru engine in Salesforce Code Analyzer v5 for Apex performance and scalability findings: verify the authenticated target org, scope .cls/.trigger files, capture JSON evidence, triage line-level recommendations, validate fixes, and avoid claiming runtime telemetry the report does not contain. Trigger keywords: ApexGuru scan, apexguru Code Analyzer, Apex performance findings, SOQL scalability issue, AI Apex optimization. NOT for general PMD/security lint — use devops/salesforce-code-analyzer. NOT for Apex debug-log or production transaction profiling."4category: apex5salesforce-version: "Summer '26+"6well-architected-pillars:7 - Performance8 - Scalability9 - Reliability10 - Operational Excellence11triggers:12 - "run ApexGuru against these Apex classes and explain the findings"13 - "configure the ApexGuru engine in Salesforce Code Analyzer v5"14 - "triage ApexGuru performance recommendations by severity and file"15 - "validate whether an ApexGuru finding is safe to fix"16 - "compare ApexGuru source findings before and after an Apex refactor"17tags:18 - apexguru19 - code-analyzer20 - apex-performance21 - scalability22 - source-analysis23 - target-org24inputs:25 - "Salesforce DX workspace and bounded .cls/.trigger targets"26 - "Authenticated Salesforce org alias where ApexGuru is supported and activated"27 - "Salesforce Code Analyzer v5 installation and optional code-analyzer.yml"28 - "JSON scan output and relevant tests/performance evidence for triage"29outputs:30 - "Reproducible ApexGuru command/configuration and target identity"31 - "Normalized finding inventory with severity, rule, file, location, message, resources, and evidence mode"32 - "Triage disposition: fix, validate, suppress with rationale, defer, or not-applicable"33 - "Before/after scan plus tests and performance evidence for accepted fixes"34dependencies:35 - devops/salesforce-code-analyzer36 - apex/apex-performance-profiling37 - apex/soql-optimization38runtime_orphan: true39runtime_orphan_reason: "No dedicated runtime agent owns ApexGuru finding triage as its primary deliverable; Code Analyzer packages hand off to this skill without an agent-owned ApexGuru workflow."40version: 1.0.041author: Pranav Nagrecha42updated: 2026-09-0143metadata:44 source: https://skillmd.com/skills/pranavnagrecha/apexguru-performance-analysis45---4647# ApexGuru Performance Analysis4849Use ApexGuru as one evidence source for Apex performance work. In Salesforce Code Analyzer v5 it is an AI-driven remote analysis engine that requires an authenticated Salesforce org, scans Apex `.cls` and `.trigger` files, and returns line-level JSON findings. A connected org is required for the service; that fact alone does **not** prove the report contains production runtime telemetry.5051---5253## Preconditions5455Confirm all of the following before scanning:5657| Check | Required evidence | Stop condition |58|---|---|---|59| Code Analyzer generation | `sf code-analyzer --help` or installed plugin version confirms v5 commands | Legacy `sfdx scanner:*` only |60| Target identity | Exact org alias/username resolved by Salesforce CLI | Alias absent, ambiguous, or unauthenticated |61| ApexGuru availability | Org supports and has ApexGuru activated | Engine unavailable or activation unknown for a required scan |62| Workspace | Explicit project/workspace root | Accidental scan of a home or monorepo root |63| Targets | Bounded `.cls` and `.trigger` files inside the workspace | Request expects Flow, metadata XML, objects, or other unsupported files |64| Baseline | Current commit/hash, tests, and scan output path | Findings cannot be tied to source revision |65| Authority | Read/analysis operation only; no production mutation implied | Request asks the scan to approve or deploy a fix |6667Authentication is reused from the Salesforce CLI session. Do not put usernames, passwords, access tokens, or refresh tokens in `code-analyzer.yml`.6869---7071## Reproducible CLI Scan7273Use Code Analyzer v5 and write machine-readable output:7475```bash76sf code-analyzer run \77 --rule-selector apexguru \78 --workspace . \79 --target "force-app/main/default/classes/**/*.cls" \80 --target "force-app/main/default/triggers/**/*.trigger" \81 --target-org my-apexguru-org \82 --view detail \83 --output-file artifacts/apexguru-results.json84```8586Important behavior:8788- `--target-org` identifies the authenticated org used by remote engines such as ApexGuru.89- Every target must live under the declared workspace.90- File extension on `--output-file` selects the output schema; use JSON or SARIF when downstream automation needs complete locations.91- ApexGuru scans `.cls` and `.trigger` only. A successful command is not evidence that Flow, object metadata, Visualforce, or LWC was analyzed.92- Use a severity threshold only when the team has defined which ApexGuru severities are merge-blocking and has tested false-positive handling.9394For the installed CLI, verify flags with:9596```bash97sf code-analyzer run --help98```99100---101102## Project Configuration103104A project can set ApexGuru engine defaults in `code-analyzer.yml`:105106```yaml107engines:108 apexguru:109 disable_engine: false110 target_org: my-apexguru-org111 api_timeout_ms: 300000112 api_initial_retry_ms: 2000113 api_max_retry_ms: 60000114 api_backoff_multiplier: 2115```116117The shown timeout/backoff values are documented defaults. Change them only for an observed need and keep `api_max_retry_ms >= api_initial_retry_ms`. The overall `api_timeout_ms` remains the hard budget.118119Prefer an explicit `--target-org` in CI when multiple authenticated orgs exist; it is easier to audit than relying on a developer's default org. Never commit secret material.120121---122123## Evidence Mode and Attribution124125Classify the output before interpreting it:126127| Mode | What may be claimed |128|---|---|129| Code Analyzer ApexGuru JSON | ApexGuru analyzed the identified source revision through the authenticated org service and returned these findings |130| Report explicitly carries `analysisMode: static` | Preserve the label `Static only`; do not infer production behavior |131| Report explicitly carries `analysisMode: full` or a documented equivalent | Preserve the report's exact label and evidence; identify which metrics are actually present |132| No mode field or runtime metrics | Label `Source analysis`; do not call it production telemetry, hotspot frequency, or measured runtime impact |133| Debug logs, Event Monitoring, APM, or transaction traces | Treat as separate runtime evidence and link it to the source finding without attributing it to ApexGuru unless the report says so |134135A finding's severity is the engine's prioritization, not a measured CPU/heap/query cost. Validate impact in the relevant transaction and data-volume context.136137---138139## JSON Result Contract140141Code Analyzer v5 JSON contains a root object with `runDir`, `violationCounts`, `versions`, and `violations`. Each violation should preserve:142143- `rule` and `engine`;144- numeric severity 1–5;145- message and tags;146- all locations plus `primaryLocationIndex`;147- resource links and available suggestions/fixes;148- source revision, workspace, target org identity, command, and scan timestamp stored beside the report.149150Do not flatten multi-location findings to one line when the analysis path matters. CSV includes only the primary location; JSON or SARIF is preferable for review and automation.151152---153154## Recommended Workflow1551561. **Validate provenance and scope** — source revision, workspace, authenticated target org, command, Code Analyzer/engine versions, `.cls`/`.trigger` targets, timestamp, and output hash.1572. **Normalize and group findings** with the bundled checker while preserving original JSON. Group by rule, affected transaction/entry point, shared query/DML pattern, and severity—not severity alone.1583. **Inspect code context** around every primary and related location, and confirm that the finding applies to a reachable path.1594. **Cross-check runtime relevance** using tests, data volume, query plans, debug logs, transaction traces, or production insights when authorized and available.1605. **Choose a disposition and design** the smallest safe change: `fix`, `validate`, `suppress-with-rationale`, `defer`, or `not-applicable`. Preserve sharing, CRUD/FLS, transaction semantics, bulk behavior, ordering, and error handling.1616. **Test and rescan** positive, negative, bulk, and failure paths, then rerun the same targets with the same engine/config and compare result hashes/findings.1627. **Record residual risk** and supporting evidence. A zero-finding scan is not proof of runtime performance or absence of all Apex defects.163164---165166## Disposition Criteria167168| Disposition | Use when | Required record |169|---|---|---|170| `fix` | Finding is applicable and a safe change is understood | Change, tests, before/after scan, runtime or scale rationale |171| `validate` | Applicability or impact depends on data shape or call path | Exact experiment/query plan/log evidence needed |172| `suppress-with-rationale` | Finding is accepted, false positive, generated code, or unavoidable under a documented constraint | Scope-limited suppression, owner, review trigger, risk |173| `defer` | Valid issue is lower priority than current risk/capacity | Backlog owner, severity rationale, review date/trigger |174| `not-applicable` | Code path or assumption does not apply | Reproducible evidence; do not dismiss from intuition |175176Never auto-apply generated fixes. Performance changes can alter correctness, locking, sharing, query selectivity, memory, and transaction boundaries.177178---179180## Validation Checklist181182- [ ] Exact source revision, workspace, target org, command, versions, timestamp, and output hash are recorded183- [ ] Target org is authenticated and ApexGuru availability is verified184- [ ] Only `.cls` and `.trigger` coverage is claimed185- [ ] Report mode is preserved; absent mode is labeled `Source analysis`186- [ ] Every finding retains severity, rule, message, all locations, and resources187- [ ] Applicability is checked against call path, data volume, sharing, and transaction context188- [ ] Fixes preserve security, bulk behavior, correctness, and error handling189- [ ] Tests and relevant runtime/scale evidence accompany accepted changes190- [ ] Same-target before/after scan is captured191- [ ] Remaining findings and suppressions have owners and rationale192- [ ] Zero findings is not presented as a performance certification193194---195196## Result Validation Command197198```bash199python3 skills/apex/apexguru-performance-analysis/scripts/check_apexguru_performance_analysis.py \200 --input artifacts/apexguru-results.json \201 --output artifacts/apexguru-normalized.json202```203204The checker validates the Code Analyzer JSON shape, severity/location data, Apex file scope, and evidence-mode labeling. It does not contact Salesforce or judge whether a recommendation is correct.205206---207208## Related Skills209210- `devops/salesforce-code-analyzer` — install/configure v5, combine engines, output formats, CI gates, and suppression policy.211- `apex/apex-performance-profiling` — measure actual transaction behavior and governor consumption.212- `apex/soql-optimization` — validate query selectivity and redesign query patterns.213- `apex/bulkification-patterns` — remediate loop/query/DML patterns while preserving semantics.214- `apex/apexguru-performance-analysis` does not deploy, approve, or certify code.215216See the bundled references for triage examples, attribution failures, and the official source map.
Run npx get-skill add pranavnagrecha/apexguru-performance-analysis in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Run and interpret the ApexGuru engine in Salesforce Code Analyzer v5 for Apex performance and scalability findings: verify the authenticated target org, scope .cls/.trigger files, capture JSON evidence, triage line-level recommendations, validate fixes, and avoid claiming runtime telemetry the report does not contain. Trigger keywords: ApexGuru scan, apexguru Code Analyzer, Apex performance findings, SOQL scalability issue, AI Apex optimization. NOT for general PMD/security lint — use devops/salesforce-code-analyzer. NOT for Apex debug-log or production transaction profiling. It is listed under Security on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. Capability flags: executes scripts, reads secrets. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
PranavNagrecha (@pranavnagrecha) published this skill. Their other Agent Skills are listed on their SkillMD profile.