- Use
extendrcrate for Rust-R interop.#[extendr]macro on functions,extendr_module!for registration. - Type mapping:
Robjfor generic R objects,Doubles,Integers,Strings,Listfor typed access. - Return
Result<T, extendr_api::Error>for R error propagation. Use.into()for Rust-to-R conversion. - NA handling: use
Rfloat::na(),Rint::na()for missing values. Check with.is_na()before operations. - Build with
rextendr::document()in R for development,cargo build --releasefor production. - Package integration: use
usethis::use_extendr()for scaffolding. Maintainsrc/rust/in R package. - Test R-side with
testthat, Rust-side with standard#[test]. Userextendr::test()for integration. - CRAN compliance:
R CMD check --as-cranmust pass. No compiler warnings. Vendor Rust dependencies. - Keep R wrapper functions thin — heavy computation in Rust, R provides user-facing API with roxygen2 docs.
- Anti-patterns: ignoring NA values, allocating R objects in Rust threads, panics in
#[extendr]functions.
Extendr Bindings
extendr conventions for exposing a Rust core to R: extendr macros and module registration, Robj type mapping, NA handling, rextendr builds, R package scaffolding, and CRAN compliance. Load when generating or reviewing extendr R bindings for a Rust library.
Extendr Bindings by goldziher · a0fccb0
npx skillmds@latest add goldziher/extendr-bindings File contents
---name: extendr-bindingsdescription: extendr conventions for exposing a Rust core to R: extendr macros and module registration, Robj type mapping, NA handling, rextendr builds, R package scaffolding, and CRAN compliance. Load when generating or reviewing extendr R bindings for a Rust library.---- Use `extendr` crate for Rust-R interop. `#[extendr]` macro on functions, `extendr_module!` for registration.- Type mapping: `Robj` for generic R objects, `Doubles`, `Integers`, `Strings`, `List` for typed access.- Return `Result<T, extendr_api::Error>` for R error propagation. Use `.into()` for Rust-to-R conversion.- NA handling: use `Rfloat::na()`, `Rint::na()` for missing values. Check with `.is_na()` before operations.- Build with `rextendr::document()` in R for development, `cargo build --release` for production.- Package integration: use `usethis::use_extendr()` for scaffolding. Maintain `src/rust/` in R package.- Test R-side with `testthat`, Rust-side with standard `#[test]`. Use `rextendr::test()` for integration.- CRAN compliance: `R CMD check --as-cran` must pass. No compiler warnings. Vendor Rust dependencies.- Keep R wrapper functions thin — heavy computation in Rust, R provides user-facing API with roxygen2 docs.- Anti-patterns: ignoring NA values, allocating R objects in Rust threads, panics in `#[extendr]` functions.
goldziher/ai-rulez/tree/main/internal/builtins/bindings/extendr/skills/extendr-bindings commit a0fccb074c
Frequently asked questions
Run npx skillmds@latest add goldziher/extendr-bindings 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.
extendr conventions for exposing a Rust core to R: extendr macros and module registration, Robj type mapping, NA handling, rextendr builds, R package scaffolding, and CRAN compliance. Load when generating or reviewing extendr R bindings for a Rust library. 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.