- R 4.1+, a consistent style guide (e.g., tidyverse), a formatter (e.g., styler) and a linter (e.g., lintr).
- Base R pipe
|>over magrittr%>%, prefer base R when tidyverse not needed. - Package dev:
devtools/usethis/roxygen2,testthat(80%+ via a coverage tool, e.g., covr). - Documentation: roxygen2 for inline docs and NAMESPACE management.
@exampleson all exports. - Vignettes with
knitr/rmarkdownfor long-form documentation and tutorials. - Error handling:
tryCatch()/withCallingHandlers(),cli::cli_abort()for user-facing errors. - Input validation:
checkmateorrlang::arg_match()for function parameter validation. - Security: a dependency vulnerability scanner (e.g., oysteR).
- C/C++:
Rcppor.Call(), PROTECT/UNPROTECT all R objects. Rust:extendr/rextendr. - CRAN:
R CMD check --as-cranzero warnings/notes, maintain DESCRIPTION with proper versioning. - Anti-patterns:
eval(parse(text=))with user input, mixing Rcpp and raw C API,T/Finstead ofTRUE/FALSE.
R Conventions
R code conventions covering R 4.1+, tidyverse/base style, styler/lintr, roxygen2, testthat, error handling, input validation, C/C++/Rust interop, and CRAN compliance. Load when writing or reviewing R code.
R Conventions by goldziher · be45b54
npx skillmds@latest add goldziher/r-conventions File contents
---name: r-conventionsdescription: R code conventions covering R 4.1+, tidyverse/base style, styler/lintr, roxygen2, testthat, error handling, input validation, C/C++/Rust interop, and CRAN compliance. Load when writing or reviewing R code.---- R 4.1+, a consistent style guide (e.g., tidyverse), a formatter (e.g., styler) and a linter (e.g., lintr).- Base R pipe `|>` over magrittr `%>%`, prefer base R when tidyverse not needed.- Package dev: `devtools`/`usethis`/`roxygen2`, `testthat` (80%+ via a coverage tool, e.g., covr).- Documentation: roxygen2 for inline docs and NAMESPACE management. `@examples` on all exports.- Vignettes with `knitr`/`rmarkdown` for long-form documentation and tutorials.- Error handling: `tryCatch()`/`withCallingHandlers()`, `cli::cli_abort()` for user-facing errors.- Input validation: `checkmate` or `rlang::arg_match()` for function parameter validation.- Security: a dependency vulnerability scanner (e.g., oysteR).- C/C++: `Rcpp` or `.Call()`, PROTECT/UNPROTECT all R objects. Rust: `extendr`/`rextendr`.- CRAN: `R CMD check --as-cran` zero warnings/notes, maintain DESCRIPTION with proper versioning.- Anti-patterns: `eval(parse(text=))` with user input, mixing Rcpp and raw C API, `T`/`F` instead of `TRUE`/`FALSE`.
goldziher/ai-rulez/tree/main/internal/builtins/languages/r/skills/r-conventions commit be45b5449b
Frequently asked questions
Run npx skillmds@latest add goldziher/r-conventions in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
R code conventions covering R 4.1+, tidyverse/base style, styler/lintr, roxygen2, testthat, error handling, input validation, C/C++/Rust interop, and CRAN compliance. Load when writing or reviewing R code. It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
goldziher (@goldziher) published this skill. Their other Agent Skills are listed on their SkillMD profile.