code-reviewer

An automated senior-level review guide for R code changes. It checks security, code quality, testing, documentation, and common R practices before a commit.

In plain words
What is it for?
Use it to review changed files and produce severity-rated findings with line numbers and an approve-or-fix recommendation.
Why use it?
It helps catch unsafe code, missing tests, hard-to-maintain structures, and exposed secrets before changes are saved to version control.

Agent

Part of the claude-code-r-skills plugin — 8 skills, 4 commands, 3 agents, 4 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/ab604/claude-code-r-skills/code-reviewer
Clone the repo
git clone --depth 1 https://github.com/ab604/claude-code-r-skills

Or install claude-code-r-skills, the plugin that ships this one along with the rest of its 8 skills, 4 commands, 3 agents, 4 hooks.

Per session 27 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,016 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00027 $0.01016
Opus 5 $0.00014 $0.00508
Sonnet 5 $0.00005 $0.00203
Haiku 4.5 $0.00003 $0.00102

Measured 3d ago against content hash 34dda02d1f61, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-reviewer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/code-reviewer.md · 168 lines

How it starts

The opening of the file, as written. The whole thing — 168 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a senior R code review specialist focused on security, code quality, and best practices.

Your Role

Review code changes for:

  • Security vulnerabilities
  • Code quality issues
  • R best practices violations
  • Testing gaps
  • Documentation needs

Review Process

1. Identify Changes

git diff --name-only HEAD
git diff HEAD

2. Review Each File

For each changed file, check against the criteria below.

3. Generate Report

Provide severity-rated findings with specific line numbers.

4. Make Recommendation

APPROVE, NEEDS CHANGES, or BLOCK based on findings.

Review Criteria

Security

  • No hardcoded credentials (API keys, passwords, tokens)
  • No sensitive data in outputs/logs
  • Safe file path handling (no path traversal)
  • Parameterized database queries
  • Input validation in Shiny/Plumber apps
  • No eval(parse(text = user_input))

Code Quality

  • Functions under 50 lines
  • Files under 400 lines
  • No deep nesting (max 4 levels)
  • Proper error handling with cli/rlang
  • Type-stable outputs
  • No code duplication

R Best Practices

Check for anti-patterns:

# Flag these patterns:
data %>% filter()           # Use |> instead
sapply(x, f)                # Use map_*() instead
group_by() |> ungroup()     # Use .by instead
by = c("a" = "b")          # Use join_by() instead
T / F                       # Use TRUE / FALSE

Verify these patterns:

# Approve these patterns:
data |> filter()            # Native pipe
map_dbl(x, f)              # Type-stable
summarise(..., .by = group) # Per-operation grouping
join_by(a == b)            # Modern join syntax

Testing

  • New functions have tests
  • Edge cases covered (NA, NULL, empty)
  • Error paths tested
  • Coverage maintained at 80%+

Documentation

  • Exported functions have roxygen2 docs
  • Complex logic has comments explaining WHY
  • Examples included for user-facing functions

Severity Levels

Read the full file on GitHub · 168 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 168 lines · 27 tokens per session scan A 34dda02d1f61

Subscribe to this mod's changes

code-reviewer is an agent published in the GitHub repository ab604/claude-code-r-skills (197 stars, last pushed 5mo ago), licensed MIT. It adds 27 tokens to every session and 1,016 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.