ApexGuru Insights
ApexGuru Insights is a Salesforce platform feature that uses AI-powered static and runtime analysis to surface performance, security, and reliability issues in an org's Apex code.
Definition
ApexGuru Insights is a Salesforce platform feature that uses AI-powered static and runtime analysis to surface performance, security, and reliability issues in an org's Apex code. The tool produces Insights, each one a specific finding (a SOQL inside a loop, a non-bulkified DML, a heap-bloating pattern, a callout that can violate governor limits) attached to a specific class, trigger, or method. Developers open ApexGuru through the Setup app or the Code Builder IDE, review the ranked Insights list, and pick which ones to address. The tool prioritises Insights by estimated impact (transactions affected, governor-limit risk, performance hit), letting teams focus on what actually matters in production.
ApexGuru is part of Salesforce's broader push to bring AI-assisted development to the platform alongside Agentforce for end users. It sits next to the older Apex Replay Debugger and the Salesforce Code Analyzer (PMD-based static analysis) as another layer of code-quality tooling. The differentiator is the use of actual runtime telemetry from the production org: ApexGuru sees which code paths matter most based on real user activity, rather than just scanning source for known patterns. The combination of static analysis plus runtime weighting is what makes it useful for triaging legacy code in busy orgs.
How ApexGuru Insights triage Apex code that already runs
What an Insight actually looks like
Each Insight is a record with a category (Performance, Governor Limits, Security, Maintainability), a severity (High, Medium, Low), the affected class or trigger, the offending lines of code, and a description of the underlying anti-pattern. Insights also include an estimated impact metric (transactions per day affected, average CPU time saved by fixing, etc.) so reviewers can sort by what hurts most in production.
Runtime telemetry, the differentiator
Traditional static analyzers (PMD, Salesforce Code Analyzer) scan source code and flag anti-patterns without knowing whether the code ever runs. ApexGuru combines static patterns with production telemetry: which classes execute often, which paths hit governor limits, which methods burn the most CPU time. An anti-pattern in code nobody ever calls scores low; the same anti-pattern in a hot path scores high.
Categories of findings
ApexGuru groups findings into a small set of categories. Performance Insights call out CPU-heavy loops, missing query selectivity, and inefficient string operations. Governor Limit Insights highlight SOQL inside loops, unbatched DML, and synchronous callouts in chained transactions. Security Insights surface SOQL injection risk, missing FLS checks, and unsanitised user input. Maintainability Insights point at duplication, dead code, and oversized methods.
The Insights inbox and prioritisation
Insights appear in a sortable inbox. Default sorting puts highest-impact-by-frequency at the top so the team starts with the issues most worth fixing. Filters narrow by class, by category, or by severity. Bulk actions like Mark as Won't Fix or Snooze let teams archive low-value findings without losing the audit trail.
Drilling into a specific Insight
Clicking an Insight opens the detail view: the offending lines highlighted, an explanation of the anti-pattern, the runtime data that produced the score, and a suggested fix. The suggested fix is AI-generated when applicable, citing the relevant rule and showing an example of remediation. Developers can apply the fix manually, mark the Insight as resolved, or send it to Code Builder for direct editing.
AI-generated remediation
For many common anti-patterns, ApexGuru proposes a concrete Apex rewrite that addresses the issue. The remediation is generated by Salesforce-hosted models, grounded in the org's actual class signatures and metadata. Developers review and accept (or reject) the suggestion before applying it. The pattern matches the AI-assisted suggestions in Code Builder and the broader Salesforce developer AI stack.
ApexGuru versus other code-quality tools
Salesforce Code Analyzer runs offline against source code and flags every issue it finds, ranked or not. The Apex Replay Debugger replays a single transaction step by step. ApexGuru sits in between: it scans the whole org's Apex regularly and produces an ongoing inbox of findings, weighted by production usage. Most teams use all three: Code Analyzer in CI, Replay Debugger for incident drilldowns, ApexGuru for ongoing health.
Licensing and rollout
ApexGuru is included with many modern Salesforce editions; some advanced features require add-on licensing. Rolling out the tool in a large org usually starts with a one-week observation period (the tool builds its runtime profile), followed by a triage of the top 20 Insights by impact, then ongoing weekly reviews. Teams that treat ApexGuru as a monitoring surface rather than a one-time scan tend to see steady code-quality improvement quarter over quarter.
How to put ApexGuru Insights to work
ApexGuru is most useful when teams treat it as a recurring triage surface, not a one-off audit. The setup is light; the operating rhythm matters more.
- Open ApexGuru in Setup
Setup, ApexGuru. The page lists the current Insights inbox with severity, impact, and class.
- Filter and prioritise
Sort by Estimated Impact descending. Filter to high severity first. Most orgs find 10 to 20 high-impact Insights that account for the bulk of preventable governor and performance pain.
- Drill into a specific Insight
Click the Insight. Read the rule, the offending lines, the production telemetry, and the suggested fix. Validate the recommendation against the rest of the class before applying.
- Apply, validate, and mark resolved
Apply the suggested fix in Code Builder or your IDE. Run the relevant Apex tests. Once the deploy lands, mark the Insight resolved in ApexGuru so the inbox reflects reality.
- Run a weekly triage
Schedule a 30-minute weekly review of the inbox. The cadence keeps new Insights from piling up and turns ApexGuru into a steady code-quality habit rather than a quarterly audit.
- ApexGuru ranks by runtime telemetry. An anti-pattern in code nobody calls scores low; do not dismiss the tool when low-value findings dominate a cold codebase.
- AI-suggested fixes are recommendations, not commits. Validate against the rest of the class and run tests before applying.
- Marking Insights Resolved without actually fixing the underlying code hides the issue from the inbox; treat the resolved status as a commitment, not a snooze.
- Some Insights overlap with Code Analyzer findings. Decide which tool owns which check so the same anti-pattern does not generate parallel tickets.
Trust & references
Straight from the source - Salesforce's reference material on ApexGuru Insights.
- Apex Developer GuideSalesforce Developer Docs
Hands-on resources to go deeper on ApexGuru Insights.
About the Author
Dipojjal Chakrabarti is a B2C Solution Architect with 29 Salesforce certifications and over 13 years in the Salesforce ecosystem. He runs salesforcedictionary.com to help admins, developers, architects, and cert/interview candidates sharpen their fundamentals. More about Dipojjal.
Test your knowledge
Q1. Where would a developer typically work with ApexGuru Insights?
Q2. What is a Governor Limit in the context of ApexGuru Insights?
Q3. What is required before deploying ApexGuru Insights-related code to production?
Discussion
Loading discussion…