Supercharge your R package development with AI-powered workflows using Claude Code
claude-r-dev is a comprehensive configuration system for Claude Code that transforms AI-assisted coding from helpful suggestions into systematic, production-ready R package development.
- π§ Modular Profiles: Mix and match configurations for your package type
- π€ Specialized Sub-Agents: Expert AI assistants for code review, testing, and more
- β‘ Custom Workflows: Slash commands for common development tasks
- π Quality Automation: Built-in checks for CRAN compliance, test coverage, style
- π Best Practices: Embedded standards from R package development, statistical methodology, and software engineering
- π One-Line Install: From GitHub directly to your package
npm install -g @anthropic-ai/claude-codeOption 1: One-liner (recommended)
curl -fsSL https://raw.githubusercontent.com/Data-Wise/claude-r-dev/main/scripts/install.sh | bash -s -- \
--profile base \
--target /path/to/your/packageOption 2: With multiple profiles
# For statistical methodology packages
bash <(curl -fsSL https://raw.githubusercontent.com/Data-Wise/claude-r-dev/main/scripts/install.sh) \
--profiles base,statistical-methods \
--target ~/projects/mypackageOption 3: Clone and customize
git clone https://github.com/Data-Wise/claude-r-dev.git
cd claude-r-dev
./scripts/install.sh --profiles base,statistical-methods --target ~/mypackagecd /path/to/your/package
claude
# Try these commands:
/permissions # View configured tools
/project: # See available slash commands
/project:pre-commit-check # Run comprehensive quality checksNEW: Interactive wizard to generate package-specific configurations!
cd your-package
claude
/project:initThe wizard asks about:
- Package type and domain
- Statistical notation preferences
- Object system (S3, S4, S7, R6)
- Function organization
- Inference methods
- Testing requirements
- Website design (5 color schemes!)
...and generates a custom configuration tailored to YOUR package!
Learn more about customization β
Essential R package development standards
- CRAN compliance automation
- Testing standards (testthat3, >80% coverage)
- Code style enforcement (tidyverse)
- Git workflows and best practices
- Documentation standards (roxygen2, pkgdown)
Includes:
/project:fix-bug- Structured debugging workflow/project:pre-commit-check- Comprehensive quality checksr-package-reviewersub-agent - Expert code reviewtest-specialistsub-agent - Comprehensive test generation
For methodology and causal inference packages
- Statistical notation standards (VanderWeele, Pearl, HernΓ‘n & Robins)
- Identification assumptions documentation
- Sensitivity analysis patterns
- Simulation study workflows
- S7 object system guidelines
Includes:
/project:add-method- Systematic new method development/project:migrate-s7- Safe S3/S4 to S7 migration- Enhanced
r-package-reviewerwith statistical correctness checks - Methods-specific testing patterns
For packages focused on data analysis and visualization
For Shiny application packages
For Bioconductor package development
# Install base profile
./scripts/install.sh --profile base --target ~/mypackage
cd ~/mypackage
claude# In Claude Code:
"Read the package structure and suggest improvements"
/project:pre-commit-check
/project:fix-bug "function X fails with negative inputs"
# Install base + statistical-methods
./scripts/install.sh --profiles base,statistical-methods --target ~/causalmethod
cd ~/causalmethod
claude# In Claude Code:
/project:add-method "doubly-robust-mediation"
# Follows guided workflow: Plan β Test β Implement β Document
"Use r-package-reviewer sub-agent to check statistical correctness"
# Reviews formulas, assumptions, inference methods
/project:migrate-s7 MediationResult
# Safely migrates S3/S4 classes to modern S7
"Use test-specialist to write comprehensive tests for my_function()"
# Generates tests for happy path, edge cases, validation
/project:pre-commit-check
# Ensures >80% coverage, style compliance, R CMD check passes
"Commit these changes with a descriptive message"
# Claude writes commit following conventional commits standard
Execute complex workflows with simple commands:
/project:add-method- Add new statistical/analytical methods/project:fix-bug- Test-first debugging workflow/project:migrate-s7- S3/S4 to S7 class migration/project:pre-commit-check- Full quality assurance suite
Expert AI assistants that maintain focused context:
- r-package-reviewer: Reviews for statistical correctness, CRAN compliance, code quality
- test-specialist: Writes comprehensive test suites with edge cases
- documentation-writer: Creates roxygen2 docs, vignettes, pkgdown sites
Built-in automation for:
- β
Style checking (
styler,lintr) - β
Test coverage (
covr, >80% required) - β R CMD check (CRAN compliance)
- β Documentation completeness
- β Spelling and grammar
- β Git commit message standards
For methodology packages:
- Standard notation (VanderWeele 2015, Pearl 2009)
- Identification assumptions documentation
- Inference method requirements (bootstrap, delta method)
- Sensitivity analysis integration
- Edge case testing (missing data, collinearity, etc.)
Documentation Site: https://data-wise.github.io/claude-r-dev/
- Getting Started - Installation and first steps
- Profiles Guide - Available profiles and features
- Customization - Wizard and manual customization
- Commands Reference - All commands and agents
- Config Schema - Configuration file reference
- Contributing - How to contribute
- Tutorials - Step-by-step guides
- Examples - Example configurations
- Changelog - Version history
base/ # Core R package standards (required)
βββ CLAUDE.md # Main configuration
βββ settings.json # Tool permissions
βββ commands/ # Slash commands
βββ agents/ # Sub-agents
statistical-methods/ # Extends base for methodology
βββ CLAUDE.md # Additional standards
βββ commands/ # Methods-specific commands
βββ agents/ # Enhanced reviewers
- Validates target is R package (checks for DESCRIPTION)
- Backs up existing configuration
- Installs base profile
- Merges additional profiles
- Updates .gitignore
- Generates installation report
- Claude Code CLI:
npm install -g @anthropic-ai/claude-code - R (β₯ 4.0.0): With development tools
- Git: For version control
install.packages(c(
"devtools", "testthat", "roxygen2",
"styler", "lintr", "covr", "pkgdown",
"goodpractice", "spelling", "usethis"
))For statistical-methods profile:
install.packages("S7") # Modern object systemWe welcome contributions! Ways to help:
- Add new profiles: Create configurations for new package types
- Improve existing profiles: Enhance standards and workflows
- Submit slash commands: Share useful workflow automations
- Create sub-agents: Build specialized AI assistants
- Improve documentation: Clarify usage and examples
- Report issues: Help us identify problems
- Share feedback: Tell us what works and what doesn't
See CONTRIBUTING.md for details.
Statistical methods package for causal mediation analysis using claude-r-dev:
- Profiles:
base+statistical-methods - Result: 50% faster feature development, 100% test coverage
Successfully using claude-r-dev? Submit a PR to share your story!
- β Base profile with core R package development
- β Statistical-methods profile for methodology packages
- β Smart installer with profile merging
- β Comprehensive documentation
- β¬ Data-analysis profile
- β¬ Shiny profile
- β¬ Bioconductor profile
- β¬ Profile update system
- β¬ Community profile registry
- β¬ Web-based profile builder
- β¬ VS Code extension integration
- β¬ GitHub Actions workflow templates
- β¬ Team collaboration features
Q: Do I need Claude Pro to use this?
A: No, Claude Code works with any Claude account. Pro provides extended thinking, but is not required.
Q: Can I use this with Cursor or other AI coding tools?
A: The configuration is optimized for Claude Code, but many patterns can be adapted.
Q: Will this work with my existing package?
A: Yes! The installer checks for existing configurations and merges intelligently.
Q: Can I customize the profiles?
A: Absolutely! See Customization Guide for details.
Q: How do I update to the latest version?
A: Run ./scripts/update.sh in your package, or reinstall with the latest version.
Q: Is this only for R packages?
A: Currently yes, but the architecture could support other languages. Contributions welcome!
MIT License - see LICENSE for details.
- Anthropic - For Claude Code and best practices documentation
- R Core Team - For R and package development infrastructure
- Hadley Wickham - For R package development standards and tidyverse
- Contributors - Everyone who improves and extends claude-r-dev
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Transform your R package development from ad-hoc to systematic, from uncertain to rigorous, from solo to AI-collaborative.
Install. Configure. Excel. π
Made with β€οΈ for the R community