R Code Style Skill

Enforce Google's R style guide on R codebases using styler and lintr.

Updated Mar 18, 2026
One-click install
npx skills add https://github.com/sunzhk/shared-skills --skill r-code-style-skill
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: R Code Style Skill
Source: https://github.com/sunzhk/shared-skills/tree/main/code-styleguide-skills/styleguide-r
Command: npx skills add https://github.com/sunzhk/shared-skills --skill r-code-style-skill

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Readability and consistency issues in R code across teams slow reviews and introduce hidden bugs. This skill enforces Google's R Style Guide, providing automatic checks and practical guidance to keep naming, assignment, dependencies, and documentation aligned.

Core Features & Use Cases

  • Naming and readability checks: enforce BigCamelCase for public functions and dot-prefix for private helpers.
  • Assignment and piping: require leftward assignment and consistent use of pipes with readable line breaks.
  • Functions and returns: emphasize explicit return statements and explicit boundary validation.
  • Dependencies and namespaces: prefer explicit namespace usage and minimal broad imports to reduce conflicts.
  • Risky patterns: discourage attach() and silent global state modifications to improve reliability.

Quick Start

Run the style checker on your R codebase to identify and fix naming, assignment, and namespace issues.

Frequently Asked Questions about R Code Style Skill

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

FAQPage Schema
How do I enforce Google R style guide rules in my codebase?

To enforce Google R style guide rules, this skill checks your R codebase for naming, assignment, and namespace conventions to improve consistency and readability across package development and data analysis scripts.

What naming conventions are required for R functions?

R function naming conventions require BigCamelCase for public functions and a leading dot prefix for private helpers to clearly distinguish scope and improve code readability.

Do I need lintr and styler to check R code quality?

Yes, you need lintr and styler to check R code quality, as this skill relies on them to perform automated linting and apply style formatting for consistent codebase standards.

How do I prevent silent failures in R scripts?

To prevent silent failures in R scripts, enforce explicit returns, explicit boundary validation, and explicit documentation, while actively discouraging risky patterns like attach() and silent global state modifications.

Why use explicit namespace usage instead of broad imports in R?

Explicit namespace usage in R reduces dependency conflicts and prevents silent masking errors by clearly specifying package origins, keeping imports minimal and code execution reliable.

Can I use this R linting skill for package development?

Yes, you can use this R linting skill for package development, as it applies project-level coding standards to guide dependencies, naming, and documentation checks across your entire codebase.