moai-lang-r

Enforce R best practices with testthat 3.2 and lintr 3.2 compliance checks.

Updated Dec 2, 2025
One-click install
npx skills add https://github.com/dolsoon/my-awesome-project --skill moai-lang-r-dolsoon
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moai-lang-r
Source: https://github.com/dolsoon/my-awesome-project/tree/main/.claude/skills/moai-lang-r
Command: npx skills add https://github.com/dolsoon/my-awesome-project --skill moai-lang-r-dolsoon

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes examples (resource) and references (resource) components.

What problem does it solve?

This Skill helps data analysts and scientists ensure high-quality, testable, and maintainable R code for data analysis. It provides clear best practices, integrates modern testing and linting tools, and applies TRUST 5 principles, reducing errors and improving the reliability of your analytical workflows.

Core Features & Use Cases

  • R 4.4+ Best Practices: Guides on writing clean, efficient, and idiomatic R code for various data tasks.
  • testthat 3.2 Integration: Supports Test-Driven Development (TDD) workflows for robust unit testing of R functions.
  • lintr 3.2 for Code Quality: Automatically checks your R code for style consistency and potential issues, ensuring adherence to coding standards.
  • Use Case: When developing a new data analysis script, this skill guides you through writing unit tests with testthat and linting your code with lintr to ensure reliability and adherence to coding standards, saving time on debugging and refactoring.

Quick Start

Provide a basic example of a testthat unit test for an R function that calculates the mean of a numeric vector.

Frequently Asked Questions about moai-lang-r

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write unit tests for R functions with testthat?

testthat 3.2 provides a Test-Driven Development framework for R. Write unit tests by creating test files with test_that() functions that verify expected outputs. This ensures your data analysis functions behave correctly before integration into larger workflows.

What R code quality checks does lintr perform?

lintr 3.2 automatically analyzes R code for style consistency, potential issues, and adherence to coding standards. It flags problems like naming conventions, spacing, and logical errors, helping maintain clean and maintainable data analysis scripts.

Can I enforce R best practices across my data analysis project?

Yes. This Skill applies R 4.4+ best practices through automatic compliance checks via testthat and lintr integration. It validates code quality, enforces TRUST 5 quality gates, and provides migration guidance to ensure robust, testable analytical workflows.

How do I integrate testing and linting into my R workflow?

Combine testthat 3.2 for unit testing and lintr 3.2 for code quality checks within your R project. The Skill automates these integrations during code discussions and manual reviews, reducing debugging time and improving reliability of analytical code.

What R version and tools are required for these best practices?

R 4.4 or later is required, along with testthat 3.2 and lintr 3.2. The Skill provides tool-version awareness and dependency checks to ensure your environment meets quality assurance requirements for data analysis projects.

When should I apply TDD practices to R data analysis scripts?

Apply Test-Driven Development from the start of new analysis script development. Writing unit tests with testthat before implementation catches errors early, ensures functions behave as expected, and reduces time spent on debugging and refactoring analytical code.