designing-tidy-r-functions

Design and evaluate tidy R function APIs for naming, argument order, and type stability.

13|2|Updated Jan 13, 2026
One-click install
npx skills add https://github.com/jsperger/llm-r-skills --skill designing-tidy-r-functions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: designing-tidy-r-functions
Source: https://github.com/jsperger/llm-r-skills/tree/main/skills/designing-tidy-r-functions
Command: npx skills add https://github.com/jsperger/llm-r-skills --skill designing-tidy-r-functions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

R function APIs can be hard to discover and use when names are inconsistent, arguments are poorly ordered, and outputs are unpredictable. This Skill guides designing user-friendly R function APIs with naming conventions, argument ordering, and type stability.

Core Features & Use Cases

  • Predictable names and verb-first conventions.
  • Argument ordering that favors most important inputs first and defaults last.
  • Pipe-friendly interfaces with the primary data as the first argument.
  • Type-stable outputs and explicit option validation patterns (e.g., arg_match).
  • Use case: Review a new function API in a package to improve usability and consistency.

Quick Start

Use the designing-tidy-r-functions skill to evaluate the API design of a new function read_data() for naming, argument ordering, and defaults.

Frequently Asked Questions about designing-tidy-r-functions

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

FAQPage Schema
How do I design a tidy R function API for better usability?

Designing a tidy R function API requires enforcing verb-first naming conventions, placing primary data in the first argument, and ensuring type-stable outputs. This reduces cognitive load by making function behavior predictable and consistent across packages.

What is type stability in R function design?

Type stability in R function design means a function consistently returns the same output type regardless of input variations. Enforcing type-stable outputs prevents unexpected runtime errors and makes API behavior predictable for users.

How should I order arguments in an R function to follow tidy conventions?

Argument ordering in tidy R functions places the most important inputs first, with the primary data preceding other arguments, and defaults last. This convention optimizes readability and supports pipe-friendly interfaces for sequential data transformation.

How do I use arg_match for explicit option validation in R?

Using arg_match for explicit option validation in R restricts function arguments to a predefined set of allowed values. This pattern catches invalid options early, provides clear error messages, and enforces API consistency checks across packages.

Can I review my R package API for naming consistency and usability?

You can review an R package API for naming consistency by evaluating functions against verb-first conventions, argument ordering, and type stability. This process identifies poorly ordered arguments and inconsistent names to improve overall package usability.