r-code-style

Enforces lintr configuration, styler formatting, and snake_case naming conventions for R projects.

Updated Jul 29, 2026
One-click install
npx skills add https://github.com/chris-prener/dev-kit --skill r-code-style-chris-prener
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: r-code-style
Source: https://github.com/chris-prener/dev-kit/tree/main/dev-kit/skills/r-code-style
Command: npx skills add https://github.com/chris-prener/dev-kit --skill r-code-style-chris-prener

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? R projects often suffer from inconsistent formatting, mixed naming conventions, and missing linting configuration, making code harder to review and maintain across contributors. ## Core Features & Use Cases - Naming Conventions: Defines snake_case rules for functions, variables, files, and test files, plus PascalCase for R6/S4 classes. - lintr and styler Configuration: Provides the canonical .lintr config block and tidyverse styler conventions for automated formatting. - Code Organization Standards: Covers file structure, explicit package namespacing (dplyr::filter()), assignment style (<-), and early-return patterns. - Use Case: When starting a new R project or reviewing a pull request, apply this skill to generate the .lintr file, run styler::style_dir("R/"), and verify all code passes lintr::lint_dir("R/") with zero findings. ## Quick Start Ask the assistant to configure linting and apply the standard code style conventions to your R project.

Frequently Asked Questions about r-code-style

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

FAQPage Schema
How do I configure lintr for an R project?▼

Create a .lintr configuration file at the project root using the canonical config block defined in the shared lintr-config partial. Then run lintr::lint_dir("R/") to check files or lintr::lint_package() to lint the whole project.

How to auto-format R code with styler?▼

Use styler::style_file() for a single file, styler::style_dir("R/") for a directory, or styler::style_pkg() for the entire project. It applies tidyverse style conventions including 2-space indentation and spaces around operators.

What naming convention should R functions use?▼

R functions should use snake_case with a verb-first pattern, such as clean_order_data() or calculate_order_total(). Variables also use snake_case, constants use SCREAMING_SNAKE_CASE, and R6 or S4 classes use PascalCase.

Should I use library() or explicit namespacing in R code?▼

Use explicit namespacing like dplyr::filter() in function code rather than library() calls. Exceptions are base R functions, pipe operators, and functions from your own package when writing package code.

When should I not use this code style skill?▼

This skill does not cover writing roxygen2 documentation content, enforcing test patterns, setting up CI linting pipelines, or package-specific NAMESPACE conventions. Those belong to the r-documentation, r-testing, r-ci, and r-package-structure skills respectively.