agentleFS
vhmarquezvhmarquez/argo/skills/flow-audit/SKILL.md

flow-audit

Skill1 starsChanged 7 months agoMITView on GitHub

Inventory active Flows in the target org, classify them by trigger type and purpose, flag overlaps with Apex triggers in source, and surface flows that lack source-control coverage. Useful before recommending new automation (Flow vs. Trigger decision) and during automation audits.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If <object> was provided, add AND TriggerObjectOrEvent.QualifiedApiName = '<object>'.

    line 43
  2. Distinctive:

    No row counts in the report unless you queried for them: Run-history queries are expensive and not always available.

    line 137

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

You are auditing record-triggered, screen, scheduled, and platform-event Flows in the target org. Output a structured report so the user — or @architect — can decide how to consolidate, replace, or leave them alone.

Read Project Config First

source "${CLAUDE_PLUGIN_ROOT}/hooks/lib/config.sh"
source "${CLAUDE_PLUGIN_ROOT}/hooks/lib/sf-cli.sh"
sf_cli_check || exit 2
ORG="$(sf_config_get '.platform.defaultTargetOrg' "$ENV")"
APEX_SRC="$(sf_config_get '.paths.apexSource' "$ENV")"

Input

$ARGUMENTS:

  • (empty) — full audit of active Flows
  • <object> — limit to flows that target a specific sObject (e.g., Account)
  • --include-inactive — include inactive flow versions in the inventory
  • --target-org <alias> / --env <name> — standard overrides
  • --ci / --format json|sarif / --out <path> — see CI output contract

Steps

1. Inventory active Flows

sf_cli_query "
  SELECT DeveloperName, Label, ProcessType, TriggerType, TriggerObjectOrEvent.QualifiedApiName,
         ActiveVersion.VersionNumber, ActiveVersion.Status,
         LastModifiedBy.Name, LastModifiedDate, ManageableState
  FROM FlowDefinitionView
  WHERE IsActive = TRUE
  ORDER BY TriggerType, TriggerObjectOrEvent.QualifiedApiName, DeveloperName
" "$ORG"

If <object> was provided, add AND TriggerObjectOrEvent.QualifiedApiName = '<object>'.

2. Classify by ProcessType + TriggerType

ProcessTypeMeaningNotes
AutoLaunchedFlow + RecordBeforeSaveBefore-save record-triggered flowPre-DML field set; same-record updates only, no callouts
AutoLaunchedFlow + RecordAfterSaveAfter-save record-triggered flowCross-object DML, async; high concurrency risk
AutoLaunchedFlow + ScheduledScheduled flowRuns on a schedule; check frequency
FlowScreen flowUser-facing, requires visibility into the app/page
AutoLaunchedFlow + PlatformEventPlatform-event-triggered flowSubscriber to a Platform Event
WorkflowLegacy Workflow Rule (auto-migrated)Retire in favor of Flow
ProcessBuilderProcess Builder (deprecated)Retire — Salesforce has end-of-life dates

3. Detect Apex-trigger / Flow overlaps

For each record-triggered Flow on object O:

grep -l "trigger .* on $O " "$APEX_SRC"/*.trigger 2>/dev/null

If overlap, flag:

  • Both Flow and Apex Trigger run on the same object → unpredictable order, governor-limit risk
  • Recommend: consolidate (use one or the other), or document the order if both must coexist

4. Detect orphan flows (no source coverage)

Cross-reference flow DeveloperName against force-app/**/flows/*.flow-meta.xml:

  • Active in org AND present in source — ✅ tracked
  • Active in org AND NOT in source — ⚠️ untracked (will not deploy elsewhere; missing from CI/CD)
  • In source AND NOT active — ✅ deactivated; possibly intentional

5. Output

Default Markdown report:

# Flow Audit: <ORG>

Run at: 2026-04-28T10:40:00Z
Active flows: 12

## Active record-triggered flows

| DeveloperName | Object | TriggerType | Modified by | In source? | Apex overlap? |
|---------------|--------|-------------|-------------|------------|---------------|
| Acct_Set_Region_AfterSave | Account | RecordAfterSave | jdoe@... | ✅ | ⚠️ AccountTrigger |
| Case_Auto_Assign | Case | RecordBeforeSave | gov-user | ❌ untracked | — |

## Active screen flows

| DeveloperName | Label | Modified by | In source? |
|---------------|-------|-------------|------------|
| ...

## Active scheduled flows

| DeveloperName | Frequency | Last modified | In source? |
|---------------|-----------|---------------|------------|

## Active platform-event flows

...

## Findings

### ⚠️ Untracked active flows (3)
These run in production but aren't in source control:
- `Case_Auto_Assign` — last modified 2026-04-15 by gov-user
- ...

### ⚠️ Apex/Flow overlaps (1)
Same-object automation in two technologies:
- Account: `Acct_Set_Region_AfterSave` (Flow) + `AccountTrigger` (Apex)

### ⚠️ Deprecated automation in use (2)
- `Old_Process_Builder_X` (ProcessBuilder) — Salesforce end-of-life
- `Workflow_Auto_Email` (Workflow) — migrate to Flow

CI mode emits findings in the internal shape (see docs/ci-output-contract.md):

  • FLOW-UNTRACKED — warning per untracked active flow
  • FLOW-APEX-OVERLAP — warning per same-object overlap
  • FLOW-DEPRECATED — error for ProcessBuilder/Workflow

6. Exit codes

  • 0 — no findings
  • 1 — any FLOW-* findings
  • 2 — query/setup error

Rules

  • Don't try to read flow contents. Flow XML parsing is heavy; this skill is metadata-only. Use /argo:field-impact if you need to know which fields a Flow touches
  • Don't audit inactive flows by default. They're harmless and noisy
  • Honor managed packages. Flows from a managed package (ManageableState != 'unmanaged') are not the user's concern; report them in a separate "From Managed Packages" section
  • No row counts in the report unless you queried for them. Run-history queries are expensive and not always available; don't fake metrics

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.