r-development
Modern R development practices emphasizing tidyverse patterns (dplyr 1.1 and later, native pipe, join_by, .by grouping), rlang metaprogramming, performance optimization, and package development. Use when Claude needs to write R code, create R packages, optimize R performance, or provide R programming guidance.
Best use case
r-development is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Modern R development practices emphasizing tidyverse patterns (dplyr 1.1 and later, native pipe, join_by, .by grouping), rlang metaprogramming, performance optimization, and package development. Use when Claude needs to write R code, create R packages, optimize R performance, or provide R programming guidance.
Modern R development practices emphasizing tidyverse patterns (dplyr 1.1 and later, native pipe, join_by, .by grouping), rlang metaprogramming, performance optimization, and package development. Use when Claude needs to write R code, create R packages, optimize R performance, or provide R programming guidance.
Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.
Practical example
Example input
Use the "r-development" skill to help with this workflow task. Context: Modern R development practices emphasizing tidyverse patterns (dplyr 1.1 and later, native pipe, join_by, .by grouping), rlang metaprogramming, performance optimization, and package development. Use when Claude needs to write R code, create R packages, optimize R performance, or provide R programming guidance.
Example output
A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.
When to use this skill
- Use this skill when you want a reusable workflow rather than writing the same prompt again and again.
When not to use this skill
- Do not use this when you only need a one-off answer and do not need a reusable workflow.
- Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/r-development/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How r-development Compares
| Feature / Agent | r-development | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Modern R development practices emphasizing tidyverse patterns (dplyr 1.1 and later, native pipe, join_by, .by grouping), rlang metaprogramming, performance optimization, and package development. Use when Claude needs to write R code, create R packages, optimize R performance, or provide R programming guidance.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
SKILL.md Source
# R Development
This skill provides comprehensive guidance for modern R development, emphasizing current best practices with tidyverse, performance optimization, and professional package development.
## 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
## Modern Tidyverse Essentials
### Native Pipe (`|>` not `%>%`)
Always use native pipe `|>` instead of magrittr `%>%` (R 4.1+):
```r
# Modern
data |>
filter(year >= 2020) |>
summarise(mean_value = mean(value))
# Avoid legacy pipe
data %>% filter(year >= 2020)
```
### Join Syntax (dplyr 1.1+)
Use `join_by()` for all joins:
```r
# Modern join syntax with equality
transactions |>
inner_join(companies, by = join_by(company == id))
# Inequality joins
transactions |>
inner_join(companies, join_by(company == id, year >= since))
# Rolling joins (closest match)
transactions |>
inner_join(companies, join_by(company == id, closest(year >= since)))
```
Control match behavior:
```r
# Expect 1:1 matches
inner_join(x, y, by = join_by(id), multiple = "error")
# Ensure all rows match
inner_join(x, y, by = join_by(id), unmatched = "error")
```
### Per-Operation Grouping with `.by`
Use `.by` instead of `group_by() |> ... |> ungroup()`:
```r
# Modern approach (always returns ungrouped)
data |>
summarise(mean_value = mean(value), .by = category)
# Multiple grouping variables
data |>
summarise(total = sum(revenue), .by = c(company, year))
```
### Column Operations
Use modern column selection and transformation functions:
```r
# pick() for column selection in data-masking contexts
data |>
summarise(
n_x_cols = ncol(pick(starts_with("x"))),
n_y_cols = ncol(pick(starts_with("y")))
)
# across() for applying functions to multiple columns
data |>
summarise(across(where(is.numeric), mean, .names = "mean_{.col}"), .by = group)
# reframe() for multi-row results per group
data |>
reframe(quantiles = quantile(x, c(0.25, 0.5, 0.75)), .by = group)
```
## rlang Metaprogramming
For comprehensive rlang patterns, see [references/rlang-patterns.md](references/rlang-patterns.md).
### Quick Reference
- **`{{}}`** - Forward function arguments to data-masking functions
- **`!!`** - Inject single expressions or values
- **`!!!`** - Inject multiple arguments from a list
- **`.data[[]]`** - Access columns by name (character vectors)
- **`pick()`** - Select columns inside data-masking functions
Example function with embracing:
```r
my_summary <- function(data, group_var, summary_var) {
data |>
summarise(mean_val = mean({{ summary_var }}), .by = {{ group_var }})
}
```
## Performance Optimization
For detailed performance guidance, see [references/performance.md](references/performance.md).
### Key Strategies
1. **Profile first**: Use `profvis::profvis()` and `bench::mark()`
2. **Vectorize operations**: Avoid loops when vectorized alternatives exist
3. **Use dtplyr**: For large data operations (lazy evaluation with data.table backend)
4. **Parallel processing**: Use `furrr::future_map()` for parallelizable work
5. **Memory efficiency**: Pre-allocate, use appropriate data types
Quick example:
```r
# Profile code
profvis::profvis({
result <- data |>
complex_operation() |>
another_operation()
})
# Benchmark alternatives
bench::mark(
approach_1 = method1(data),
approach_2 = method2(data),
check = FALSE
)
```
## Package Development
For complete package development guidance, see [references/package-development.md](references/package-development.md).
### Quick Guidelines
**API Design:**
- Use `.by` parameter for per-operation grouping
- Use `{{}}` for column arguments
- Return tibbles consistently
- Validate user-facing function inputs thoroughly
**Dependencies:**
- Add dependencies for significant functionality gains
- Core tidyverse packages usually worth including: dplyr, purrr, stringr, tidyr
- Minimize dependencies for widely-used packages
**Testing:**
- Unit tests for individual functions
- Integration tests for workflows
- Test edge cases and error conditions
**Documentation:**
- Document all exported functions
- Provide usage examples
- Explain non-obvious parameter interactions
## Common Migration Patterns
### Base R → Tidyverse
```r
# Data manipulation
subset(data, condition) → filter(data, condition)
data[order(data$x), ] → arrange(data, x)
aggregate(x ~ y, data, mean) → summarise(data, mean(x), .by = y)
# Functional programming
sapply(x, f) → map(x, f) # type-stable
lapply(x, f) → map(x, f)
# Strings
grepl("pattern", text) → str_detect(text, "pattern")
gsub("old", "new", text) → str_replace_all(text, "old", "new")
```
### Old → New Tidyverse
```r
# Pipes
%>% → |>
# Grouping
group_by() |> ... |> ungroup() → summarise(..., .by = x)
# Joins
by = c("a" = "b") → by = join_by(a == b)
# Reshaping
gather()/spread() → pivot_longer()/pivot_wider()
```
## Additional Resources
- **rlang patterns**: See [references/rlang-patterns.md](references/rlang-patterns.md) for comprehensive data-masking and metaprogramming guidance
- **Performance optimization**: See [references/performance.md](references/performance.md) for profiling, benchmarking, and optimization strategies
- **Package development**: See [references/package-development.md](references/package-development.md) for complete package creation guidance
- **Object systems**: See [references/object-systems.md](references/object-systems.md) for S3, S4, S7, R6, and vctrs guidanceRelated Skills
vue-development-guides
A collection of best practices and tips for developing applications using Vue.js. This skill MUST be apply when developing, refactoring or reviewing Vue.js or Nuxt projects.
wordpress-woocommerce-development
WooCommerce store development workflow covering store setup, payment integration, shipping configuration, and customization.
wordpress-theme-development
WordPress theme development workflow covering theme architecture, template hierarchy, custom post types, block editor support, and responsive design.
wordpress-plugin-development
WordPress plugin development workflow covering plugin architecture, hooks, admin interfaces, REST API, and security best practices.
voice-ai-engine-development
Build real-time conversational AI voice engines using async worker pipelines, streaming transcription, LLM agents, and TTS synthesis with interrupt handling and multi-provider support
voice-ai-development
Expert in building voice AI applications - from real-time voice agents to voice-enabled apps. Covers OpenAI Realtime API, Vapi for voice agents, Deepgram for transcription, ElevenLabs for synthesis, LiveKit for real-time infrastructure, and WebRTC fundamentals. Knows how to build low-latency, production-ready voice experiences. Use when: voice ai, voice agent, speech to text, text to speech, realtime voice.
salesforce-development
Expert patterns for Salesforce platform development including Lightning Web Components (LWC), Apex triggers and classes, REST/Bulk APIs, Connected Apps, and Salesforce DX with scratch orgs and 2nd generation packages (2GP). Use when: salesforce, sfdc, apex, lwc, lightning web components.
python-fastapi-development
Python FastAPI backend development with async patterns, SQLAlchemy, Pydantic, authentication, and production API patterns.
python-development-python-scaffold
You are a Python project architecture expert specializing in scaffolding production-ready Python applications. Generate complete project structures with modern tooling (uv, FastAPI, Django), type hint
moodle-external-api-development
Create custom external web service APIs for Moodle LMS. Use when implementing web services for course management, user tracking, quiz operations, or custom plugin functionality. Covers parameter validation, database operations, error handling, service registration, and Moodle coding standards.
game-development
Game development orchestrator. Routes to platform-specific skills based on project needs.
frontend-mobile-development-component-scaffold
You are a React component architecture expert specializing in scaffolding production-ready, accessible, and performant components. Generate complete component implementations with TypeScript, tests, s