Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Salesforce Flow architecture decisions, flow type selection, bulk safety validation, and fault handling standards. Use this skill when designing or reviewing Record-Triggered, Screen, Autolaunched, Scheduled, or Platform Event flows to ensure correct type selection, no DML/Get Records in loops, proper fault connectors on all data-changing elements, and appropriate automation density checks before deployment.
.claude/skills/salesforce-flow-design/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | — | — |
| case-19 | ✗→✓ | ▲ Improved | — | — |
| case-13 | ✗→✓ | ▲ Improved | — | — |
| case-06 | ✗→✗ | = Same ✗ | — | — |
| case-07 | ✗→✗ | = Same ✗ | — | — |
Apply these checks to every Flow you design, build, or review.
Before designing a Flow, verify that a lighter-weight declarative option cannot solve the problem:
| Requirement | Best tool | |---|---| | Calculate a field value with no side effects | Formula field | | Prevent a bad record save with a user message | Validation rule | | Sum or count child records on a parent | Roll-up Summary field | | Complex multi-object logic, callouts, or high volume | Apex (Queueable / Batch) — not Flow | | Everything else | Flow ✓ |
If you are building a Flow that could be replaced by a formula field or validation rule, ask the user to confirm the requirement is genuinely more complex.
| Use case | Flow type | Key constraint | |---|---|---| | Update a field on the same record before it is saved | Before-save Record-Triggered | Cannot send emails, make callouts, or change related records | | Create/update related records, emails, callouts | After-save Record-Triggered | Runs after commit — avoid recursion traps | | Guide a user through a multi-step UI process | Screen Flow | Cannot be triggered by a record event automatically | | Reusable background logic called from another Flow | Autolaunched (Subflow) | Input/output variables define the contract | | Logic invoked from Apex @InvocableMethod | Autolaunched (Invocable) | Must declare input/output variables | | Time-based batch processing | Scheduled Flow | Runs in batch context — respect governor limits | | Respond to events (Platform Events / CDC) | Platform Event–Triggered | Runs asynchronously — eventual consistency |
Decision rule: choose before-save when you only need to change the triggering record's own fields. Move to after-save the moment you need to touch related records, send emails, or make callouts.
These patterns are governor limit failures at scale. Check for all of them before the Flow is activated.
Loop element
└── Create Records / Update Records / Delete Records ← ❌ DML inside loopFix: collect records inside the loop into a collection variable, then run the DML element outside the loop.
Loop element
└── Get Records ← ❌ SOQL inside loopFix: perform the Get Records query before the loop, then loop over the collection variable.
Get Records — collect all records in one query
└── Loop over the collection variable
└── Decision / Assignment (no DML, no Get Records)
└── After the loop: Create/Update/Delete Records — one DML operationWhen the goal is reshaping a collection (e.g. mapping field values from one object to another), use the Transform element instead of a Loop + Assignment pattern. Transform is bulk-safe by design and produces cleaner Flow graphs.
Every element that can fail at runtime must have a fault connector. Flows without fault paths surface raw system errors to users.
Fault connector → Log Error (Create Records on a logging object or fire a Platform Event)
→ Screen element with user-friendly message (Screen Flows)
→ Stop / End element (Record-Triggered Flows)Never connect a fault path back to the same element that faulted — this creates an infinite loop.
Before deploying, verify there are no overlapping automations on the same object and trigger event:
Object + When to Run combinationbefore insert / after update contextOverlapping automations can cause unexpected ordering, recursion, and governor limit failures. Document the automation inventory for the object before activating.
lightning-input and SLDS-compliant components for all user inputs — do not use HTML form elements.Deploy as Draft → Test with 1 record → Test with 200+ records → ActivateISCHANGED(Status) — ensure the test data actually triggers the condition).| Anti-pattern | Risk | Fix | |---|---|---| | DML element inside a Loop | Governor limit exception | Move DML outside the loop | | Get Records inside a Loop | SOQL governor limit exception | Query before the loop | | No fault connector on DML/email/callout element | Unhandled exception surfaced to user | Add fault path to every such element | | Updating the triggering record in an after-save flow with no recursion guard | Infinite trigger loops | Add an entry condition or recursion guard variable | | Looping directly on $Record collection | Incorrect behaviour at scale | Assign to a collection variable first, then loop | | Process Builder still active alongside a new Flow | Double-execution, unexpected ordering | Deactivate Process Builder before activating the Flow | | Screen Flow with no End element on all branches | Runtime error or stuck user | Ensure every branch resolves to an End element |
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-23 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-24 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted. The headline lift of +13 percentage points is the difference between those two pass rates over the 24 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.