本文へ移動
cccskills
無料GitHub で公開

build-parameterized-report

Create parameterized Quarto or R Markdown reports that can be rendered with different inputs to generate multiple variations. Covers parameter definitions, programmatic rendering, and batch generation. Use when generating the same report for different departments, regions, or time periods; creating client-specific reports from a single template; building dashboards that filter to specific subsets; or automating recurring reports with varying inputs.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md6.7 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Build Parameterized Report

Create reports that accept parameters to generate multiple customized variations from a single template.

When to Use

  • Generating the same report for different departments, regions, or time periods
  • Creating client-specific reports from a template
  • Building dashboards that filter to specific subsets
  • Automating recurring reports with different inputs

Inputs

  • Required: Report template (Quarto or R Markdown)
  • Required: Parameter definitions (names, types, defaults)
  • Optional: List of parameter values for batch generation
  • Optional: Output directory for generated reports

Procedure

Step 1: Define Parameters in YAML

For Quarto (report.qmd):

---
title: "Sales Report: `r params$region`"
params:
  region: "North America"
  year: 2025
  include_forecast: true
format:
  html:
    toc: true
---

For R Markdown (report.Rmd):

---
title: "Sales Report"
params:
  region: "North America"
  year: 2025
  include_forecast: true
output: html_document
---

Expected: The YAML header contains a params: block with named parameters, each having a default value of the correct type.

On failure: If rendering fails with "object 'params' not found", ensure the params: block is correctly indented under the YAML frontmatter. For Quarto, params must be at the top level of the YAML, not nested under format:.

Step 2: Use Parameters in Code

```{r}
#| label: filter-data

data <- full_dataset |>
  filter(region == params$region, year == params$year)

nrow(data)
```

## Overview for `r params$region`

This report covers the `r params$region` region for `r params$year`.

```{r}
#| label: forecast
#| eval: !expr params$include_forecast

# This chunk only runs when include_forecast is TRUE
forecast_model <- forecast::auto.arima(data$sales)
forecast::autoplot(forecast_model)
```

Expected: Code chunks reference parameters via params$name and conditional chunks use #| eval: !expr params$flag for Quarto. Inline R expressions like `r params$region` render dynamic text.

On failure: If params$name returns NULL, verify the parameter name matches exactly between the YAML definition and the code reference (case-sensitive). Check that default values are the correct type.

Step 3: Render with Custom Parameters

Single render:

# Quarto
quarto::quarto_render(
  "report.qmd",
  execute_params = list(region = "Europe", year = 2025)
)

# R Markdown
rmarkdown::render(
  "report.Rmd",
  params = list(region = "Europe", year = 2025),
  output_file = "report-europe-2025.html"
)

Expected: A single report renders successfully with custom parameter values overriding the YAML defaults. The output file is created at the specified path.

On failure: If Quarto render fails, check that quarto CLI is installed and on PATH. If R Markdown render fails, verify rmarkdown is installed. Ensure parameter names in execute_params (Quarto) or params (R Markdown) match the YAML definitions exactly.

Step 4: Batch Render Multiple Reports

regions <- c("North America", "Europe", "Asia Pacific", "Latin America")
years <- c(2024, 2025)

# Generate all combinations
combinations <- expand.grid(region = regions, year = years, stringsAsFactors = FALSE)

# Render each
purrr::pwalk(combinations, function(region, year) {
  output_name <- sprintf("report-%s-%d.html",
    tolower(gsub(" ", "-", region)), year)

  quarto::quarto_render(
    "report.qmd",
    execute_params = list(region = region, year = year),
    output_file = output_name
  )
})

Expected: One HTML file per region-year combination.

On failure: Check that parameter names match exactly between YAML and code. Ensure all parameter values are valid.

Step 5: Add Parameter Validation

#| label: validate-params

stopifnot(
  "Region must be a valid region" = params$region %in% valid_regions,
  "Year must be numeric" = is.numeric(params$year),
  "Year must be reasonable" = params$year >= 2020 && params$year <= 2030
)

Expected: The validation code chunk runs at the start of each render and stops with an informative error if any parameter is out of range or the wrong type.

On failure: If stopifnot() produces unhelpful error messages, switch to explicit if (!cond) stop("message") calls for clearer diagnostics.

Step 6: Organize Output

# Create output directory
output_dir <- file.path("reports", format(Sys.Date(), "%Y-%m"))
dir.create(output_dir, recursive = TRUE, showWarnings = FALSE)

