npx claudepluginhub pjt222/agent-almanacThis skill uses the workspace's default tool permissions.
---
Generates code, configurations, and guidance for report templates in data analytics, including SQL queries, data visualization, statistical analysis, and BI. Activates on 'report template generator' or 'report' phrases.
Generates markdown and HTML reports from data with charts, tables, analysis, summaries, and recommendations. Handles CSV/JSON inputs; supports PDF export and comparisons.
Share bugs, ideas, or general feedback.
Create reports that accept parameters to generate multiple customized variations from a single template.
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:.
```{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.
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.
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.
#| 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.
# 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.
params$name references in codeyear: 2025 as integer but code expects character. Be explicit.#| eval: !expr params$flag not eval = params$flag in Quartocallr::r() for isolation.create-quarto-report - base Quarto document setupgenerate-statistical-tables - tables that adapt to parametersformat-apa-report - parameterized academic reports