Salesforce Apex Quality Guardrails Apply these checks to every Apex class, trigger, and test file you write or review. Step 1 — Governor Limit Safety Check Scan for these patterns before declaring any Apex file acceptable: SOQL and DML in Loops — Automatic Fail Rule: if you see or , , , , , inside a loop body — stop and refactor before proceeding. Step 2 — Sharing Model Verification Every class must declare its sharing intent explicitly. Undeclared sharing inherits from the caller — unpredictable behaviour. | Declaration | When to use | |---|---| | | Default for all service, handler, selector…