정보
이 Claude Skill은 golem(프로덕션 패키지), rhino(엔터프라이즈) 또는 vanilla(신속한 프로토타입) 프레임워크를 사용하여 R에서 새로운 Shiny 애플리케이션의 기본 구조를 생성합니다. 프로젝트 초기화를 처리하고 첫 번째 모듈을 만들어주므로, 인터랙티브 웹 앱 시작, 대시보드 프로토타입 제작 또는 프로덕션 준비가 완료된 Shiny 프로젝트 설정에 이상적입니다. 개발자는 적절한 구조와 선택적 종속성 관리를 통해 프로젝트를 신속하게 부트스트랩할 수 있습니다.
빠른 설치
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-appClaude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요
문서
name: scaffold-shiny-app description: > 使用 golem(生产 R 包)、rhino(企业级)或 vanilla(快速原型)结构搭建新的 Shiny 应用程序。涵盖框架选择、项目初始化及第一个模块创建。适用于在 R 中 启动新的交互式 Web 应用、创建仪表盘或数据探索器原型、将生产 Shiny 应用 以 golem 方式设置为 R 包,或用 rhino 引导企业级 Shiny 项目。 license: MIT allowed-tools: Read Write Edit Bash Grep Glob metadata: author: Philipp Thoss version: "1.0" domain: shiny complexity: basic language: R tags: shiny, golem, rhino, scaffold, web-app, reactive locale: zh-CN source_locale: en source_commit: 6f65f316 translator: claude-opus-4-6 translation_date: 2026-03-16
搭建 Shiny 应用
使用 golem、rhino 或 vanilla 脚手架创建具有生产就绪结构的新 Shiny 应用程序。
适用场景
- 在 R 中启动新的交互式 Web 应用
- 创建仪表盘或数据探索器原型
- 将生产 Shiny 应用设置为 R 包(golem)
- 引导企业级 Shiny 项目(rhino)
输入
- 必需:应用名称
- 必需:框架选择(golem、rhino 或 vanilla)
- 可选:是否包含模块脚手架(默认:是)
- 可选:是否使用 renv 进行依赖管理(默认:是)
- 可选:部署目标(shinyapps.io、Posit Connect、Docker)
步骤
第 1 步:选择框架
根据项目需求评估并选择合适的框架:
| 框架 | 最适用于 | 结构 |
|---|---|---|
| golem | 以 R 包形式交付的生产应用 | 包含 DESCRIPTION、测试、vignette 的 R 包 |
| rhino | 带 JS/CSS 构建管道的企业应用 | box 模块、Sass、JS 打包、rhino::init() |
| vanilla | 快速原型和学习 | 单个 app.R 或 ui.R/server.R 对 |
预期结果: 基于项目范围和团队需求做出明确的框架决策。
失败处理: 如果不确定,默认选择 golem——它提供最多结构,后期可简化。vanilla 仅适用于一次性原型。
第 2 步:搭建项目
Golem 路径
golem::create_golem("myapp", package_name = "myapp")
这会创建:
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 路径
rhino::init("myapp")
这会创建:
myapp/
├── app/
│ ├── js/
│ ├── logic/
│ ├── static/
│ ├── styles/
│ ├── view/
│ └── main.R
├── tests/
│ ├── cypress/
│ └── testthat/
├── .github/
├── app.R
├── dependencies.R
├── rhino.yml
└── renv.lock
Vanilla 路径
创建 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)
预期结果: 项目目录已创建,包含所有脚手架文件。
失败处理: 对于 golem,确保已安装 golem 包:install.packages("golem")。对于 rhino,从 GitHub 安装:remotes::install_github("Appsilon/rhino")。对于 vanilla,确保 shiny 和 bslib 已安装。
第 3 步:配置依赖项
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
依赖项在 dependencies.R 中管理:
# dependencies.R
library(shiny)
library(bslib)
library(DT)
预期结果: 所有依赖项记录在 DESCRIPTION(golem)或 dependencies.R(rhino)中,并用 renv 锁定。
失败处理: 如果 renv::init() 失败,检查写入权限。如果包安装失败,检查 R 版本兼容性。
第 4 步:创建第一个模块
Golem
golem::add_module(name = "dashboard", with_test = TRUE)
这会创建 R/mod_dashboard.R 和 tests/testthat/test-mod_dashboard.R。
Rhino
创建 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
将模块函数添加到单独的文件 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)
})
})
}
预期结果: 模块文件已创建,包含使用正确命名空间的 UI 和 server 函数。
失败处理: 确保模块在 UI 函数中使用 NS(id) 处理所有输入/输出 ID。如果没有命名空间,多次使用该模块时 ID 会冲突。
第 5 步:运行应用程序
# Golem
golem::run_dev()
# Rhino
shiny::runApp()
# Vanilla
shiny::runApp("app.R")
预期结果: 应用程序在浏览器中启动,无错误。
失败处理: 检查 R 控制台中的错误消息。常见问题:缺少包(安装它们)、端口已被占用(用 port = 3839 指定不同端口),或 UI/server 代码中存在语法错误。
验证清单
- 应用目录具有所选框架的正确结构
-
shiny::runApp()启动无错误 - 至少搭建了一个具有 UI 和 server 函数的模块
- 依赖项已记录(DESCRIPTION 或 dependencies.R)
- renv.lock 捕获所有包版本
- 模块使用
NS(id)进行正确的命名空间隔离
常见问题
- 为生产环境选择 vanilla:vanilla 结构缺乏测试基础设施、文档和部署工具。原型之外的任何项目都应使用 golem 或 rhino。
- 模块中缺少命名空间:模块 UI 中的每个
inputId和outputId都必须用ns()包裹。遗漏会导致静默的 ID 冲突。 - golem 缺少 devtools 工作流:golem 应用是 R 包。使用
devtools::load_all()、devtools::test()和devtools::document()——而非source()。 - rhino 不使用 box:rhino 使用 box 进行模块导入。不要回退到
library()调用——使用box::use()进行显式导入。
相关技能
build-shiny-module— 创建具有正确命名空间隔离的可复用 Shiny 模块test-shiny-app— 设置 shinytest2 和 testServer() 测试deploy-shiny-app— 部署到 shinyapps.io、Posit Connect 或 Dockerdesign-shiny-ui— bslib 主题和响应式布局设计create-r-package— R 包脚手架(golem 应用是 R 包)manage-renv-dependencies— 详细的 renv 依赖管理
GitHub 저장소
Frequently asked questions
What is the scaffold-shiny-app skill?
scaffold-shiny-app is a Claude Skill by pjt222. Skills package instructions and resources that Claude loads on demand, so Claude can perform scaffold-shiny-app-related tasks without extra prompting.
How do I install scaffold-shiny-app?
Use the install commands on this page: add scaffold-shiny-app to Claude Code as a plugin, or clone its repository into your skills directory, then restart Claude so it picks up the skill.
What category does scaffold-shiny-app belong to?
scaffold-shiny-app is in the Other category, tagged general.
Is scaffold-shiny-app free to use?
Yes. scaffold-shiny-app is listed on AIMCP and free to install. It runs inside Claude, so no separate service account is required to use the skill itself.
연관 스킬
LlamaGuard는 폭력 및 혐오 발언 등 6가지 안전 범주에서 LLM 입력과 출력을 조정하기 위한 Meta의 70-80억 파라미터 모델입니다. 94-95% 정확도를 제공하며 vLLM, Hugging Face 또는 Amazon SageMaker를 사용해 배포할 수 있습니다. 이 기술을 사용하여 AI 애플리케이션에 콘텐츠 필터링 및 안전 가드레일을 손쉽게 통합하세요.
이 Claude Skill은 리소스 적정화, 태깅 전략, 지출 분석을 통해 개발자들이 클라우드 비용을 최적화할 수 있도록 지원합니다. AWS, Azure, GCP에서 클라우드 비용을 절감하고 비용 거버넌스를 구현하기 위한 프레임워크를 제공합니다. 인프라 비용을 분석하거나, 리소스를 적정화하거나, 예산 제약을 충족해야 할 때 사용하세요.
이 Claude Skill은 스프레드, 오버/언더, 프로프 베트를 포함한 스포츠 베팅 시장을 분석합니다. 역사적 추이와 상황별 통계를 검토하여 가치 베트를 발견하고, 교육적 목적으로 실행 가능한 권장 사항이 담긴 구조화된 마크다운 결과를 제공합니다. 개발자는 이 기능을 스포츠 베팅 분석 도구에 활용할 수 있으며, 단순히 엔터테인먼트/교육 목적으로만 설계되었음을 유의해야 합니다.
이 스킬은 bitsandbytes를 사용하여 LLM을 8비트 또는 4비트 정밀도로 양자화하며, 최소한의 정확도 손실로 50-75%의 메모리 감소를 달성합니다. 제한된 GPU 메모리에서 더 큰 모델을 실행하거나 추론을 가속화하는 데 이상적이며, INT8, NF4, FP4와 같은 형식을 지원합니다. 이 스킬은 HuggingFace Transformers와 통합되어 QLoRA 학습 및 8비트 옵티마이저를 가능하게 합니다.
