dagu-workflows
Guide for authoring Dagu workflows with YAML syntax. Use when creating workflow definitions, configuring steps and executors, or setting up scheduling and dependencies.
What this skill does
# Dagu Workflow Authoring
This skill activates when creating or modifying Dagu workflow definitions, configuring workflow steps, scheduling, or composing complex workflows.
## When to Use This Skill
Activate when:
- Writing Dagu workflow YAML files
- Configuring workflow steps and executors
- Setting up workflow scheduling with cron
- Defining step dependencies and data flow
- Implementing error handling and retries
- Composing hierarchical workflows
- Using environment variables and parameters
## Basic Workflow Structure
### Minimal Workflow
```yaml
# hello.yaml
steps:
- name: hello
command: echo "Hello from Dagu!"
```
### Complete Workflow Structure
```yaml
name: my_workflow
description: Description of what this workflow does
# Schedule (optional)
schedule: "0 2 * * *" # Cron format: daily at 2 AM
# Environment variables
env:
- KEY: value
- DB_HOST: localhost
# Parameters
params: ENVIRONMENT=production
# Email notifications (optional)
mailOn:
failure: true
success: false
smtp:
host: smtp.example.com
port: 587
errorMail:
from: [email protected]
to: [email protected]
# Workflow steps
steps:
- name: step1
command: echo "First step"
- name: step2
command: echo "Second step"
depends:
- step1
```
## Steps
### Basic Step
```yaml
steps:
- name: greet
command: echo "Hello, World!"
```
### Step with Script
```yaml
steps:
- name: process
command: |
echo "Starting processing..."
./scripts/process.sh
echo "Done!"
```
### Step with Working Directory
```yaml
steps:
- name: build
dir: /path/to/project
command: make build
```
### Step with Environment Variables
```yaml
steps:
- name: deploy
env:
- ENVIRONMENT: production
- API_KEY: $API_KEY # From global env
command: ./deploy.sh
```
## Executors
### Command Executor (Default)
```yaml
steps:
- name: shell_command
command: ./script.sh
```
### Docker Executor
```yaml
steps:
- name: run_in_container
executor:
type: docker
config:
image: alpine:latest
command: echo "Running in Docker"
- name: with_volumes
executor:
type: docker
config:
image: node:18
volumes:
- /host/path:/container/path
env:
- NODE_ENV=production
command: npm run build
```
### SSH Executor
```yaml
steps:
- name: remote_execution
executor:
type: ssh
config:
user: deploy
host: server.example.com
key: /path/to/ssh/key
command: ./remote_script.sh
```
### HTTP Executor
```yaml
steps:
- name: api_call
executor:
type: http
config:
method: POST
url: https://api.example.com/webhook
headers:
Content-Type: application/json
Authorization: Bearer $API_TOKEN
body: |
{
"event": "workflow_complete",
"timestamp": "{{.timestamp}}"
}
```
### Mail Executor
```yaml
steps:
- name: send_notification
executor:
type: mail
config:
to: [email protected]
from: [email protected]
subject: Workflow Complete
message: |
The workflow has completed successfully.
Time: {{.timestamp}}
```
### JQ Executor
```yaml
steps:
- name: transform_json
executor:
type: jq
config:
query: '.users[] | select(.active == true) | .email'
command: cat users.json
```
## Step Dependencies
### Simple Dependencies
```yaml
steps:
- name: download
command: wget https://example.com/data.zip
- name: extract
depends:
- download
command: unzip data.zip
- name: process
depends:
- extract
command: ./process.sh
```
### Multiple Dependencies
```yaml
steps:
- name: fetch_data
command: ./fetch.sh
- name: fetch_config
command: ./fetch_config.sh
- name: process
depends:
- fetch_data
- fetch_config
command: ./process.sh
```
### Parallel Execution
```yaml
# These run in parallel (no dependencies)
steps:
- name: task1
command: ./task1.sh
- name: task2
command: ./task2.sh
- name: task3
command: ./task3.sh
# This waits for all above to complete
- name: finalize
depends:
- task1
- task2
- task3
command: ./finalize.sh
```
## Conditional Execution
### Preconditions
```yaml
steps:
- name: deploy_production
preconditions:
- condition: "`echo $ENVIRONMENT`"
expected: "production"
command: ./deploy.sh
```
### Continue On Failure
```yaml
steps:
- name: optional_step
continueOn:
failure: true
command: ./might_fail.sh
- name: cleanup
depends:
- optional_step
command: ./cleanup.sh # Runs even if optional_step fails
```
## Error Handling and Retries
### Retry Configuration
```yaml
steps:
- name: flaky_api_call
command: curl https://api.example.com/data
retryPolicy:
limit: 3
intervalSec: 10
```
### Exponential Backoff
```yaml
steps:
- name: with_backoff
command: ./external_api.sh
retryPolicy:
limit: 5
intervalSec: 5
exponentialBackoff: true # 5s, 10s, 20s, 40s, 80s
```
### Signal on Stop
```yaml
steps:
- name: graceful_shutdown
command: ./long_running_process.sh
signalOnStop: SIGTERM # Send SIGTERM instead of SIGKILL
```
## Data Flow
### Output Variables
```yaml
steps:
- name: generate_id
command: echo "ID_$(date +%s)"
output: PROCESS_ID
- name: use_id
depends:
- generate_id
command: echo "Processing with ID: $PROCESS_ID"
```
### Script Output
```yaml
steps:
- name: get_config
script: |
#!/bin/bash
export DB_HOST="localhost"
export DB_PORT="5432"
output: DB_CONFIG
- name: connect
depends:
- get_config
command: ./connect.sh $DB_HOST $DB_PORT
```
## Scheduling
### Cron Schedule
```yaml
# Daily at 2 AM
schedule: "0 2 * * *"
# Every Monday at 9 AM
schedule: "0 9 * * 1"
# Every 15 minutes
schedule: "*/15 * * * *"
# First day of month at midnight
schedule: "0 0 1 * *"
```
### Start/Stop Times
```yaml
# Only run during business hours
schedule:
start: "2024-01-01"
end: "2024-12-31"
cron: "0 9-17 * * 1-5" # Mon-Fri, 9 AM to 5 PM
```
## Environment Variables
### Global Environment
```yaml
env:
- ENVIRONMENT: production
- LOG_LEVEL: info
- API_URL: https://api.example.com
steps:
- name: use_env
command: echo "Environment: $ENVIRONMENT"
```
### Step-Level Environment
```yaml
steps:
- name: with_custom_env
env:
- CUSTOM_VAR: value
- OVERRIDE: step_value
command: ./script.sh
```
### Environment from File
```yaml
env:
- .env # Load from .env file
steps:
- name: use_env_file
command: echo "DB_HOST: $DB_HOST"
```
## Parameters
### Defining Parameters
```yaml
params: ENVIRONMENT=development VERSION=1.0.0
steps:
- name: deploy
command: ./deploy.sh $ENVIRONMENT $VERSION
```
### Using Parameters
```bash
# Run with default parameters
dagu start workflow.yaml
# Override parameters
dagu start workflow.yaml ENVIRONMENT=production VERSION=2.0.0
```
## Sub-Workflows
### Calling Sub-Workflows
```yaml
# main.yaml
steps:
- name: run_sub_workflow
run: sub_workflow.yaml
params: PARAM=value
- name: another_sub
run: workflows/another.yaml
```
### Hierarchical Workflows
```yaml
# orchestrator.yaml
steps:
- name: data_ingestion
run: workflows/ingest.yaml
- name: data_processing
depends:
- data_ingestion
run: workflows/process.yaml
- name: data_export
depends:
- data_processing
run: workflows/export.yaml
```
## Handlers
### Cleanup Handler
```yaml
handlerOn:
exit:
- name: cleanup
command: ./cleanup.sh
steps:
- name: main_task
command: ./task.sh
```
### Error Handler
```yaml
handlerOn:
failure:
- name: send_alert
executor:
type: mail
config:
tRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.