You are here:
ApexGuru Insights
Use AI and machine learning models to analyze your Apex code, surface performance antipatterns, detect unused and duplicated code, and generate prescriptive optimization recommendations.
Enable ApexGuru in your org before generating reports.
What You Need to Know
- Editions and eligibility: ApexGuru is available only in Production and Full Copy
Sandbox orgs for Unlimited, Enterprise, Professional, and Signature Editions. It's not
available in Developer Edition orgs. Assign the
Salesforce ApexGuru + Platform Integration Userpermission set. - Data retention and trust: ApexGuru retains your data for 30 days, then purges it. Processing uses the Einstein Trust Layer (US-hosted) with logical org isolation. Your Apex code never trains AI models and isn't retained at the LLM level.
- Scan frequency and processing: Scan your org up to three times per week. Processing typically completes within a few hours depending on org size and complexity.
- Antipattern coverage: ApexGuru detects more than 24 performance antipatterns across SOQL, DML, CPU, memory, and string operations, with new patterns added each release.
- Unused Methods false positives: ApexGuru uses static analysis only (not
runtime-tracked). False positives can occur for
System.PageReferencemethods, interface implementations, dynamically invoked methods (e.g., viaType.newInstance()), and internal calls in managed packages. For comprehensive limitations, see ApexGuru FAQ. - Government Cloud and Hyperforce: Supported in Hyperforce (orgs enabled before migration retain access). Government Cloud isn't supported.
ApexGuru Surfaces
Access ApexGuru through multiple surfaces:
- Setup: Navigate to Scale Insights, then ApexGuru Insights for comprehensive reports.
- Scale Center: Access ApexGuru from the Health Map or ApexGuru tab.
- Code Analyzer IDE (VS Code): Scan Apex code directly in your IDE. See Scan Your Apex Code for Performance Issues Using ApexGuru.
- Code Analyzer CLI: Scan Apex classes from the command line.
- DX MCP and Agentic IDEs: Use ApexGuru in Agentforce-powered environments like Cursor and VS Code. See Use ApexGuru in Agentic IDEs with DX MCP.
- Lightning Experience Insights: When you access a Lightning Experience Performance report, it automatically links relevant ApexGuru recommendations. Click a hyperlinked action name to open an ApexGuru Insights tab for that action within the Lightning Experience Insights dashboard. Review Code Recommendations and SOQL/DML Analysis for slow Apex actions and revise them to improve Lightning Experience performance.
To generate recommendations in Setup:
- From Setup, in the Quick Find box, enter Scale Insights, then click ApexGuru Insights.
- Select a Report Creation Date. ApexGuru analyzes your code and consolidates different categories of recommended fixes.
| Insight | Definition |
|---|---|
| Code Recommendations | Ranked by expected impact, prescriptive recommendations for optimizing sObject types, methods, and memory. |
| SOQL/DML Analysis | Ways to optimize your SOQL and avoid performance issues. |
| Expensive Methods | Expensive methods consume 2–5% of CPU time, and critically expensive methods consume at least 5% of CPU time. |
| Unused Methods | Methods that your currently deployed Apex code doesn’t call. |
| Test Case Insights | Intelligent Test Coverage Classification (Untested, Unasserted, Undertested), AI-generated test methods with side-by-side Current vs Recommended code, and test antipattern detection to improve test quality and reduce coverage inflation. |
| Code Duplicates | Exact and near-duplicate Apex code detected across your org at file, method, and block levels, ranked by characters reducible to help you consolidate and free up governor limit headroom. The calculation is the size of one copy times (number of copies − 1). |
- ApexGuru Code Duplicates
Identify exact and near-duplicate Apex code across your org to reduce maintenance burden and free up governor limit headroom. - ApexGuru Antipatterns
The antipatterns highlighted in ApexGuru help you detect avoidable inefficiencies in your Apex code. Where practical, we also share recommendations for revising your approach to improve the efficiency of your code. - ApexGuru Test Case Antipatterns
The test cases highlighted in ApexGuru help you find places in your Apex test code that aren’t valid, maintainable, or production-ready. - Activate and Use ApexGuru for Apex Code Analysis
Learn how to activate ApexGuru and analyze your Salesforce org’s Apex code securely using the Einstein Trust Layer. - Use ApexGuru in Agentic IDEs with DX MCP
Resolve Apex performance issues directly in environments like VS Code, Agentforce Vibes, and Cursor without switching to the Salesforce UI. - ApexGuru FAQ
Get answers to common questions about ApexGuru.