# Render with output path
quarto::quarto_render(
  "report.qmd",
  execute_params = list(region = region),
  output_file = file.path(output_dir, paste0("report-", region, ".html"))
)

Expected: Output files are written to a date-stamped subdirectory with descriptive names (e.g., reports/2025-06/report-europe.html).

On failure: If dir.create() fails, check that the parent directory exists and is writable. On Windows, verify the path length does not exceed 260 characters.

Validation

  • Report renders with default parameters
  • Report renders with each set of custom parameters
  • Parameters are validated before processing
  • Output files are named descriptively
  • Conditional sections render correctly based on parameters
  • Batch generation completes for all combinations

Common Pitfalls

  • Parameter name mismatch: YAML names must exactly match params$name references in code
  • Type coercion: YAML may parse year: 2025 as integer but code expects character. Be explicit.
  • Conditional evaluation: Use #| eval: !expr params$flag not eval = params$flag in Quarto
  • File overwriting: Without unique output names, each render overwrites the previous
  • Memory in batch mode: Long batch runs may accumulate memory. Consider using callr::r() for isolation.

Related Skills

  • create-quarto-report - base Quarto document setup
  • generate-statistical-tables - tables that adapt to parameters
  • format-apa-report - parameterized academic reports

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Execute structural metamorphosis using strangler fig migration, chrysalis phases, and interface preservation. Covers transformation planning, parallel running, progressive cutover, rollback design, and post-metamorphosis stabilization for system architecture evolution. Use when assess-form has classified the system as READY for transformation, when migrating from monolith to microservices, when replacing a core subsystem while dependents continue operating, or when any architectural change must be gradual rather than big-bang.

日本語の概要は準備中です。原文の説明を表示しています。

pjt222/agent-almanac372026年10月12日 更新

adaptic

無料

Master skill composing the 5-step synoptic cycle for panoramic synthesis across multiple domains. Orchestrates meditate, expand-awareness, observe, awareness, integrate-gestalt, and express-insight into a coherent process that produces unified understanding rather than sequential compromise. Use when a problem genuinely spans 3+ domains and the interactions between domains matter more than depth in any one, when sequential analysis feels like compromise rather than integration, or before major architectural decisions affecting multiple stakeholders.

日本語の概要は準備中です。原文の説明を表示しています。

pjt222/agent-almanac372026年10月12日 更新

Scaffold a new puzzle type across all 10+ pipeline integration points in jigsawR. Creates the core puzzle module, wires it into the unified pipeline (generation, positioning, rendering, adjacency), adds ggpuzzle geom/stat layers, updates DESCRIPTION and config.yml, extends the Shiny app, and creates a comprehensive test suite. Use when adding a completely new puzzle type to the package or following the 10-point integration checklist to ensure nothing is missed end-to-end.

日本語の概要は準備中です。原文の説明を表示しています。

pjt222/agent-almanac372026年10月12日 更新

Add Rcpp or RcppArmadillo integration to an R package for high-performance C++ code. Covers setup, writing C++ functions, RcppExports generation, testing compiled code, and debugging. Use when an R function is too slow and profiling confirms a bottleneck, when you need to interface with existing C/C++ libraries, or when implementing algorithms (loops, recursion, linear algebra) that benefit from compiled code.

日本語の概要は準備中です。原文の説明を表示しています。

pjt222/agent-almanac372026年10月12日 更新

aikido

無料

Practice aikido as a defensive martial art emphasizing harmony, redirection, and controlled resolution. Covers centering and grounding, ukemi (safe falling and rolling), core techniques (irimi-nage, shiho-nage, kote-gaeshi, ikkyo), blending and tai sabaki (body movement), randori (multiple attacker practice), weapons awareness, and applying principles off the mat. Use when learning a defensive martial art that prioritizes de-escalation, developing the ability to redirect aggression without causing unnecessary harm, building safe falling skills, or cultivating calm centeredness under physical pressure.

日本語の概要は準備中です。原文の説明を表示しています。

pjt222/agent-almanac372026年10月12日 更新

Analyze an arbitrary codebase to identify functions, APIs, and data sources suitable for exposure as MCP tools, producing a tool specification document. Use when planning an MCP server for an existing project, auditing a codebase before wrapping it as an AI-accessible tool surface, comparing what a codebase can do versus what is already exposed via MCP, or generating a tool spec to hand off to scaffold-mcp-server.

日本語の概要は準備中です。原文の説明を表示しています。

pjt222/agent-almanac372026年10月12日 更新

pjt222 のスキルをすべて見る

このスキルの問題を報告する