---
schema_version: "1"
id: ee3ab0a0c7b2f55c351a9c9efb6fb7a746c222463b61b5f0256f1d4f78f7bd46
title: ApexGuru Insights
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/apexguru_overview.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.apexguru_overview.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 34586469e9d55fde23307425c95613003c28b6fe861be091b7efe0d8d9807a10
description: Use AI and machine learning models to analyze your Apex code, surface performance antipatterns, detect unused and duplicated code, and generate prescriptive optimization recommendations.
products:
  - Cross Cloud
release: "264"
---
# 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 requires activation in a Production or Full Copy Sandbox org on Unlimited, Enterprise, Professional, or Signature Edition. Partner Large Data Volume (LDV) orgs also have access. It's not available in Developer Edition orgs or the EU Operating Zone. After activation, ApexGuru Insights are also available via Code Analyzer in Developer Sandbox, Partial Copy Sandbox, and Scratch Orgs where the Developer Hub is a Production or Full Copy org.
- **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.PageReference` methods, interface implementations, dynamically invoked methods (e.g., via `Type.newInstance()`), and internal calls in managed packages. For comprehensive limitations, see [ApexGuru FAQ](https://help.salesforce.com/s/articleView?id=xcloud.apexguru_faq.htm&release=264.0.0&type=5 "Get answers to common questions about ApexGuru.").
- **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 [ApexGuru Engine](https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/engine-apexguru.html) and [Scan Your Apex Code for Performance Issues Using ApexGuru](https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/analyze-vscode.html#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](https://help.salesforce.com/s/articleView?id=xcloud.apexguru_salesforce_dx_mcp.htm&release=264.0.0&type=5 "Resolve Apex performance issues directly in environments like VS Code, Agentforce Vibes, and Cursor without switching to the Salesforce UI.").
- **ApexGuru Skills**: Run Apex performance scans from Agentforce Vibes and other agentic surfaces.
- **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](https://help.salesforce.com/s/articleView?id=xcloud.lex_insights_overview.htm&release=264.0.0&type=5 "Use on-demand insights to identify, analyze, and improve the performance of your custom Lightning pages and Lightning components. Lightning Experience Insights provides a high-level overview of your users’ experience, and detailed metrics to identify bottlenecks and optimize page load times. You can find this data inside the Performance Insights and Usage Insights dashboards.") 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:

1. From Setup, in the Quick Find box, enter Scale Insights, then click **ApexGuru Insights**.
2. Select a **Report Creation Date**. ApexGuru analyzes your code and consolidates different categories of recommended fixes.

![ApexGuru Insight Categories](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-scalability-264-0-0-production-enus/18f3af65-f4ea-4406-9c30-319b9afa03cd/images/icon_example.png)

ApexGuru Insight Categories

 
| 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](https://help.salesforce.com/s/articleView?id=xcloud.apexguru_code_duplicates.htm&release=264.0.0&type=5)**  
    Identify exact and near-duplicate Apex code across your org to reduce maintenance burden and free up governor limit headroom.
- **[ApexGuru Antipatterns](https://help.salesforce.com/s/articleView?id=xcloud.apexguru_antipatterns.htm&release=264.0.0&type=5)**  
    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](https://help.salesforce.com/s/articleView?id=xcloud.apexguru_test_case_antipatterns.htm&release=264.0.0&type=5)**  
    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](https://help.salesforce.com/s/articleView?id=xcloud.apexguru_workflow.htm&release=264.0.0&type=5)**  
    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](https://help.salesforce.com/s/articleView?id=xcloud.apexguru_salesforce_dx_mcp.htm&release=264.0.0&type=5)**  
    Resolve Apex performance issues directly in environments like VS Code, Agentforce Vibes, and Cursor without switching to the Salesforce UI.
- **[ApexGuru Skills](https://help.salesforce.com/s/articleView?id=xcloud.apexguru_skills.htm&release=264.0.0&type=5)**  
    Run Apex performance scans directly from Agentforce Vibes and other agentic surfaces without switching to the Salesforce UI.
- **[ApexGuru FAQ](https://help.salesforce.com/s/articleView?id=xcloud.apexguru_faq.htm&release=264.0.0&type=5)**  
    Get answers to common questions about ApexGuru.

#### See Also

- [Get AI-Powered Insights for Your Apex Code with ApexGuru](https://developer.salesforce.com/blogs/2024/02/get-ai-powered-insights-for-your-apex-code-with-apexguru)
- [Limitation: ApexGuru "Unused Methods"](https://help.salesforce.com/s/articleView?id=005132418&type=1&language=en_US)