cran/golem/golem-add-function
Claude Code and agent skill by cran/golem
- community
Checking that the SKILL.md file is still in the repository.
Add functions to a golem Shiny application. Triggers on: - "add a function" - "create a helper function" - "add a utility function" Do not trigger on: - when the user is not working inside a golem app
Install
npx vskill@latest install cran/golem/golem-add-functionSKILL.md
The same SKILL.md was published earlier as thinkr-open/golem-agent-skills/golem-add-function.
Add Function
You are helping a user add functions to their golem Shiny application.
Creating Functions
Use the appropriate golem::add_*() function based on where the code belongs:
golem::add_fct("name", with_test = TRUE)- Business logic and factory functionsgolem::add_utils("name", with_test = TRUE)- Utility functions
Function Types
Factory Functions (R/fct_*.R)
- Contain business logic that can be reused
- Should be testable in isolation, outside of Shiny context
- Example: data processing, calculations, validations
- Created with
golem::add_fct()
Utility Functions (R/utils_*.R)
- General-purpose helpers
- Reusable across modules
- Can be utility functions for modules:
R/mod_<name>_utils_<fn>.R - Created with
golem::add_utils()
Documentation
All functions MUST be documented with roxygen2. In almost all cases, the internal functions do no need to be exported. They are only useful inside the app. If ever you have a doubt, ask the user.
Important Rules
- Run
devtools::document()after adding roxygen comments - All functions must have
@examples - Use
@importFromfor external package functions - Use
@noRdfor internal functions (don't document in Rd files) - Never use
library(),require(), orsource()inside functions - Use
@inheritParamsto avoid duplicating parameter docs
Testing
- Tests should be hermetic - each
test_that()block sets up its own data - Test business logic outside of Shiny context when possible
- Use
withr::local_*()for temporary state changes - Write temporary files only to
withr::local_tempfile()orwithr::local_tempdir() - Store static test data in
tests/testthat/fixtures/
Code Quality
- Follow the tidyverse style guide
- Use
air format .if installed - No non-ASCII characters in R/ files (or create
tools/check.envwith_R_CHECK_ASCII_CODE_=FALSE) - Use
TRUE/FALSE, neverT/F - Never use
=for assignment, use<- - Avoid modifying global state - use
on.exit(..., add = TRUE)if necessary
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinginst/agent-skills/skills/golem-add-function/SKILL.md
Popularity
- Repository stars
- 2
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/cran/golem/golem-add-function)