Agent skill

R Oop

by ab604 in ab604/claude-code-r-skills

R object-oriented programming guide for S7, S3, S4, and vctrs.

MITAuto-check passedBackend & APIs

Install R Oop

skills CLI
$ npx skills add ab604/claude-code-r-skills --skill r-oop -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ab604/claude-code-r-skills r-oop --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ab604/claude-code-r-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/r-oop .claude/skills/r-oop && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
r-oop
GitHub stars
206
Used in
2 other repos
Token cost
~1.9k tokens
SKILL.md length
266 words
Files
1
Skills in repo
8
Repo updated
First seen
Licence
MIT

At a glance

R object-oriented programming guide for S7, S3, S4, and vctrs.

  • Works in 2 steps: Vector-like objects (things that behave… → General objects (complex data…
  • Designing R classes
  • SKILL.md covers S7: Modern OOP for New Projects, OOP System Decision Matrix, Detailed S7 vs S3 Comparison and Practical Guidelines, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

R Oop is an agent skill from ab604/claude-code-r-skills. R object-oriented programming guide for S7, S3, S4, and vctrs. Use when designing R classes or choosing an OOP system.

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering File uploads and storage. The repository describes itself as: Claude Code configurations for R development. The licence is MIT.

When your agent uses it

  • Designing R classes
  • Choosing an OOP system

Example prompts

  • “/r-oop”

Workflow steps

2 steps, taken from the step headings in SKILL.md.

  1. Vector-like objects (things that behave like atomic vectors)
  2. General objects (complex data structures, not vector-like)

What it can do on your machine

Read from SKILL.md and the folder at commit 529de4f. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are r).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

R Oop loads about 1.9k tokens when it runs. Until then it costs about 31 tokens; SKILL.md has 266 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~31
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ab604/claude-code-r-skills at commit 529de4f, republished under its MIT licence (© ab604). 266 words, ~1,885 tokens.

Download SKILL.mdSave it as .claude/skills/r-oop/SKILL.md (or your agent's skills folder).
name
r-oop
description
R object-oriented programming guide for S7, S3, S4, and vctrs. Use when designing R classes or choosing an OOP system.

R Object-Oriented Programming

S7, S3, S4, and vctrs: choosing the right OOP system for your needs

S7: Modern OOP for New Projects

  • S7 combines S3 simplicity with S4 structure
  • Formal class definitions with automatic validation
  • Compatible with existing S3 code
r
# S7 class definition
Range <- new_class("Range",
  properties = list(
    start = class_double,
    end = class_double
  ),
  validator = function(self) {
    if (self@end < self@start) {
      "@end must be >= @start"
    }
  }
)

# Usage - constructor and property access
x <- Range(start = 1, end = 10)
x@start  # 1
x@end <- 20  # automatic validation

# Methods
inside <- new_generic("inside", "x")
method(inside, Range) <- function(x, y) {
  y >= x@start & y <= x@end
}

OOP System Decision Matrix

S7 vs vctrs vs S3/S4 Decision Tree

Start here: What are you building?

1. Vector-like objects (things that behave like atomic vectors)
Use vctrs when:
- Need data frame integration (columns/rows)
- Want type-stable vector operations
- Building factor-like, date-like, or numeric-like classes
- Need consistent coercion/casting behavior
- Working with existing tidyverse infrastructure

Examples: custom date classes, units, categorical data
2. General objects (complex data structures, not vector-like)
Use S7 when:
- NEW projects that need formal classes
- Want property validation and safe property access (@)
- Need multiple dispatch (beyond S3's double dispatch)
- Converting from S3 and want better structure
- Building class hierarchies with inheritance
- Want better error messages and discoverability

Use S3 when:
- Simple classes with minimal structure needs
- Maximum compatibility and minimal dependencies
- Quick prototyping or internal classes
- Contributing to existing S3-based ecosystems
- Performance is absolutely critical (minimal overhead)

Use S4 when:
- Working in Bioconductor ecosystem
- Need complex multiple inheritance (S7 doesn't support this)
- Existing S4 codebase that works well

Detailed S7 vs S3 Comparison

FeatureS3S7When S7 wins
Class definitionInformal (convention)Formal (new_class())Need guaranteed structure
Property access$ or attr() (unsafe)@ (safe, validated)Property validation matters
ValidationManual, inconsistentBuilt-in validatorsData integrity important
Method discoveryHard to find methodsClear method printingDeveloper experience matters
Multiple dispatchLimited (base generics)Full multiple dispatchComplex method dispatch needed
InheritanceInformal, NextMethod()Explicit super()Predictable inheritance needed
Migration cost-Low (1-2 hours)Want better structure
PerformanceFastest~Same as S3Performance difference negligible
CompatibilityFull S3Full S3 + S7Need both old and new patterns

Practical Guidelines

Choose S7 when you have
r
# Complex validation needs
Range <- new_class("Range",
  properties = list(start = class_double, end = class_double),
  validator = function(self) {
    if (self@end < self@start) "@end must be >= @start"
  }
)

# Multiple dispatch needs
method(generic, list(ClassA, ClassB)) <- function(x, y) ...

# Class hierarchies with clear inheritance
Child <- new_class("Child", parent = Parent)
Choose vctrs when you need
r
# Vector-like behavior in data frames
percent <- new_vctr(0.5, class = "percentage")
data.frame(x = 1:3, pct = percent(c(0.1, 0.2, 0.3)))  # works seamlessly

# Type-stable operations
vec_c(percent(0.1), percent(0.2))  # predictable behavior
vec_cast(0.5, percent())          # explicit, safe casting
Choose S3 when you have
r
# Simple classes without complex needs
new_simple <- function(x) structure(x, class = "simple")
print.simple <- function(x, ...) cat("Simple:", x)

# Maximum performance needs (rare)
# Existing S3 ecosystem contributions

S3 Patterns

Basic S3 Class
r
# Constructor
new_person <- function(name, age) {
  stopifnot(is.character(name), length(name) == 1)
  stopifnot(is.numeric(age), length(age) == 1)

  structure(
    list(name = name, age = age),
    class = "person"
  )
}

# Print method
print.person <- function(x, ...) {
  cat("Person:", x$name, "(age", x$age, ")\n")
  invisible(x)
}

# Generic + method
greet <- function(x) UseMethod("greet")
greet.person <- function(x) {
  cat("Hello, my name is", x$name, "\n")
}
greet.default <- function(x) {
  cat("Hello!\n")
}
S3 Inheritance
r
# Child class
new_employee <- function(name, age, company) {
  obj <- new_person(name, age)
  obj$company <- company
  class(obj) <- c("employee", class(obj))
  obj
}

# Method with inheritance
print.employee <- function(x, ...) {
  NextMethod()  # Call parent print method
  cat("Works at:", x$company, "\n")
  invisible(x)
}

S7 Patterns

Basic S7 Class
r
library(S7)

# Define class
Person <- new_class("Person",
  properties = list(
    name = class_character,
    age = class_numeric
  ),
  validator = function(self) {
    if (self@age < 0) {
      "@age must be non-negative"
    }
  }
)

# Create instance
bob <- Person(name = "Bob", age = 30)
bob@name  # "Bob"
bob@age <- 31  # Validated assignment
S7 Methods
r
# Define generic
greet <- new_generic("greet", "x")

# Add method
method(greet, Person) <- function(x) {
  cat("Hello, my name is", x@name, "\n")
}

# Default method
method(greet, class_any) <- function(x) {
  cat("Hello!\n")
}
S7 Inheritance
r
Employee <- new_class("Employee",
  parent = Person,
  properties = list(
    company = class_character
  )
)

# Override method
method(greet, Employee) <- function(x) {
  super(x, Person)@greet()  # Call parent method
  cat("I work at", x@company, "\n")
}
S7 Multiple Dispatch
r
# Generic with multiple dispatch
combine <- new_generic("combine", c("x", "y"))

# Method for specific combination
method(combine, list(Person, Person)) <- function(x, y) {
  cat(x@name, "meets", y@name, "\n")
}

method(combine, list(Person, class_character)) <- function(x, y) {
  cat(x@name, "receives message:", y, "\n")
}

Migration Strategy

  1. S3 -> S7: Usually 1-2 hours work, keeps full compatibility
  2. S4 -> S7: More complex, evaluate if S4 features are actually needed
  3. Base R -> vctrs: For vector-like classes, significant benefits
  4. Combining approaches: S7 classes can use vctrs principles internally
Migration Example: S3 to S7
r
# Original S3
new_person_s3 <- function(name, age) {
  structure(list(name = name, age = age), class = "person")
}

# Migrated S7
Person <- new_class("Person",
  properties = list(
    name = class_character,
    age = class_numeric
  )
)

# S7 is backwards compatible with S3 generics
# Existing S3 methods still work

When NOT to Use OOP

Sometimes simpler approaches are better:

r
# Don't create a class for simple data
# BAD
Point <- new_class("Point", properties = list(x = class_double, y = class_double))

# GOOD - just use a named list or vector
point <- c(x = 1.5, y = 2.3)

# Don't create classes for one-off operations
# Use functions instead
distance <- function(p1, p2) {
  sqrt((p1["x"] - p2["x"])^2 + (p1["y"] - p2["y"])^2)
}

© ab604, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/r-oop of ab604/claude-code-r-skills.

Open the folder on GitHubat commit 529de4f

Used in 2 other repositories

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in ab604/claude-code-r-skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

R Oop next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

R Oop compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
R Oop this skillab604/claude-code-r-skills2062 repos~1.9kAutomated safety check: PassMIT
Stripe Projectsfossasia/eventyay1.7k5 repos~2kAutomated safety check: NotesApache-2.0
FoundatioFoundatioFx/Foundatio2.1k—~3.9kAutomated safety check: PassApache-2.0
Spatialduckdb/duckdb-skills6001 repos~1kAutomated safety check: NotesMIT
Edgestore Setupedgestorejs/edgestore454—~1.8kAutomated safety check: PassMIT
S3 Exploreduckdb/duckdb-skills6001 repos~848Automated safety check: NotesMIT

Similar skills

  • Stripe Projects

    fossasia/eventyay

    A skill your agent uses when the user wants to provision infrastructure or third-party services using Stripe Projects.

    1.7k GitHub starsUsed in 5 repos~2k tokens
    Backend & APIsAuto-check: notes
  • Foundatio

    FoundatioFx/Foundatio

    A skill your agent uses when working with Foundatio infrastructure abstractions for .NET -- caching, queuing, messaging, file storage, distributed locking, or background jobs.

    2.1k GitHub stars~3.9k tokensUpdated today
    Backend & APIsAuto-check passed
  • Spatial

    duckdb/duckdb-skills

    Official

    Answer questions about spatial data using DuckDB. An agent skill from duckdb/duckdb-skills.

    600 GitHub starsUsed in 1 repo~1k tokens
    Backend & APIsAuto-check: notes
  • Edgestore Setup

    edgestorejs/edgestore

    A skill your agent uses when adding, extending, or troubleshooting EdgeStore file uploads, upload UI, or bucket access policies in a TypeScript/React application.

    454 GitHub stars~1.8k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • S3 Explore

    duckdb/duckdb-skills

    Official

    Explore and query data on S3, Cloudflare R2, GCS, MinIO, or any S3-compatible storage.

    600 GitHub starsUsed in 1 repo~848 tokens
    Backend & APIsAuto-check: notes
  • Phidown

    ESA-PhiLab/phidown

    Search, filter, download, and analyze Copernicus Data Space products with the phidown project.

    105 GitHub stars~1k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed

More from ab604/claude-code-r-skills

All 8 skills in this repo
  • R Bayes

    ab604/claude-code-r-skills

    Patterns for Bayesian inference in R using brms, including multilevel models, DAG validation, and marginal effects.

    206 GitHub starsUsed in 2 repos~2.5k tokens
    Auto-check passed
  • R Package Development

    ab604/claude-code-r-skills

    R package development guide covering dependencies, API design, testing, and documentation.

    206 GitHub starsUsed in 2 repos~2.4k tokens
    Auto-check passed
  • R Performance

    ab604/claude-code-r-skills

    R performance best practices including profiling, benchmarking, vctrs, and optimization strategies.

    206 GitHub starsUsed in 2 repos~2.4k tokens
    Auto-check passed
  • R Style Guide

    ab604/claude-code-r-skills

    R style guide covering naming conventions, spacing, layout, and function design best practices.

    206 GitHub starsUsed in 2 repos~1.7k tokens
    Auto-check passed
  • Rlang Patterns

    ab604/claude-code-r-skills

    rlang metaprogramming patterns for data-masking, injection operators, and dynamic dots.

    206 GitHub starsUsed in 2 repos~2.1k tokens
    Auto-check: notes
  • TDD Workflow

    ab604/claude-code-r-skills

    Test-driven development workflow for R using testthat. An agent skill from ab604/claude-code-r-skills.

    206 GitHub starsUsed in 2 repos~4.8k tokens
    Auto-check passed

Categories

Questions about R Oop

What does R Oop do?

R object-oriented programming guide for S7, S3, S4, and vctrs. R Oop is an agent skill from ab604/claude-code-r-skills. R object-oriented programming guide for S7, S3, S4, and vctrs.

When should I use R Oop?

R Oop fits situations like: designing R classes; choosing an OOP system.

How do I install R Oop in Claude Code?

Run `npx skills add ab604/claude-code-r-skills --skill r-oop -a claude-code`. Or copy the skill folder (.claude/skills/r-oop in ab604/claude-code-r-skills) into .claude/skills/r-oop in your project. Claude Code loads it when a task matches its description.

How do I install R Oop in Codex?

Run `npx skills add ab604/claude-code-r-skills --skill r-oop -a codex`. Or copy the skill folder (.claude/skills/r-oop in ab604/claude-code-r-skills) into .agents/skills/r-oop in your project. Codex loads it when a task matches its description.

Can I use R Oop in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ab604/claude-code-r-skills --skill r-oop -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/r-oop, .gemini/skills/r-oop, .github/skills/r-oop and .opencode/skills/r-oop in your project.

What does R Oop need to run?

SKILL.md names no scripts, command-line tools or credentials: R Oop is instructions for the agent only.

Does R Oop access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is R Oop safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does R Oop use?

R Oop is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does R Oop use?

About 1.9k tokens (SKILL.md is roughly 7.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to R Oop?

Skills that share tags, products or a category with R Oop: Stripe Projects (fossasia/eventyay, 1.7k stars), Foundatio (FoundatioFx/Foundatio, 2.1k stars), Spatial (duckdb/duckdb-skills, 600 stars) and Edgestore Setup (edgestorejs/edgestore, 454 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains R Oop?

ab604 (a GitHub user) maintains it in ab604/claude-code-r-skills, which has 206 GitHub stars. The repository holds 8 skills in this directory. The repository was last updated on September 17, 2026.

Source: ab604/claude-code-r-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.