targets-pipelines
БесплатноБез исполняемых скриптовНе проверенUse when writing complex targets pipelines with branching, batching, or custom target factories. Symptoms: multiple similar targets, parameter sweeps, method…
от jsperger★ 17 звёзд на GitHubОб этом скилле
Complex targets Pipelines
Branching creates multiple targets from a single definition. Choose your approach based on when iterations are known and what naming you need.
Quick Reference
| Task | Approach | Key Function/Pattern |
|---|---|---|
| Variants from known parameters | Static | tarchetypes::tar_map() |
| Aggregate static variants | Static | tarchetypes::tar_combine() |
| Runtime-determined iterations | Dynamic | pattern = map(x) |
| All combinations (cartesian) | Dynamic | pattern = cross(x, y) |
| Batched simulation reps | Dynamic | tarchetypes::tar_rep() |
| Static variants + batched reps | Hybrid | tarchetypes::tar_map_rep() |
| Branch over row groups | Dynamic | tarchetypes::tar_group_by() |
| Reusable multi-target pattern | Factory | Custom function + tar_target_raw() |
Decision Tree
Need multiple similar targets?
│
├─ NO ──► Single target, or consider a target factory
│ for reusable patterns
│
└─ YES ─► Iterations known before tar_make()?
│
├─ NO ──► DYNAMIC BRANCHING
│ pattern = map() / cross()
│ → topic-dynamic-branching.md
│
└─ YES ─► Need friendly target names in DAG?
│
├─ YES ──► STATIC BRANCHING
│ tarchetypes::tar_map()
│ → topic-static-branching.md
│
└─ NO ───► Either works; prefer dynamic
for simplicity at scale
Additional decisions:
Static variants + many replications?
└─► HYBRID: tarchetypes::tar_map_rep()
→ topic-hybrid-branching.md
Encapsulating a reusable multi-target pattern?
└─► TARGET FACTORY: tar_target_raw()
→ topic-target-factories.md
Approach Comparison
| Aspect | Static | Dynamic | Hybrid |
|---|---|---|---|
| When defined | Before tar_make() |
During tar_make() |
Both |
| Target names | Friendly (analysis_bayesian) |
Hashed (analysis_3a7f2b) |
Mixed |
| Scale | <1000 targets | 100k+ targets | Moderate |
| Validation | Full tar_manifest() |
Must run to see branches | Partial |
| Use case | Method comparison | Simulations, file processing | Methods x replications |
Static Branching Overview
Use tarchetypes::tar_map() when iterations are known at define-time and you want readable target names.
values <- tibble::tibble(
method = rlang::syms(c("analyze_bayesian", "analyze_freq")),
method_name = c("bayesian", "freq")
)
tarchetypes::tar_map(
values = values,
names = "method_name",
targets::tar_target(result, method(data)),
targets::tar_target(summary, summarize_result(result))
)
# Creates: result_bayesian, result_freq, summary_bayesian, summary_freq
Aggregate with tarchetypes::tar_combine():
mapped <- tarchetypes::tar_map(
unlist = FALSE,
values = values,
targets::tar_target(result, method(data))
)
tarchetypes::tar_combine(
all_results,
mapped"result",
command = dplyr::bind_rows(!!!.x, .id = "method")
)
Key points:
- Function names must be symbols: use
rlang::syms(), not strings - Use
unlist = FALSEwhen you needtar_combine()afterward !!!.xsplices the list of upstream results into the command
See topic-static-branching.md for details on tar_eval(), tar_sub(), and complex value construction.
Dynamic Branching Overview
Use the pattern argument when branch count depends on data or you need massive scale.
list(
targets::tar_target(datasets, c("trial_A", "trial_B", "trial_C")),
targets::tar_target(
analysis,
analyze_data(datasets),
pattern = map(datasets)
)
)
Pattern types:
map(x, y)- parallel iteration (zip)cross(x, y)- cartesian productslice(x, index = c(1, 3))- specific elementshead(x, n = 5)/tail()/sample()- subsets
Critical: Patterns reference target names, not R objects or expressions.
# WRONG: Can't reference external objects
my_vec <- 1:5
targets::tar_target(x, process(my_vec), pattern = map(my_vec))
# CORRECT: Reference upstream target by name
list(
targets::tar_target(params, 1:5),
targets::tar_target(result, process(params), pattern = map(params))
)
See topic-dynamic-branching.md for iteration modes, row grouping, and batching.
Hybrid Patterns Overview
Combine static branching (for methods/variants) with dynamic branching (for replications):
values <- tibble::tibble(
method = rlang::syms(c("method_a", "method_b")),
method_name = c("a", "b")
)
tarchetypes::tar_map_rep(
name = sim_result,
command = method(simulate_data()),
values = values,
names = "method_name",
batches = 10,
reps = 100
)
See topic-hybrid-branching.md for complete patterns.
Target Factories Overview
A target factory is a function that returns pr
Установить targets-pipelines в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл targets-pipelines?
Use when writing complex targets pipelines with branching, batching, or custom target factories. Symptoms: multiple similar targets, parameter sweeps, method comparisons, simulation studies. Covers: static branching (tar_map/tar_combine), dynamic branching (pattern argument), hybrid patterns, custom target factories, pipeline debugging. Does NOT cover: basic targets usage, HPC deployment, package development workflows (see targetopia-packages.md).
Как установить скилл targets-pipelines?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл targets-pipelines запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic