sf-governor-limits

Diagnose and remediate Apex governor limit violations using API 67.0 limit tables and bulkification patterns.

2|Updated Sep 12, 2026
One-click install
npx skills add https://github.com/grzmol/vibe-force --skill sf-governor-limits-grzmol
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sf-governor-limits
Source: https://github.com/grzmol/vibe-force/tree/main/skills/sf-governor-limits
Command: npx skills add https://github.com/grzmol/vibe-force --skill sf-governor-limits-grzmol

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Apex transactions fail with uncatchable LimitException errors when code exceeds Salesforce governor limits like 100 SOQL queries, 150 DML statements, 6 MB heap, or 10 seconds of CPU time, and developers often cannot tell which limit blew or how to restructure the code to stay inside it. ## Core Features & Use Cases - Complete limit reference: Full synchronous and asynchronous per-transaction, certified managed package, platform, static, and size-specific limit tables for API 67.0, plus the Limits and OrgLimits class APIs. - Bulkification patterns: Ready-to-use Apex patterns for one-DML-per-collection, query-once-map-lookup, SOQL for loops, Batch Apex with QueryLocator, and Test.startTest/stopTest limit isolation. - Symptom-to-fix playbook: A remediation guide mapping each runtime failure (SOQL 101, DML 151, heap, CPU time, callouts, stack depth, async executions) to its cause and minimum fix. - Use Case: A trigger fails in production with "Apex CPU time limit exceeded". Use this Skill to identify that nested loops are the cause, replace them with a Map-based lookup, and add a test asserting a constant query count for 200 records. ## Quick Start Ask the assistant to review my trigger handler for governor limit risks and fix any SOQL or DML inside loops.

Frequently Asked Questions about sf-governor-limits

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

FAQPage Schema
How do I fix too many SOQL queries 101 error in Apex?

The 101 SOQL error means a query runs inside a loop or a handler is called per record. Collect ids first, run one query with WHERE Id IN :ids, and store results in a Map keyed by Id for lookup inside the loop.

How do I bulkify Apex triggers to avoid DML limits?

Collect all records into a list inside the loop and execute a single DML statement after it, guarded by an isEmpty check since empty-list DML still consumes one of the 150 statements. Assert a constant DML count in a test with 200 records to prove bulk safety.

What are the Apex governor limits for synchronous vs asynchronous transactions?

Synchronous transactions get 100 SOQL queries, 6 MB heap, and 10,000 ms CPU time; asynchronous get 200 SOQL queries, 12 MB heap, and 60,000 ms CPU time. DML stays at 150 statements and 10,000 rows in both, and scheduled Apex uses synchronous limits.

Does database time for SOQL queries count toward Apex CPU time?

No, time spent in the database for SOQL, SOSL, and DML does not count toward CPU time, and neither does callout waiting time. Application-server CPU spent inside DML operations does count, so nested loops and string operations are the usual CPU culprits.

Why does my Apex transaction hit heap size limits with large queries?

A List holding every record with every field exceeds the 6 MB synchronous heap. Use a SOQL for loop which chunks results into 200-record batches, select only the fields you need, or move the work to Batch Apex for a fresh heap per execution.

Do managed packages share my org's governor limits?

Certified managed packages get their own copy of most per-transaction limits with an 11x cumulative cross-namespace cap, while non-certified packages count against your org's limits. Heap, CPU time, and transaction execution time are always shared across all namespaces.