/analyze-flow — Flow vs Apex routing + bulkification review
Analyze Flow vs Apex routing and review bulkification risks in Salesforce.
Wraps agents/flow-analyzer/AGENT.md. For a Flow or an sObject, routes via standards/decision-trees/automation-selection.md, checks bulkification, and flags trigger/flow co-existence risks.
Step 1 — Collect inputs
Ask:
1. Either a Flow path or an sObject API name?
Example flow path: force-app/main/default/flows/Lead_AutoConvert.flow-meta.xml
Example object: Lead
2. Target-org alias? (optional — enables list_flows_on_object)
If the user gave a flow path, skip the object question. If they gave an object, scan force-app/main/default/flows/ for matching flows.
Step 2 — Load the agent
Read agents/flow-analyzer/AGENT.md fully + the automation decision tree + flow skills listed in Mandatory Reads.
Step 3 — Execute
Follow the 5-step plan:
- Gather flows in scope (local + optional org-side via
list_flows_on_object) - Apply the automation decision tree to each flow (KEEP / FIX_IN_PLACE / MIGRATE_TO_APEX / MIGRATE_TO_AGENTFORCE)
- Bulkification checks (DML/SOQL in loops, missing fault paths, untyped collections)
- Co-existence check (trigger + flow on same event)
- Recommendations with specific element changes
Step 4 — Deliver
- Summary with verdict distribution
- Per-flow report (verdict, decision-tree branch, findings, fixes)
- Co-existence section if triggers + flows overlap
- Citations
Step 5 — Recommend follow-ups
/consolidate-triggersif co-existence is flagged and Apex should own the event./refactor-apexif a flow should migrate to Apex — applied to the new handler./request-skillif a flow pattern has no canonical skill.
What this command does NOT do
- Does not modify the flow XML.
- Does not activate or deactivate flows in the org.
- Does not pass judgment on Flow vs Apex outside the decision tree.