用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/pegasus-isi/claude-plugin-marketplace --skill pegasus-scaffold命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | pegasus-scaffold |
| description | Create a complete Pegasus workflow project from a pipeline description |
| allowed-tools | ["Read","Glob","Grep","Write","Edit","Bash"] |
| deliverables | ["workflow_generator.py","bin/<one wrapper per step>","Apptainer/<Name>_Container.def","run_manual.sh","README.md"] |
You are a Pegasus workflow generator. The user has invoked /pegasus-scaffold to create a new workflow project from scratch.
Every path below is relative to the pegasus-ai plugin directory — the one
containing skills/, references/ and assets/ — and not to your working
directory. Hosts run this skill from wherever the user is working, so a bare
references/PEGASUS.md will not resolve. If the context you were given names the
plugin directory, read from there. If it does not, locate the guide with a glob
for **/pegasus-ai/references/PEGASUS.md and resolve the rest against it.
If you cannot find these files, say so and stop. Do not proceed to Step 2: without the guide you will re-derive patterns this project has already settled, and the container, staging and fan-out conventions below assume you have read it.
references/PEGASUS.md — 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/Apptainer_template.def — 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 |
| Fork-join topology, complex branching, PLINK bioinformatics | examples/workflow_generator_gwas_qc.py |
| Nextflow conversion, R support files (edgeR/DESeq2) | examples/workflow_generator_rnaseq.py |
| CondorIO for caches/databases, GPU jobs, batch inference | examples/workflow_generator_proteinfold.py + Pegasus.md "Transferring Data Directories via CondorIO" |
| Image tiling, split→parallel→merge, GPU U-Net training | examples/workflow_generator_s2_segmentation.py |
| Federated learning with SubWorkflows, FL rounds as sub-DAGs | examples/workflow_generator_medical_imaging_fl.py + examples/fl_round.py |
| Time-window splitting, parallel observation data harvesting | examples/workflow_generator_obs_harvest.py |
| Hierarchical merge tree, DAGMan rate limiting, inline submit | examples/workflow_generator_sra_search.py |
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 — local paths or direct
URLs as PFNs (a URL PFN is staged by Pegasus itself; no fetch job needed) —
or leave empty for runtime API-fetch patternscreate_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.Four errors that each shipped in a real generated workflow, every one in a generator written freehand instead of from the template. The template already avoids all four — that is the strongest reason to start from it:
from Pegasus.api import *, capital P. import pegasus does
not exist and dies at line 1 with ModuleNotFoundError.ReplicaCatalog has add_replica() but no get_replica(), and
Directory has no add_directory(). When a later job needs a file, keep a
reference to your own File object — never ask a catalog to hand one back.local and the exec
site, then register both in a single add_sites(local, exec_site) call; a
second registration of local raises DuplicateError when the generator
runs, not when it is planned.if __name__ == "__main__": main() guard on the last line of the file; a
bare main() placed above def main() dies with NameError.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.
Apptainer/{Name}_Container.defStart from assets/templates/Apptainer_template.def and customize:
python:3.8-slim (pip), mambaorg/micromamba:1.5-jammy (conda), or ubuntu:22.04 (apt+pip)export PYTHONUNBUFFERED=1 in %environmentis_stageable=False, add a %files section (bin/*.sh /usr/local/bin/) and chmod +x them in %postapptainer build {Name}_Container.sif Apptainer/{Name}_Container.def and reference the resulting .sif via file:// in workflow_generator.py's Container()README.mdStart from assets/templates/README_template.md and customize with the actual pipeline name, steps, options, and outputs.
The README must contain the exact generator invocation as a fenced bash code
block — real values, every required argument, runnable by copy-paste:
python3 workflow_generator.py --station GHCND:USW00014895 --output workflow.yml
A prose mention ("run workflow_generator.py with your station id") is not a
substitute: the fenced command is what a user copies first, and it is the only
invocation automated tooling can extract and execute. If the generator has
required arguments, this line is the difference between a workflow someone can
run and one they have to reverse-engineer.
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:
First, that every deliverable is on disk. Run ls -R on the project
directory and read the listing against this list — do not rely on remembering
what you wrote:
workflow_generator.pybin/ — one wrapper per pipeline stepApptainer/{Name}_Container.defrun_manual.sh, executableREADME.mdrun_manual.sh and README.md are the two that get skipped when the generator
and wrappers took a long time to write. A workflow missing them is one nobody
else can run or understand, so it is not finished. Create what is missing before
you reply; never describe the workflow as complete while an item is absent, and
never tell the user to add one themselves.
Then, that the code is correct:
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.def file--help works: python3 workflow_generator.py --help would produce useful outputfrom Pegasus.api import * (capital P), every method called on a catalog exists in the API (no get_* — catalogs are write-only), each site added once, and the only top-level call is the __main__ guard at the endbash blockglob(), os.listdir(), or list.files() between jobsos.getcwd(): Not __file__-relative pathsThe checklist above is you reading your own code, which is exactly the state of mind that wrote the bug. Finish by having the planner read it instead:
python3 workflow_generator.py <args> # writes workflow.yml + the catalogs
pegasus-plan --dir submit --sites condorpool --output-sites local workflow.yml
Planning is local, takes seconds, needs no container built and no pool running. It resolves every file against its producer and every transformation against its site, so it catches in one pass what no amount of re-reading does:
image_site never got setTwo of those shipped in a real workflow that passed the Step 5 checklist. The generator ran, the YAML looked right, every deliverable was on disk, and it could not be planned.
A workflow that has not been planned is not finished. If the plan fails, fix the generator (not the generated YAML — it is overwritten on the next run), regenerate, and plan again until it succeeds. Then tell the user it plans, and what the DAG contains:
Plans clean: 99 compute jobs (24 subjects x 4 steps + 3 aggregation).
If something genuinely outside the workflow blocks planning — Pegasus not installed, an input the user has not supplied yet — say plainly that it is unplanned and why, rather than reporting it as done.
For complete working examples beyond the excerpts in examples/: