SKILL.md
$27
Required Context to Gather First
Ask for or infer:
- flow type
- trigger object / entry conditions
- core business goal
- whether this is new, refactor, or repair
- target org alias if deployment or validation is needed
- whether related objects / fields already exist
Recommended Workflow
1. Choose the right automation tool
Before building, confirm Flow is the right answer rather than:
- formula field
- validation rule
- roll-up summary
- Apex
2. Choose the right Flow type
Need
Default flow type
same-record update before save
before-save record-triggered
related-record work / emails / callouts
after-save record-triggered
guided UI
screen flow
reusable background logic
autolaunched / subflow
scheduled processing
scheduled flow
event-driven declarative response
platform-event flow
AI-evaluated routing (sentiment, intent, tone)
autolaunched with AI Decision element
3. Start from a template
Prefer the provided assets:
assets/record-triggered-before-save.xml
assets/record-triggered-after-save.xml
assets/screen-flow-template.xml
assets/autolaunched-flow-template.xml
assets/scheduled-flow-template.xml
assets/platform-event-flow-template.xml
assets/ai-decision-template.xml
assets/subflows/
4. Validate against Flow guardrails
Focus on:
- no DML in loops
- no Get Records inside loops
- proper fault paths
- correct trigger conditions
- safe subflow composition
- AI Decision elements not placed inside loops (credit cost per iteration)
- AI Decision prompts include merge field references for data context
5. Hand off deployment and testing
Use:
- sf-deploy for deploy / dry-run
- sf-data for high-volume test data
High-Signal Rules
Flow architecture
- before-save for same-record field updates
- after-save for related records, emails, and callouts
- do not loop over
$Record
- use subflows when logic becomes wide or repetitive
Bulk safety
- no DML in loops
- no Get Records in loops
- test with 251+ records when bulk behavior matters
- prefer Transform when the job is shaping data, not per-record branching
Error handling
- every data-changing path should have fault handling
- avoid self-referencing fault connectors
- deploy Flows as Draft first when activation risk is non-trivial
Output Format
When finishing, report in this order:
- Flow type and goal
- Files created or updated
- Architecture choices
- Bulk/error-handling notes
- Deploy/testing next steps
Suggested shape:
Flow: <name>
Type: <flow type>
Files: <paths>
Design: <trigger choice, subflows, key decisions>
Risks: <bulk safety, fault paths, dependencies>
Next step: <dry-run deploy, activate, or test>
Flow Testing (CLI)
Run Flow tests from the command line without VS Code:
# Run all flow tests
sf flow run test --target-org <alias> --json
# Run tests for a specific flow
sf flow run test --class-names MyFlow --target-org <alias> --json
# Get results for an asynchronous run
sf flow get test --test-run-id <id> --target-org <alias> --json
Flow tests execute in the org and can take 1-5 minutes. sf flow run test returns a test run ID for asynchronous runs; use sf flow get test to retrieve results later. Always run with --json and use background execution for longer runs.
Cross-Skill Integration
Need
Delegate to
Reason
create objects / fields first
schema readiness
deploy / activate flow
safe deployment sequence
create realistic bulk test data
post-deploy verification
create Apex actions / invocables
imperative logic
embed LWC in a screen flow
custom UI components
expose Flow to Agentforce
agent action orchestration
Reference Map
Start here
Design / orchestration
AI Decision
Screen / integration / troubleshooting
Score Guide
Score
Meaning
88+
production-ready Flow
75–87
good Flow with some review items
60–74
functional but needs stronger guardrails
< 60
unsafe / incomplete for deployment