agentleFS
youcislayoucisla/Agent-Foundry/skills/core/workflow-decompose/SKILL.md

workflow-decompose

Skill1 starsChanged 23 days agoMITView on GitHub

'Decompose any workflow into a DAG: trigger → conditions → actions →

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are 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.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every workflow is a directed acyclic graph with five node types:

    line 21

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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

Workflow Decompose

Decompose any workflow into a reusable DAG. Same model works for cron, n8n, GitHub Actions, or scripts.

Procedure

The DAG Model

Every workflow is a directed acyclic graph with five node types:

[trigger] → [condition] → [action] → [retry] → [observe]
TypePurposeExample
TriggerStarts the workflowCron, webhook, event, manual
ConditionGate; skip branch if false"user has paid plan"
ActionDoes the workAPI call, DB write, email
RetryRecovery on failureBackoff, max attempts, DLQ
ObserveLogs, metrics, alertsLog to DB, emit metric, page

Worked Example: "Send weekly digest"

Trigger:  cron(0 9 * * 1)
Condition: db.users.count(active_in_last_7d > 0)
Action:    fetch eligible_users
Condition: eligible_users.length > 0
Action:    render digest HTML
Action:    send via email provider
Retry:     exponential backoff, 3 attempts, fail → DLQ
Observe:   log sent_count, failed_count, duration_ms
Observe:   emit metric('digest.sent')
Observe:   if failed_count > 0 → alert

Trigger Design

TriggerUse whenWatch out for
CronTime-based, batchTimezone drift, DST
WebhookExternal eventReplay, ordering, idempotency
Event busInternal service eventSchema evolution, lost events
ManualOn-demandNo automation, easy to forget
File watchFile lands in S3Missed events, partial uploads

Rule: one trigger per workflow. Multiple triggers = multiple workflows.

Conditions

Conditions save you from:

  • Running on empty data ("send to 0 users")
  • Running outside business hours
  • Running during maintenance
  • Re-running an already-completed step
if eligible_users.empty:
    logger.info("no eligible users; skipping")
    return

Anti-patterns

  • A workflow with several triggers and no separation.
  • Retry without a max attempt or dead-letter path.
  • A condition with no observable skip reason.
  • Success with no metric or alert.

References

  • details

Verification Checklist

  • Trigger, conditions, actions, retry, and observe are explicit.
  • The workflow has one trigger.
  • Every branch has a skip or failure outcome.
  • Retry limits and dead-letter handling are defined.
  • Success emits a metric or log that can alert.

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.