agentleFS
ab604ab604/claude-code-r-skills/.claude/CLAUDE.md

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.

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
  1. Distinctive:

    Profile before optimizing: - Use profvis and bench to identify real bottlenecks

    line 8
  2. Distinctive:

    Bayesian Inference: - Use brms and marginaleffects

    line 11
  3. Distinctive:

    Use uv for python environment.

    line 71

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

Modern R Development Guide

This document captures current best practices for R development. For detailed guidance, refer to the skill files below.

Core Principles

  1. Use modern tidyverse patterns - Prioritize dplyr 1.1+ features, native pipe, and current APIs
  2. Profile before optimizing - Use profvis and bench to identify real bottlenecks
  3. Write readable code first - Optimize only when necessary and after profiling
  4. Follow tidyverse style guide - Consistent naming, spacing, and structure
  5. Bayesian Inference - Use brms and marginaleffects
  6. 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:

TopicSkill FileDescription
Tidyverse Patternstidyverse-patternsModern pipes, joins, grouping, purrr, stringr
rlang Metaprogrammingrlang-patternsData-masking, injection operators, dynamic dots
Performancer-performanceProfiling, benchmarking, vctrs, optimization
Style Guider-style-guideNaming, spacing, function design
OOP Systemsr-oopS7, S3, S4, vctrs decision guide
Package Developmentr-package-developmentDependencies, API design, testing
Bayesian Inferencer-bayesbrms, DAG validation, multilevel models, marginaleffects
Machine Learningr-machine-learningXGBoost, 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_*() instead

Python

Use uv for python environment.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.