Score
Permission Set Spaghetti: The Map Nobody Drew For You
The 4 permission layers and how they resolve, 10 named anti-patterns, a SOQL query bank and a cleanup sequence that will not break access.
AI Apex generation is real, useful, and full of footguns. This page is the practitioner guide to using AI for Apex without producing the kind of code that breaks production in week 4. Patterns that work, patterns that don't, and the review discipline that makes the difference.
04 steps · 04 FAQs
“AI hits 90% test coverage easily. The assertions test nothing. The build is green. The bug ships.”
Practical steps
Bulk-safe, governor-limit-aware, error-handled, logging-instrumented. State each constraint. AI follows what you say, not what you mean.
Don't read line-by-line. Ask: is the SOQL bulkified? Is the DML batched? Is the error path explicit? If those three are right, the rest is detail.
Define what 'correct' means for the business case, in English. Then ask AI to write a test that proves it. Order matters.
PMD or CodeScan catch the patterns AI misses (security, governor-limit anti-patterns, dead code). Free. Run it on every PR.
From the library
Score
The 4 permission layers and how they resolve, 10 named anti-patterns, a SOQL query bank and a cleanup sequence that will not break access.
Workflow
Step-by-step playbook to find and fix competing automations on Salesforce objects: detect race conditions, retire Workflow Rules, consolidate to one Flow.
Dev workflow
How working Salesforce developers are using AI to ship Apex, LWC, and integrations 3–5x faster, without giving up code review discipline or production safety.
Frequently asked
For greenfield triggers, handlers, and service classes following standard patterns: yes, with review. For complex business logic spanning multiple objects with shared state: not yet. The bar isn't 'can it write code' but 'can a human review it faster than they could write it.' The answer is increasingly yes.
Plausible-looking code that violates a governor limit at scale. AI optimizes for code that compiles and passes tests; it doesn't natively reason about CPU time, query rows, or DML statement counts. Reviewers have to look for those specifically.
State the constraint explicitly: 'Generate a bulk-safe trigger handler that processes up to 200 records per transaction, executes a single SOQL with related-record traversal, and DMLs results in a single statement.' AI will follow stated constraints; it ignores implied ones.
Yes for the boilerplate (setup, DML, mock data). No for the assertions, write those by hand against the business logic you actually want to verify. AI test classes look good and prove nothing if the asserts are trivial.
More for developers
Hand the actual work to Clientell AI your AI agent for Salesforce Apex with AI, flows, data ops, and user management.
14-day free trial · No credit card required