Golem add module

From ThinkR-open/golem · View interactive version

Golem add module is an AI agent skill from the GitHub repository ThinkR-open/golem. Add a module to an existing golem Shiny application. Triggers on: - "add a module" - "create a module" - "add a golem module" Do not trigger on: - when the user is not working inside a golem app

How to use this skill

Skill file

Add Module

You are helping a user add a new module to an existing golem Shiny application.

Creating a Module

Use golem::add_module("name", with_test = TRUE) to create a new module with proper structure.

Module Structure

A golem module consists of:

Important Rules

UI Functions

Server Functions

Example pattern:

mod_<name>_server <- function(id) {
  moduleServer(id, function(input, output, session) {
    local_rv <- reactiveValues()
    
    observeEvent(
      input$btn,
      {
        local_rv$value <- compute_things(input$btn)
      }
    )
    
    output$plot <- renderPlot({
      local_rv$value
    })
  })
}

Reactive Programming Rules

Testing

Next Steps

After adding the module:

  1. Edit the module files to add your UI and server logic
  2. Run devtools::document() if you added roxygen comments
  3. Add the module to your app UI in app_ui.R
  4. Call it in app_server() with mod_<name>_server("module_id")
  5. Run tests with devtools::test()
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.