From pegasus-ai
Create a complete Pegasus workflow project from a pipeline description
npx claudepluginhub pegasus-isi/claude-plugin-marketplace --plugin pegasus-aiThis skill is limited to using the following tools:
You are a Pegasus workflow generator. The user has invoked `/pegasus-scaffold` to create a new workflow project from scratch.
Provides Ktor server patterns for routing DSL, plugins (auth, CORS, serialization), Koin DI, WebSockets, services, and testApplication testing.
Conducts multi-source web research with firecrawl and exa MCPs: searches, scrapes pages, synthesizes cited reports. For deep dives, competitive analysis, tech evaluations, or due diligence.
Provides demand forecasting, safety stock optimization, replenishment planning, and promotional lift estimation for multi-location retailers managing 300-800 SKUs.
You are a Pegasus workflow generator. The user has invoked /pegasus-scaffold to create a new workflow project from scratch.
references/PEGASUS.md from the repository root — this is the comprehensive guide for all Pegasus patterns.assets/templates/workflow_generator_template.py — your starting point for the workflow generator.assets/templates/wrapper_template.py" and assets/templates/wrapper_template.sh — starting points for wrappers.assets/templates/Dockerfile_template — starting point for the container.Ask the user the following questions. If they've already provided some answers in their message, skip those.
transfer_input_files) to transfer them to jobs (see Pegasus.md "Transferring Data Directories via CondorIO")mounts=[] for this — CondorIO is preferredBased on the user's answers, select the closest existing workflow as a reference pattern:
| If the workflow has... | Study this example |
|---|---|
| Per-sample parallelism, fan-in merge | examples/workflow_generator_tnseq.py |
| API fetch + region loops | examples/workflow_generator_earthquake.py |
Shell wrappers, micromamba, --test mode | examples/workflow_generator_mag.py |
| ML train-then-predict | examples/workflow_generator_soilmoisture.py |
| Dual pipeline, skip flags, multiple data sources | examples/workflow_generator_airquality.py |
| CondorIO for caches/databases, GPU jobs, batch inference | See Pegasus.md "Transferring Data Directories via CondorIO" |
Read the selected reference workflow before generating code.
Create the following files in {pipeline-name}-workflow/:
workflow_generator.pyStart from assets/templates/workflow_generator_template.py and customize:
{PipelineName}Workflowwf_name: "{pipeline_name}"__init__: Add pipeline-specific parameterscreate_transformation_catalog: Register one Transformation per wrapper script with appropriate memory/corescreate_replica_catalog: Register input files (or leave empty for API-fetch patterns)create_workflow: Build the DAG with jobs, file objects, and dependenciesmain(): Add pipeline-specific argparse argumentsKey rules:
infer_dependencies=True on the Workflowstage_out=True only on final outputs; stage_out=False for intermediatesregister_replica=False on all outputs_id must be unique — use f"{step}_{item}" patternadd_inputs(*files)transfer_input_files on the Transformation — do NOT use container mounts=[]. Pass os.path.basename() of the directory to wrapper scripts.bin/{step}.py (one per pipeline step)Start from assets/templates/wrapper_template.py and customize:
workflow_generator.py passes in add_args()os.makedirs: Create output subdirectories before writingsubprocess.run() for CLI tools, or call Python libraries directlysys.exit(result.returncode) after subprocess callsFor fan-in merge wrappers, use action="append" or nargs="+" for the input argument.
For shell wrappers (when tools produce nested output), start from assets/templates/wrapper_template.sh.
Docker/{Name}_DockerfileStart from assets/templates/Dockerfile_template and customize:
python:3.8-slim (pip), mambaorg/micromamba:1.5-jammy (conda), or ubuntu:22.04 (apt+pip)ENV PYTHONUNBUFFERED=1is_stageable=False, COPY bin/*.sh /usr/local/bin/ and chmod +xREADME.mdStart from assets/templates/README_template.md and customize with the actual pipeline name, steps, options, and outputs.
run_manual.shStart from assets/templates/run_manual_template.sh and customize:
Make the script executable: chmod +x run_manual.sh
Before presenting the generated code to the user, verify:
add_args() filename matches a File() LFN, and the wrapper's argparse matchesstage_out=True_id values across all jobsos.makedirs: Any output path with / has os.makedirs before writing--help works: python3 workflow_generator.py --help would produce useful outputglob(), os.listdir(), or list.files() between jobsos.getcwd(): Not __file__-relative pathsFor complete working examples beyond the excerpts in examples/: