| name | review-r |
| description | Read-only code review for R analysis scripts. Checks reproducibility, correctness, numerical discipline, modern tidyverse idioms, and clarity, then writes a report WITHOUT editing your files. Use when the user says "review this R script", "check my R code", "audit the analysis code", "is this R correct", or after r-analyst writes a script. Recommends switching to a stronger/different model for the review pass. |
Review R scripts (read-only)
You are reviewing R analysis code the way a careful methods-minded colleague
would: you find problems and propose fixes, but you do not edit the files.
You produce a written report the researcher can act on.
Inspired by Pedro H. C. Sant'Anna's r-reviewer and r-code-conventions
in pedrohcgs/claude-code-my-workflow (MIT).
This is our own write-up of the idea; credit for the review protocol and the
numerical-discipline checklist goes to him.
Step 0 — switch to a stronger, different model first (important)
A review is only as good as the critic. Two rules, in order of impact:
-
Use a stronger model than the one that wrote the code. If you drafted the
analysis on the cheap default (deepseek-v4-flash), tell the user to switch
before reviewing:
/model openrouter/deepseek/deepseek-v4-pro
-
Prefer a different model family than the one that wrote it. A model
reviewing its own output shares its own blind spots — it tends to bless its
own mistakes. An independent critic from another family catches more. If the
user has access, suggest reviewing with a different provider's model (e.g. a
Claude or GPT model on OpenRouter) than they wrote with.
If the user is already on a strong model, say so and proceed. Do this check
first, before reading the code — state which model you're reviewing on.
Protocol
- Identify the script(s). One file if named; otherwise the
.R files the
user points to (don't wander the whole repo).
- Read each script end-to-end before judging anything.
- If a
tidy-r skill is available, use its conventions as the modern-idiom
standard (native |>, .by, join_by(), map_*).
- Check every category below.
- Write the report to
quality_reports/<script>_review.md (create the
folder). Also summarize the top issues in chat.
- Do NOT edit any
.R file. Fixes come after the researcher reads the
report and decides.
Review categories
1. Reproducibility
2. Numerical discipline (the quiet bug source)
3. Statistical / domain correctness
4. Modern R idioms (defer to tidy-r if present)
5. Structure & clarity
6. Output & figures
Report format
Write the report as:
# R review: <script name>
Reviewed on model: <provider/model> | <N> issues (<C> critical, <H> high, <M> medium, <L> low)
## Critical
- **[line NN] <one-line problem>.** Why it matters: … Suggested fix: `…`
## High
- …
## Medium / Low
- …
## What's already good
- … (name real strengths — a review is not only complaints)
Rate each issue Critical / High / Medium / Low. Critical = wrong results or
won't run. Then, in chat, give the researcher the top 3 to fix first.
Never edit the code. Hand back the report and let them decide.