원클릭으로
add-subworkflow
// Scaffold a new Bactopia subworkflow that orchestrates existing modules. Creates main.nf with GroovyDoc and test files. Use when asked to add a new subworkflow, create a subworkflow, or wire up modules into a subworkflow.
// Scaffold a new Bactopia subworkflow that orchestrates existing modules. Creates main.nf with GroovyDoc and test files. Use when asked to add a new subworkflow, create a subworkflow, or wire up modules into a subworkflow.
Scaffold a complete Bactopia Tool across all three tiers -- module, subworkflow, and workflow entry point under workflows/bactopia-tools/. Creates all files (main.nf, module.config, schema.json, nextflow.config, tests) for the common single-tool pattern. Use when asked to add a new bactopia tool, create a bactopia tool, scaffold a complete tool, add a new analysis tool to bactopia-tools, or wire up a bioconda package as a bactopia-tool. This skill handles the full pipeline from package lookup through file generation -- do not use add-module or add-subworkflow separately when the goal is a complete bactopia-tool.
Scaffold a new Bactopia module from a bioconda/conda-forge package. Creates main.nf, module.config, schema.json, and test files following project standards. Use when asked to add a new module, create a new module, scaffold module files, or add a new tool's module.
Regenerate nextflow.config and nextflow_schema.json for Bactopia workflows by running bactopia-merge-schemas. Use when asked to merge schemas, regenerate workflow config, rebuild nextflow_schema.json, or sync workflow configs after module schema changes.
Show a live snapshot of the Bactopia project state — component counts, GroovyDoc coverage, nf-test coverage, and structural issues. Use when asked about project state, coverage, what's missing, what's documented, or what needs attention.
Review citation integrity across data/citations.yml and @citation tags using bactopia-citations --validate. Detects orphan citation keys (defined in the yml but never referenced) and workflow @citation keys that don't resolve to a yml entry. Use this skill whenever the user asks to review citations, check citation integrity, audit citations.yml, find orphan citations, clean up unused citations, validate workflow @citation tags, or verify that every tool cited in a workflow has a matching entry in the citations file.
Review staleness of reference docs under .claude/docs/ using bactopia-docs --validate. Detects deprecated patterns (residue from past migrations like flattenPaths, the 4-channel emission framing, meta:Map) and ground-truth violations (stale module/subworkflow/workflow counts, wrong Nextflow version, references to nonexistent bactopia-* commands or lint rule IDs, skill-inventory drift between 06-skills.md and .claude/skills/, broken markdown link targets). Use this skill whenever the user asks to review docs, check doc staleness, audit reference docs, find outdated documentation, verify doc claims, check if docs are current, or scan .claude/docs for drift after a migration.
| name | add-subworkflow |
| description | Scaffold a new Bactopia subworkflow that orchestrates existing modules. Creates main.nf with GroovyDoc and test files. Use when asked to add a new subworkflow, create a subworkflow, or wire up modules into a subworkflow. |
Scaffold a Bactopia subworkflow that orchestrates one or more existing modules. Subworkflows are glue -- they wire modules together, aggregate results, and provide a clean interface for workflows.
modules/.claude/docs/standards/04-subworkflow-documentation.md for documentation standardsThis skill is interactive -- ask the user early and often, especially before creating files.
AskUserQuestion popups (up to 4 questions per batch).
Mark the recommended option with "(Recommended)" at the end of its label and place it first.A subworkflow is a single main.nf file plus tests:
subworkflows/{tool}/
main.nf # Workflow definition with GroovyDoc
tests/
main.nf.test # nf-test specification
main.nf.test.snap # Snapshot (generated by nf-test)
nextflow.config # Includes ALL module.configs used by this subworkflow
nf-test.config # Standard nf-test config
.nftignore # Exclude unstable files from snapshots
No module.config or schema.json -- those belong to modules only.
Goal: Determine which modules to orchestrate and how, using interactive prompts.
Important: Use the AskUserQuestion tool for structured choices throughout this phase.
Present up to 4 questions per batch. Mark the recommended option with "(Recommended)"
at the end of its label and place it first in the options list.
Ask the user which modules this subworkflow uses. Get the module paths (e.g., modules/nohuman/run, modules/mlst).
main.nf to understand its inputs and outputs.@subworkflows tag (not @modules) for those includes.Run the lookup command if package info is needed:
bash .claude/skills/add-bactopia-tool/scripts/run-bactopia-scaffold.sh lookup {package_name} --bactopia-path . --pretty
Determine the input type from the primary module's inputs, then run test-data discovery:
bash .claude/skills/add-bactopia-tool/scripts/run-bactopia-scaffold.sh test-data --input-type {input_type} --bactopia-path . --pretty
This returns species/accession combinations already used by similar modules, with
pre-computed test_data_path, test_uncompressed_path, test_species, and
test_sample_id values. Use the returned paths directly in the scaffold config
(Phase 2) -- do NOT construct paths manually. Subworkflow tests use the
compressed path (test_data_path).
Batch 1: Design choices (AskUserQuestion, up to 3 questions)
Question 1 -- Aggregation strategy:
Question 2 -- Test data species: Present top 3-4 species from the test-data discovery results. Recommend species that exercise the tool's functionality. Include the accession in each option's description.
Question 3 -- Aggregation field (if CSVTK_CONCAT or dedicated_summary selected):
Which output field should be aggregated? (e.g., tsv, report, csv)
What format? (tsv or csv)
Present the following for confirmation (derive from module main.nf and lookup):
@output GroovyDoc tags)Final confirmation (AskUserQuestion, 1 question)
After presenting the summary, ask:
Goal: Generate the 5 subworkflow files using bactopia-scaffold.
Construct the JSON config from the design decisions. Write it to /tmp/scaffold-config.json:
{
"tool": "{tool_name}",
"display_name": "{DisplayName}",
"description": "{One-sentence description}",
"process_name": "{TOOL_NAME}",
"package": "{package_name}",
"version": "{version}",
"build": "{build}",
"home_url": "{github_url}",
"input_type": "assembly",
"has_database": false,
"handles_gz": false,
"layout": "flat",
"resource_label": "process_low",
"version_command": "{version_command}",
"citation_key": "{citation_key}",
"keywords": ["{keyword1}", "{keyword2}"],
"aggregation": {
"strategy": "csvtk_concat",
"field": "{output_field}",
"format": "{tsv|csv}"
},
"outputs": [
{"name": "{field}", "extension": "{ext}", "description": "{desc}"}
],
"parameters": [],
"container_refs": {
"toolName": "{from lookup}",
"docker": "{from lookup}",
"image": "{from lookup}"
},
"test_species": "{species}",
"test_sample_id": "{sample_id}",
"test_data_path": "{compressed_path}",
"test_uncompressed_path": "{uncompressed_path}"
}
For database-dependent subworkflows, also include:
{
"database": {
"param_name": "{tool}_db",
"test_path": "datasets/{tool}/{db_file}"
}
}
Run the scaffold command:
bash .claude/skills/add-bactopia-tool/scripts/run-bactopia-scaffold.sh subworkflow --config /tmp/scaffold-config.json --bactopia-path . --pretty
The command creates 5 files:
subworkflows/{tool}/main.nfsubworkflows/{tool}/tests/main.nf.testsubworkflows/{tool}/tests/nextflow.configsubworkflows/{tool}/tests/nf-test.configsubworkflows/{tool}/tests/.nftignoreGoal: Review generated files and make tool-specific adjustments.
Subworkflow main.nf -- review and customize:
@input GroovyDoc should match the subworkflow's take channel name@subworkflows tag and adjust includes@modules tag should use underscore-delimited directory keys: csvtk_concat, {tool}Test nextflow.config -- verify it includes ALL module.configs for processes in the subworkflow:
csvtk/concat/module.config if using CSVTK_CONCATTest main.nf.test -- verify:
Run the linter to catch structural issues before proceeding:
bash .claude/skills/add-bactopia-tool/scripts/run-bactopia-lint.sh {tool} --bactopia-path .
This runs bactopia-lint scoped to the new subworkflow (and module if it exists).
Fix any FAILs before moving on. Common issues:
data/citations.ymlUpdate data/citations.yml -- add the tool citation entry in alphabetical order
(if not already present from a prior /add-module run):
{tool}:
name: "{ToolName}"
link: "{github_url}"
description: "{One-sentence description}"
cite: "{Full citation text}"
List all created files with full paths.
Remind the user to run these follow-up steps in order:
/run-tests {tool} subworkflow --generate -- generate snapshots and verify the subworkflow test passes (new subworkflows have no existing snapshots)/add-bactopia-tool if this is a standalone bactopia-toolThe --generate flag is required because newly scaffolded subworkflows have no
snapshot files yet. Without it, nf-test will fail immediately on missing
snapshots.
The scaffold generates one of three patterns based on the aggregation.strategy:
| Strategy | Pattern | Include | Emit |
|---|---|---|---|
csvtk_concat | CSVTK_CONCAT aggregation | gatherCsvtk from plugin | sample_outputs + run_outputs |
dedicated_summary | Tool's own summary command | gatherFields from plugin | sample_outputs + run_outputs |
none | No aggregation | No plugin | sample_outputs + Channel.empty() |
CSVTK_CONCAT is the default and most common (~80% of subworkflows).
Multi-module subworkflows (e.g., snippy + snpdists + gubbins): The scaffold generates a single-module pattern. For complex orchestration, generate the scaffold then manually adjust the includes and channel wiring.
Composite subworkflows that call other subworkflows: Add @subworkflows tag manually and adjust includes to point to ../../subworkflows/{name}/main instead of ../../modules/{name}/main.
Test data paths are discovered dynamically from existing module tests using:
bash .claude/skills/add-bactopia-tool/scripts/run-bactopia-scaffold.sh test-data --input-type {type} --bactopia-path . --pretty
This scans modules/*/tests/main.nf.test for paths matching the input type and returns
pre-computed template variables. Always use the discovered paths -- never construct test
data paths manually. The output includes test_data_path (compressed, for subworkflow
tests), test_uncompressed_path (for module tests), test_species, and test_sample_id.
Supported input types: assembly, reads, assembly_reads, proteins, gff, genbank.