salesforce-flow
Use for Salesforce Flow Builder work — Record-Triggered, Screen, Scheduled, Platform-Event-Triggered, Auto-launched. Bulk-safe patterns, error handling, sub-flows, performance.
What this skill does
# salesforce-flow Salesforce Flow. Declarative automation. Replaces Workflow Rules + Process Builder (deprecated). ## Flow types | Type | Triggered by | Pattern | |---|---|---| | Record-Triggered Before-Save | DML on object | Field updates same record (lightweight) | | Record-Triggered After-Save | DML on object | Cross-object DML, callouts (async OK) | | Schedule-Triggered | Cron | Bulk jobs | | Platform-Event-Triggered | PE publish | Async response to events | | Screen | User action | UI flow | | Auto-launched | Apex / Flow / button | Sub-routine | ## Bulk-safe patterns 1. **Bulkify in Flow:** loops process collections, not single records. Get Records → Loop → Add to collection → Update Records (after loop). 2. **DML in loop = anti-pattern** (CPU + governor limit risk). Always batch. 3. **Sub-flow for reuse.** Auto-launched sub-flows; pass collections. 4. **Decision elements** before DML to filter out unaffected records. ## Error handling Every Flow needs error handling. Three options: - **Fault path** on each DML node (most explicit) - **Schedule-Triggered fault email** (org-wide setting) - **Platform Event for failures** (custom error_event__e) For Record-Triggered: fault paths must NOT throw (or DML rolls back). Use `Sticky Faults` pattern: log to error event, swallow. ## Method (build a record-triggered flow) 1. **Decide trigger:** Before-Save (field updates only) or After-Save (related DML, callouts). 2. **Entry conditions** — narrow as much as possible to avoid wasted invocations. 3. **Bulkified body** — collections, loops only over collections, single DML at end. 4. **Fault paths** on every DML. 5. **Test:** Apex test class invoking flow via Database.insert/update of trigger object. 200 records minimum to verify bulk safety. 6. **Activate** in deploy package. ## Output shape ``` Flow: <name> Type: <record-triggered before-save | etc> Trigger: <object + entry conditions> Structure: Get Records <variable name> Loop <variable> ↳ Decision <conditions> ↳ Assignment <field updates> Add to coll <output collection> Update Records <single DML at end> Fault handling: Each DML → fault path → custom error event publish Email-on-error: <on | off> Test plan: Apex test class: <FlowName_Test.cls> Records inserted: 200 (bulk-safe verification) Coverage: ≥ 75% ``` ## Rules - **Before-Save flows: same record only, field updates only.** No DML on related, no callouts. - **After-Save flows: anything else, but mind governor limits.** - **No DML in loops.** Aggregate; flush once. - **Fault paths ALWAYS.** Even when "shouldn't fail". - **Apex test classes for Flows.** Flow tests in Setup are not source-controlled. - **Sub-flows for reuse.** Don't copy-paste decision logic. ## Anti-patterns - Multiple Flows on same object same trigger (ordering chaos; consolidate) - Process Builder still active (deprecated; migrate) - Flow that calls Apex that calls Flow (debugging nightmare) - Decision element that's actually a switch on 30 picklist values (use Apex; Flow has limits) - Schedule-Triggered Flow processing 10k+ records synchronously (use Apex Batch) ## When NOT to use - Pure Apex automation works — Flow adds complexity - Sharing rules / role updates — those are config, not Flow - Bulk migration — Apex Batch / Bulk API better ## Subagent dispatch - `salesforce-architect` for "should this be Flow or Apex?" decision - `apex-bulkifier` for the Apex test class - `Plan` for multi-flow refactors ## Key references - Flow Builder: help.salesforce.com → Flow Builder - Bulkification: trailhead.salesforce.com (Flow Bulkification) - Process Builder migration: help.salesforce.com → Migrate to Flow ## Value over native CC CC won't naturally know Flow-specific bulkification patterns, Before-Save vs After-Save trade-offs, fault-path discipline, or sub-flow consolidation patterns. Platform-specific knowledge IS the value.
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.