r-pipeline-patterns

Defines targets pipeline patterns, branching, and reproducibility conventions for R projects.

Updated Jul 29, 2026
One-click install
npx skills add https://github.com/chris-prener/dev-kit --skill r-pipeline-patterns-chris-prener
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: r-pipeline-patterns
Source: https://github.com/chris-prener/dev-kit/tree/main/dev-kit/skills/r-pipeline-patterns
Command: npx skills add https://github.com/chris-prener/dev-kit --skill r-pipeline-patterns-chris-prener

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building reproducible data pipelines in R requires consistent structure, dependency tracking, and caching conventions that are easy to get wrong. This Skill encodes targets framework best practices so pipelines are deterministic, cacheable, and debuggable from the start. ## Core Features & Use Cases - Pipeline Structure: Standard file layout with a single _targets.R entry point and function files organized under R/functions/. - Function-Based Design: Enforces pure, roxygen2-documented functions where every target wraps exactly one function. - Branching Patterns: Covers static branching, dynamic branching with map(), and cross patterns for combinatorial workflows. - Reproducibility Contracts: Format selection guidance (qs, parquet, file, rds), invalidation rules, and error handling with workspace debugging. - Use Case: You need to build a pipeline that ingests CSV files, transforms them, validates output, and writes a parquet dataset. This Skill produces the _targets.R definition and function files so tar_make() runs cleanly and only recomputes outdated targets. ## Quick Start Ask Claude to create a targets pipeline that ingests your raw data files, transforms them, and writes a validated output dataset.

Frequently Asked Questions about r-pipeline-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a targets pipeline in R?▼

Create a `_targets.R` file that sources functions from `R/functions/`, sets options with `tar_option_set()`, and defines targets with `tar_target()`. Run the pipeline with `targets::tar_make()`, which only recomputes outdated targets.

What is the difference between static and dynamic branching in targets?▼

Static branching maps over inputs known at definition time, such as a list of files. Dynamic branching uses `pattern = map()` over values discovered at runtime, such as unique groups found in the data during execution.

Which format should I use for targets in R?▼

Use `qs` as the default for R objects since it is fast and compact. Choose `parquet` for tabular data shared across tools, `file` for external outputs like plots, and `rds` as a fallback for complex R objects.

How do I debug a failed targets pipeline?▼

Set `workspace_on_error = TRUE` in `tar_option_set()`, then call `targets::tar_workspace(failed_target_name)` after the failure. This loads the target's dependencies into your session for interactive debugging.

When should I not use the targets framework?▼

This Skill covers targets exclusively and does not apply to drake, its deprecated predecessor. Data validation logic, data I/O patterns, and CI execution of pipelines are handled by separate skills rather than pipeline definition itself.