sf-debug

Analyzes Salesforce debug logs to diagnose governor limits, exceptions, and performance bottlenecks.

1|Updated May 7, 2026
One-click install
npx skills add https://github.com/amanpraaj/sf-skill-hub --skill sf-debug-amanpraaj
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sf-debug
Source: https://github.com/amanpraaj/sf-skill-hub/tree/main/skills/salesforce/sf-debug
Command: npx skills add https://github.com/amanpraaj/sf-skill-hub --skill sf-debug-amanpraaj

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Salesforce debug logs are dense and hard to interpret, making it difficult to pinpoint why a transaction failed, which governor limit was hit, or where a performance bottleneck lives. This Skill turns raw log output into a structured root-cause diagnosis with severity classification and concrete fix recommendations. ## Core Features & Use Cases - Debug Log Analysis: Retrieves logs via the sf CLI and parses SOQL, DML, CPU, and heap usage patterns to detect issues like SOQL-in-loop and non-selective queries. - Governor Limit & Exception Diagnosis: Interprets LIMIT_USAGE events, stack traces, and FATAL_ERROR entries to identify root causes and classify severity as Critical, Warning, or Info. - Performance Benchmarking Guidance: Provides proven Apex benchmarking techniques and optimization patterns (e.g., String.join vs concatenation, Set vs List lookups) backed by community-tested data. - Use Case: A trigger intermittently fails in production. You ask the agent to analyze the latest debug log, and it identifies a SOQL query inside a loop hitting the 100-query limit, then recommends a Map-based bulkification fix and a verification rerun. ## Quick Start Ask the agent to analyze the latest debug log from your Salesforce org for governor limit issues and suggest fixes.

Frequently Asked Questions about sf-debug

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I analyze Salesforce debug logs for governor limit issues?▼

Retrieve the log with sf apex get log or sf apex tail log, then examine LIMIT_USAGE events for SOQL queries, DML statements, CPU time, and heap size. Values above 80% of synchronous limits indicate warning-level risk, and repeated SOQL_EXECUTE_BEGIN entries signal queries inside loops.

How to detect SOQL in loop from an Apex debug log?▼

Search the log for repeated SOQL_EXECUTE_BEGIN events on the same source line, often nested between LOOP_BEGIN and ITERATION_BEGIN events. The fix is to query once before the loop and store results in a Map keyed by Id for constant-time lookups.

What tools can visualize Salesforce debug logs?▼

The Apex Log Analyzer VS Code extension provides flame charts, call trees, and database operation highlighting for free. The Developer Console offers built-in timeline and stack tree panels, while sf CLI combined with grep or ripgrep supports scriptable analysis in CI pipelines.

Why is my Salesforce debug log truncated or missing?▼

Logs over 2MB are truncated, so reduce debug levels such as lowering ApexCode from DEBUG to INFO. If no logs appear, verify an active TraceFlag exists for the user and that the user has API Enabled and Author Apex permissions.

When should I use sf-debug instead of sf-testing or sf-apex?▼

Use sf-debug for root-cause diagnosis from log evidence such as governor limits, stack traces, and slow queries. Delegate to sf-testing when running or repairing Apex tests, and to sf-apex when implementing the actual code fix.