claude-code-r-skills
CLAUDE.md202 starsChanged 2 months agoMITView on GitHub
This document captures current best practices for R development. For detailed guidance, refer to the skill files below. For R packages use pak and for R environments use renv For detailed guidance on specific topics, refer to these skill files: Use uv for python environment.
In this repository8 other files it gives its agents.
- r-bayesSkill
- rlang-patternsSkill
- r-oopSkill
- r-package-developmentSkill
- r-performanceSkill
- r-style-guideSkill
- tdd-workflowSkill
- tidyverse-patternsSkill
The file
We split this CLAUDE.md into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Profile before optimizing: - Use profvis and bench to identify real bottlenecks
- Distinctive: line 11
Bayesian Inference: - Use brms and marginaleffects
- Distinctive: line 71
Use uv for python environment.
≈ “Common” is an estimate: at least 1 in 5 of the 27,641 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Modern R Development Guide
This document captures current best practices for R development. For detailed guidance, refer to the skill files below.
Core Principles
- Use modern tidyverse patterns - Prioritize dplyr 1.1+ features, native pipe, and current APIs
- Profile before optimizing - Use profvis and bench to identify real bottlenecks
- Write readable code first - Optimize only when necessary and after profiling
- Follow tidyverse style guide - Consistent naming, spacing, and structure
- Bayesian Inference - Use brms and marginaleffects
- Scientific reasoning - We test hypotheses; we never prove them. Always reason from evidence, maintain healthy scepticism, quantify both certainty and uncertainty explicitly (Bayesian), and never tell the user what you think they want to hear at the expense of accuracy.
Package and Environment Management
For R packages use pak and for R environments use renv
R Development Skills
For detailed guidance on specific topics, refer to these skill files:
| Topic | Skill File | Description |
| Tidyverse Patterns | tidyverse-patterns | Modern pipes, joins, grouping, purrr, stringr |
| rlang Metaprogramming | rlang-patterns | Data-masking, injection operators, dynamic dots |
| Performance | r-performance | Profiling, benchmarking, vctrs, optimization |
| Style Guide | r-style-guide | Naming, spacing, function design |
| OOP Systems | r-oop | S7, S3, S4, vctrs decision guide |
| Package Development | r-package-development | Dependencies, API design, testing |
| Bayesian Inference | r-bayes | brms, DAG validation, multilevel models, marginaleffects |
| Machine Learning | r-machine-learning | XGBoost, LightGBM, CatBoost, TabNet, ensembles, CV |
Quick Reference
Essential Modern Patterns
# Always use native pipe
data |> filter(x > 0) |> summarise(mean(y))
# Modern joins with join_by()
inner_join(x, y, by = join_by(a == b))
# Per-operation grouping with .by
summarise(data, mean(value), .by = category)
# Embrace for function arguments
my_func <- function(data, var) {
data |> summarise(mean = mean({{ var }}))
}Key Anti-Patterns to Avoid
# Avoid legacy magrittr pipe
data %>% filter(x > 0) # Use |> instead
# Avoid old join syntax
by = c("a" = "b") # Use join_by(a == b)
# Avoid group_by/ungroup
group_by(x) |> summarise(y) |> ungroup() # Use .by instead
# Avoid sapply (type-unstable)
sapply(x, f) # Use map_*() insteadPython
Use uv for python environment.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

