build-parameterized-report
について
このスキルは、開発者が単一のテンプレートから複数のカスタマイズされたバリエーションを生成するパラメータ化されたQuartoまたはR Markdownレポートを作成できるようにします。パラメータの定義、プログラムによるレンダリング、および異なる部門、クライアント、またはデータサブセットにわたるレポート自動化のためのバッチ生成をカバーしています。様々な入力で定期的な、クライアント固有の、またはフィルタリングされたレポートを効率的に作成するためにご利用ください。
クイックインストール
Claude Code
推奨npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/build-parameterized-reportこのコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします
ドキュメント
Build Parameterized Report
Reports that accept params → many customized variations from single template.
Use When
- Same report for diff depts, regions, time periods
- Client-specific reports from template
- Dashboards filtered to specific subsets
- Recurring reports w/ diff ins
In
- Required: Report template (Quarto or R Markdown)
- Required: Param defs (names, types, defaults)
- Optional: Param values list for batch
- Optional: Out dir for generated reports
Do
Step 1: Define Params in YAML
Quarto (report.qmd):
---
title: "Sales Report: `r params$region`"
params:
region: "North America"
year: 2025
include_forecast: true
format:
html:
toc: true
---
R Markdown (report.Rmd):
---
title: "Sales Report"
params:
region: "North America"
year: 2025
include_forecast: true
output: html_document
---
→ YAML header has params: block w/ named params, each w/ default of correct type.
If err: Render fails w/ "object 'params' not found" → ensure params: block indented correctly under YAML frontmatter. Quarto: params at top level, not nested under format:.
Step 2: Use Params 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)
```
→ Chunks ref params via params$name, conditional chunks use #| eval: !expr params$flag for Quarto. Inline R expressions like `r params$region` render dynamic text.
If err: params$name returns NULL → verify name matches exactly YAML ↔ code ref (case-sensitive). Check default values correct type.
Step 3: Render w/ Custom Params
Single:
# 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"
)
→ Single report renders w/ custom params overriding YAML defaults. Out file at specified path.
If err: Quarto fails → check quarto CLI installed + on PATH. R Markdown fails → verify rmarkdown installed. Param names in execute_params (Quarto) or params (R Markdown) match YAML defs exactly.
Step 4: Batch Render
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
)
})
→ One HTML per region-year combination.
If err: Check param names match exactly YAML ↔ code. Ensure all values valid.
Step 5: Param 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
)
→ Validation chunk runs at start of each render, stops w/ informative err if param out of range or wrong type.
If err: stopifnot() unhelpful msgs → switch to explicit if (!cond) stop("message") for clearer diagnostics.
Step 6: Organize Out
# 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"))
)
→ Out files to date-stamped subdir w/ descriptive names (e.g., reports/2025-06/report-europe.html).
If err: dir.create() fails → check parent dir exists + writable. Windows: verify path length ≤ 260 chars.
Check
- Renders w/ default params
- Renders w/ each custom set
- Params validated before processing
- Out files named descriptively
- Conditional sections render based on params
- Batch completes for all combinations
Traps
- Name mismatch: YAML names must exactly match
params$namein code - Type coercion: YAML may parse
year: 2025as int but code expects char. Be explicit - Conditional eval: Use
#| eval: !expr params$flagnoteval = params$flagin Quarto - File overwriting: No unique names → each render overwrites prev
- Memory in batch: Long batches accumulate mem. Use
callr::r()for isolation
→
create-quarto-report— base Quarto doc setupgenerate-statistical-tables— tables that adapt to paramsformat-apa-report— parameterized academic reports
GitHub リポジトリ
関連スキル
content-collections
メタこのスキルは、Content Collections(Markdown/MDXファイルを型安全なデータコレクションに変換するTypeScriptファーストのツール)の本番環境でテストされた設定を提供します。Zodバリデーションによる型安全性を実現し、ブログ、ドキュメントサイト、コンテンツ重視のVite + Reactアプリケーション構築時にご利用ください。Viteプラグインの設定、MDXコンパイルから、デプロイ最適化、スキーマバリデーションまで、すべてを網羅しています。
polymarket
メタこのスキルは、開発者がPolymarket予測市場プラットフォームを活用したアプリケーション構築を可能にします。API統合による取引や市場データの取得に加え、WebSocketを介したリアルタイムデータストリーミングにより、ライブ取引や市場活動を監視できます。取引戦略の実装や、ライブ市場更新を処理するツールの作成にご利用ください。
creating-opencode-plugins
メタこのスキルは、開発者がコマンド、ファイル、LSP操作など25種類以上のイベントタイプにフックするOpenCodeプラグインを作成することを支援します。JavaScript/TypeScriptモジュール向けに、プラグイン構造、イベントAPI仕様、および実装パターンを提供します。カスタムイベント駆動ロジックでOpenCode AIアシスタントのライフサイクルをインターセプト、監視、または拡張する必要がある場合にご利用ください。
sglang
メタSGLangは、高性能なLLMサービングフレームワークであり、RadixAttentionプレフィックスキャッシュを活用したJSON、正規表現、エージェントワークフロー向けの高速で構造化された生成を特長とします。特にプレフィックスが繰り返されるタスクにおいて、大幅に高速な推論を実現し、複雑な構造化出力やマルチターン対話に最適です。制約付きデコードが必要な場合や、広範なプレフィックス共有を伴うアプリケーションを構築する場合は、vLLMなどの代替案ではなくSGLangを選択してください。
