r-style-guide

Enforce R coding conventions for naming, formatting, and function design.

1|1|Updated May 5, 2026
One-click install
npx skills add https://github.com/cynkra/cynkra.ai.day --skill r-style-guide-cynkra
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: r-style-guide
Source: https://github.com/cynkra/cynkra.ai.day/tree/main/claude-code-r-skills/.claude/skills/r-style-guide
Command: npx skills add https://github.com/cynkra/cynkra.ai.day --skill r-style-guide-cynkra

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents messy, inconsistent R code by providing concrete conventions for naming, spacing, structure, and function design that improve readability and maintainability.

Core Features & Use Cases

  • Function Writing Best Practices: Enforces clear structure, single responsibility, sensible return behavior, and readable defaults for common R workflows.
  • Naming and Argument Conventions: Standardizes snake_case naming, verb/noun roles, and rules for prefixed non-standard arguments.
  • Tidyverse-Friendly Layout: Guides pipe formatting, assignment style, indentation, and comment intent so code reviews are quicker and changes are safer.
  • Error Handling and User-Facing Messaging: Recommends structured user-facing abort patterns for clearer failure modes.
  • Use Case: Applying these rules while building data pipelines or helper functions in a small R project to keep behavior and style predictable across multiple collaborators.

Quick Start

Ask an AI to refactor your R function so it follows this R style guide’s naming, formatting, single-responsibility structure, and error handling conventions.

Frequently Asked Questions about r-style-guide

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

FAQPage Schema
How do I enforce consistent R naming and formatting conventions in my code?

To enforce consistent R naming and formatting, apply snake_case naming, specific spacing and layout rules, and standard indentation to improve code readability and maintainability across collaborative projects.

What is the best way to structure R functions for better readability?

The best way to structure R functions for readability is to enforce single responsibility, clear argument conventions, sensible return behavior, and readable defaults for common workflows.

How do I format tidyverse pipelines in R for collaborative data analysis?

To format tidyverse pipelines in R, apply specific pipe formatting, assignment styles, and indentation rules that make code reviews quicker and changes safer in collaborative projects.

How should I handle user-facing errors and abort patterns in R functions?

For error handling in R functions, use structured user-facing abort patterns to provide clearer failure modes and messaging when user-facing failures occur.

Can I use this R style guide to refactor existing code?

Yes, you can use this R style guide to refactor existing R functions by applying its rules for naming, formatting, single-responsibility structure, and error handling conventions.

When do I need to standardize R code conventions in a data pipeline project?

You need to standardize R code conventions when building data pipelines or helper functions in a project to keep behavior and style predictable across multiple collaborators.