build-shiny-modulelisted
Install: claude install-skill pjt222/agent-almanac
# Build Shiny Module
Create reusable Shiny UI/server module pairs with proper namespace isolation, reactive communication, and composability.
## When to Use
- Extracting a reusable component from a growing Shiny app
- Building a UI widget that will be used in multiple places
- Encapsulating complex reactive logic behind a clean interface
- Composing larger applications from smaller, testable units
## Inputs
- **Required**: Module purpose and functionality description
- **Required**: Input/output contract (what the module receives and returns)
- **Optional**: Whether the module nests other modules (default: no)
- **Optional**: Framework context (golem, rhino, or vanilla)
## Procedure
### Step 1: Define the Module Interface
Before writing code, define what the module accepts and returns:
```text
Module: data_filter
Inputs: reactive dataset, column names to filter on
Outputs: reactive filtered dataset
UI: filter controls (selectInput, sliderInput, dateRangeInput)
```
**Got:** Clear contract specifying reactive inputs, reactive outputs, and UI elements.
**If fail:** If the interface is unclear, the module is probably too broad. Split it into smaller modules with single responsibilities.
### Step 2: Create the Module UI Function
```r
#' Data Filter Module UI
#'
#' @param id Module namespace ID
#' @return A tagList of filter controls
#' @export
dataFilterUI <- function(id) {
ns <- NS(id)
tagList(
selectInput(
ns("column"),
"Filter column",
cho