Skill

workflow-decompose

Decompose any workflow into a DAG: trigger → conditions → actions → retries → observability. Mental model for n8n, Temporal, Airflow, GitHub Actions, or hand-rolled scripts. Use when designing or debugging an automation.

Category
core
Version
0.1.0
License
MIT
Status
active
Length
93 lines
Source
skills/core/workflow-decompose/SKILL.md

Install and discovery

npx --yes --package @youcisla/agent-foundry agent-foundry-install

After the installer runs, this record is available as workflow-decompose. See the docs for harness roots and verification steps.

Contents

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.