scaffold-shiny-app
について
このスキルは、新しいShinyアプリケーションを3つのフレームワークオプションで構築します:本番用Rパッケージのgolem、企業プロジェクト向けのrhino、または迅速なプロトタイプ作成のためのvanillaです。プロジェクトの初期化を処理し、最初のモジュール構造を作成します。構造化された基盤を必要とするインタラクティブなWebアプリケーション、ダッシュボード、またはデータエクスプローラーをRで開始する際にご利用ください。
クイックインストール
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/scaffold-shiny-appこのコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします
ドキュメント
Scaffold Shiny App
Make new Shiny app with prod-ready structure. Use golem, rhino, or vanilla scaffolding.
When Use
- Start new interactive web app in R
- Make dashboard or data explorer prototype
- Set up prod Shiny app as R package (golem)
- Bootstrap enterprise Shiny project (rhino)
Inputs
- Required: App name
- Required: Framework choice (golem, rhino, vanilla)
- Optional: Module scaffolding (default: yes)
- Optional: renv for dep management (default: yes)
- Optional: Deploy target (shinyapps.io, Posit Connect, Docker)
Steps
Step 1: Choose Framework
Judge project needs to pick framework.
| Framework | Best For | Structure |
|---|---|---|
| golem | Production apps shipped as R packages | R package with DESCRIPTION, tests, vignettes |
| rhino | Enterprise apps with JS/CSS build pipeline | box modules, Sass, JS bundling, rhino::init() |
| vanilla | Quick prototypes and learning | Single app.R or ui.R/server.R pair |
Got: Clear framework decision based on scope, team needs.
If fail: Unsure? Default to golem — most structure, can simplify later. Vanilla only for throwaway prototypes.
Step 2: Scaffold Project
Golem Path
golem::create_golem("myapp", package_name = "myapp")
Creates.
myapp/
├── DESCRIPTION
├── NAMESPACE
├── R/
│ ├── app_config.R
│ ├── app_server.R
│ ├── app_ui.R
│ └── run_app.R
├── dev/
│ ├── 01_start.R
│ ├── 02_dev.R
│ ├── 03_deploy.R
│ └── run_dev.R
├── inst/
│ ├── app/www/
│ └── golem-config.yml
├── man/
├── tests/
│ ├── testthat.R
│ └── testthat/
└── vignettes/
Rhino Path
rhino::init("myapp")
Creates.
myapp/
├── app/
│ ├── js/
│ ├── logic/
│ ├── static/
│ ├── styles/
│ ├── view/
│ └── main.R
├── tests/
│ ├── cypress/
│ └── testthat/
├── .github/
├── app.R
├── dependencies.R
├── rhino.yml
└── renv.lock
Vanilla Path
Create app.R.
library(shiny)
library(bslib)
ui <- page_sidebar(
title = "My App",
sidebar = sidebar(
sliderInput("n", "Sample size", 10, 1000, 100)
),
card(
card_header("Output"),
plotOutput("plot")
)
)
server <- function(input, output, session) {
output$plot <- renderPlot({
hist(rnorm(input$n), main = "Random Normal")
})
}
shinyApp(ui, server)
Got: Project dir made with all scaffolding files.
If fail: Golem? Ensure golem package installed: install.packages("golem"). Rhino? Install from GitHub: remotes::install_github("Appsilon/rhino"). Vanilla? Ensure shiny + bslib installed.
Step 3: Configure Dependencies
Golem/Vanilla
# Initialize renv
renv::init()
# Add core dependencies
usethis::use_package("shiny")
usethis::use_package("bslib")
usethis::use_package("DT") # if using data tables
usethis::use_package("plotly") # if using interactive plots
# Snapshot
renv::snapshot()
Rhino
Deps managed in dependencies.R.
# dependencies.R
library(shiny)
library(bslib)
library(DT)
Got: All deps recorded in DESCRIPTION (golem) or dependencies.R (rhino), locked with renv.
If fail: renv::init() fails? Check write perms. Packages fail to install? Check R version compat.
Step 4: Create First Module
Golem
golem::add_module(name = "dashboard", with_test = TRUE)
Creates R/mod_dashboard.R and tests/testthat/test-mod_dashboard.R.
Rhino
Make app/view/dashboard.R.
box::use(
shiny[moduleServer, NS, tagList, h3, plotOutput, renderPlot],
)
#' @export
ui <- function(id) {
ns <- NS(id)
tagList(
h3("Dashboard"),
plotOutput(ns("plot"))
)
}
#' @export
server <- function(id) {
moduleServer(id, function(input, output, session) {
output$plot <- renderPlot({
plot(1:10)
})
})
}
Vanilla
Add module functions to separate file R/mod_dashboard.R.
dashboardUI <- function(id) {
ns <- NS(id)
tagList(
h3("Dashboard"),
plotOutput(ns("plot"))
)
}
dashboardServer <- function(id) {
moduleServer(id, function(input, output, session) {
output$plot <- renderPlot({
plot(1:10)
})
})
}
Got: Module file made with UI + server functions using proper namespacing.
If fail: Ensure module uses NS(id) for all input/output IDs in UI function. Without namespacing, IDs collide when module used multiple times.
Step 5: Run Application
# Golem
golem::run_dev()
# Rhino
shiny::runApp()
# Vanilla
shiny::runApp("app.R")
Got: App launches in browser without errors.
If fail: Check R console for error msgs. Common: missing packages (install), port in use (specify different port port = 3839), syntax errors in UI/server.
Checks
- App dir has correct structure for chosen framework
-
shiny::runApp()launches without errors - At least one module scaffolded with UI + server functions
- Deps recorded (DESCRIPTION or dependencies.R)
- renv.lock captures all package versions
- Module uses
NS(id)for proper namespace isolation
Pitfalls
- Choose vanilla for prod: Vanilla lacks testing, docs, deploy tooling. Use golem or rhino for anything beyond prototypes.
- Missing namespace in modules: Every
inputIdandoutputIdin module UI must be wrapped withns(). Forget = silent ID collisions. - golem without devtools workflow: golem apps are R packages. Use
devtools::load_all(),devtools::test(),devtools::document()— notsource(). - rhino without box: rhino uses box for module imports. Do not fall back to
library()calls — usebox::use()for explicit imports.
See Also
build-shiny-module— make reusable Shiny modules with proper namespace isolationtest-shiny-app— set up shinytest2 and testServer() testsdeploy-shiny-app— deploy to shinyapps.io, Posit Connect, Dockerdesign-shiny-ui— bslib theming + responsive layout designcreate-r-package— R package scaffolding (golem apps are R packages)manage-renv-dependencies— detailed renv dep management
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を選択してください。
