AI agents don't know every R package. When they encounter unfamiliar ones, they hallucinate APIs or fall back to verbose base R.
This plugin teaches them.
Generate a skill from any R package:
/r-package-skill collapse
Pulls documentation from CRAN, extracts patterns, writes a skill file. Your agent now knows when to use collapse, which functions matter, and how they compose.
Works for any package—CRAN, GitHub, internal tools. Each skill is tested, graded, and optimized before deployment.
/plugin marketplace add arthurgailes/r-package-skills
/plugin install r-package-skills@r-package-skillsFetch and follow instructions from https://raw.githubusercontent.com/arthurgailes/r-package-skills/main/.codex/INSTALL.md
Fetch and follow instructions from https://raw.githubusercontent.com/arthurgailes/r-package-skills/main/.opencode/INSTALL.md
Generate your first skill:
/r-package-skill data.tableYou'll be asked where to install (Personal, Project, or Custom path). Then the agent:
- Pulls CRAN reference manual and vignettes
- Runs baseline test without the skill
- Writes minimal
SKILL.mdaddressing failures - Iterates until tests pass (90%+ score)
Takes 10-12 minutes with 3-4 approval prompts. Skill appears at your chosen path, ready to use.
This plugin focuses on newer and lesser-known R packages — not the popular ones AI models already know well.
For example:
- dplyr is excellent, but GPTs have thousands of training examples. No skill needed.
- collapse (fast grouped operations) is powerful but newer. GPTs hallucinate its API without a skill.
- ellmer (multi-provider LLM chat) shipped in 2024. GPTs have minimal references.
The goal: fill knowledge gaps, not duplicate existing training. We include packages where agents consistently struggle or hallucinate without guidance.
You decide what matters. Use /r-package-skill to generate skills for:
- Internal packages your team built
- Niche CRAN packages in your domain
- GitHub packages not on CRAN
- New packages (< 2 years old) with limited documentation
We won't ship 1,000 packages — just curated skills for packages that demonstrate the pattern and solve common problems. The generator is the real product; the included skills are examples and starting points.
| Skill | Description |
|---|---|
| r-package-skill | Generate a skill from any R package documentation |
| Skill | Focus |
|---|---|
| r-ai | R AI ecosystem navigation and integration patterns |
| r-mapping | R mapping workflow guidance (freestiler + mapgl) |
| Skill | Focus |
|---|---|
| r-ellmer | Chat with LLMs, multi-provider support (hub package) |
| r-btw | Provide R context (docs, data) to LLMs |
| r-mcptools | Let AI agents execute R code in live sessions |
| r-ragnar | RAG workflows, vector stores, document search |
| r-vitals | LLM output evaluation and quality testing |
| Skill | Focus |
|---|---|
| r-collapse | Fast grouped/weighted stats, panel data transformations |
| r-duckplyr | Lazy evaluation for large datasets with DuckDB backend |
| Skill | Focus |
|---|---|
| r-duckspatial | Spatial operations on large geometries via DuckDB |
| r-flextable | Publication-ready tables for Word/PowerPoint/PDF |
| r-freestiler | Vector tilesets (PMTiles) from large spatial data |
| r-mapgl | Interactive WebGL maps, vector tiles, Shiny applications |
Skills encode judgment. They teach agents which packages exist, when to use them, and how they compose.
Without r-ai skill:
# Agent defaults to direct API calls
resp <- httr2::request("https://api.openai.com/v1/chat/completions") |>
httr2::req_auth_bearer_token(key) |>
httr2::req_body_json(list(messages = ...))With r-ai meta-skill and package skills:
# Agent knows the ecosystem and uses the right packages
chat <- chat_openai() # r-ellmer
chat$set_tools(btw_tools()) # r-btw
ragnar_register_tool_retrieve(chat, store) # r-ragnar
chat$chat("What does the documentation say about X?")Without r-collapse skill:
# Works, but slow on large data
data |> group_by(id) |> mutate(demeaned = value - mean(value))With r-collapse skill:
# Agent chooses the fast path
data |> fgroup_by(id) |> fmean(TRA = "-") # 50-100x fasterEach skill is tested against realistic scenarios, graded by specialized validators, and refined until it passes.
Skills follow a test-driven workflow:
- RED: Run a pressure scenario without the skill. Agent fails.
- GREEN: Write minimal skill addressing the failure. Agent passes.
- REFACTOR: Close loopholes, add edge cases, optimize.
Validators check domain-specific correctness:
plot-validator.R- ggplot2 visualizations have required layersspatial-validator.R- geometries are valid, projections correcthtml-validator.R- tables render, conditional formatting worksnumerical-validator.R- grouped stats match expected results
Grading agents evaluate each test run, score assertions, and drive the improvement loop until tests consistently pass.
New skills follow the TDD methodology in r-package-skill:
- Baseline test - Run realistic scenario without the skill
- Minimal skill - Write just enough to pass
- Iterate - Refine until grading agents consistently score 90%+
Package skills go in skills/r-{package}/. Goal-oriented skills (workflows that span multiple packages) are preferred when they make sense.
Each skill needs:
SKILL.mdunder 500 words (overview, when to use, common mistakes)references/directory with detailed docs- Test cases in
tests/{skill-name}/evals.json
Fork, build, test, PR.
MIT
