
r-cran-extrachecks
Prepare R packages for CRAN submission by checking for common ad-hoc requirements not caught by devtools::check(). Use when: (1) Preparing a package for first CRAN release, (2) Preparing a package update for CRAN resubmission, (3) Reviewing a package to ensure CRAN compliance, (4) Responding to CRAN reviewer feedback. Covers documentation requirements, DESCRIPTION field standards, URL validation, examples, and administrative requirements.
- Installs
- 67
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/posit-dev/skills --skill r-cran-extrachecks- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads r-cran-extrachecks automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
CRAN Extra Checks
Help R package developers prepare packages for CRAN submission by systematically checking for common ad-hoc requirements that CRAN reviewers enforce but devtools::check() doesn't catch.
Workflow
- Initial Assessment: Ask user if this is first submission or resubmission
- Run Standard Checklist: Work through each item systematically (see below)
- Identify Issues: As you review files, note specific problems
- Propose Fixes: Suggest specific changes for each issue found
- Implement Changes: Make edits only when user approves
- Verify: Confirm all changes are complete
Standard CRAN Preparation Checklist
Work through these items systematically:
- Create NEWS.md: Run
usethis::use_news_md()if not already present - Create cran-comments.md: Run
usethis::use_cran_comments()if not already present - Review README:
- Ensure it includes install instructions that will be valid when the package is accepted to CRAN (usually
install.packages("pkgname")). - Check that it does not contain relative links. This works on GitHub but will be flagged by CRAN. Use full URLs to package documentation or remove the links.
- Does the README clearly explain the package purpose and functionality?
- Important: If README.Rmd exists, edit ONLY README.Rmd (README.md will be overwritten), then run
devtools::build_readme()to re-render README.md
- Ensure it includes install instructions that will be valid when the package is accepted to CRAN (usually
- Proofread DESCRIPTION: Carefully review
Title:andDescription:fields (see detailed guidance below) - Check function documentation: Verify all exported functions have
@returnand@examples(see detailed guidance below). Note the exemption for S3 methods documented only with#' @export: they produce no.Rdfile and are not required to have either tag - Verify copyright holder: Check that
Authors@R:includes a copyright holder with role[cph] - Review bundled file licensing: Check licensing of any included third-party files
- Run URL checks: Use
urlchecker::url_check()and fix any issues
Detailed CRAN Checks
Documentation Requirements
Return Value Documentation (Strictly Enforced)
CRAN now strictly requires @return documentation for all exported functions. Use the roxygen2 tag @return to document what the function returns.
- Required even for functions marked
@keywords internal - Required even if function returns nothing - document as
@return Noneor similar - Must be present for every exported function
These rules apply only to functions with an .Rd file. Roxygen2 creates an .Rd file only when a block contains documentation content (a title or description). A block that contains nothing but #' @export adds the function to the NAMESPACE without generating an .Rd file, so there is nothing for CRAN's documentation checks to inspect. This is the conventional pattern for S3 methods:
#' @export
print.my_class <- function(x, ...) {
cat("my_class object\n")
invisible(x)
}
Such methods do not need @return or @examples, and R CMD check does not flag them as undocumented (registered S3 methods are excluded from the undocumented-objects check).
- The exemption holds only while the block contains nothing but
@export(or@exportS3Method). Adding a title,@param,@rdname,@describeIn, or any other documentation makes roxygen2 generate an.Rdfile, and the function must then satisfy all documentation rules including@return. - Do not confuse these with the S3 generic itself (e.g.,
my_print <- function(x, ...) UseMethod("my_print")). A newly exported generic is an ordinary exported function with documentation, so it still needs@returnand@examples. - Methods sharing a page with their generic via
@rdnameor@describeInfollow the same rules as the generic: the combined.Rdneeds the required tags once, not once per method.
Example:
# Missing @return - WILL BE REJECTED
#' Calculate sum
#' @export
my_sum <- function(x, y) {
x + y
}
# Correct - includes @return
#' Calculate sum
#' @param x First number
#' @param y Second number
#' @return A numeric value
#' @export
my_sum <- function(x, y) {
x + y
}
# For functions with no return value
#' Print message
#' @param msg Message to print
#' @return None, called for side effects
#' @export
print_msg <- function(msg) {
cat(msg, "\n")
}
Examples for Exported Functions
If your exported function has a meaningful return value, it will almost definitely require an @examples section. Use the roxygen2 tag @examples.
- Required even for functions marked
@keywords internal - Exceptions exist for functions used purely for side effects (e.g., creating directories)
- Examples must be executable
- S3 methods with
@export-only roxygen blocks have no.Rdfile and need no examples (see above)
Un-exported Functions with Examples
If you write roxygen examples for un-exported functions, you must either:
- Call them with
:::notation:pkg:::my_fun() - Use
@noRdtag to suppress.Rdfile creation
Using \dontrun{} Sparingly
\dontrun{} should only be used if the example really cannot be executed (e.g., missing additional software, API keys, etc.).
- If showing an error, wrap the call in
try()instead - Consider custom predicates (e.g.,
googlesheets4::sheets_has_token()) withif ()blocks - Sometimes
interactive()can be used as the condition - Lengthy examples (> 5 sec) can use
\donttest{}
Never Comment Out Code in Examples
# BAD - Will be rejected
#' @examples
#' # my_function(x) # Don't do this!
CRAN's guidance: "Examples/code lines in examples should never be commented out. Ideally find toy examples that can be regularly executed and checked."
Guarding Examples with Suggested Packages
Use @examplesIf for entire example sections requiring suggested packages:
#' @examplesIf rlang::is_installed("dplyr")
#' library(dplyr)
#' my_data %>% my_function()
For individual code blocks within examples:
#' @examples
#' if (rlang::is_installed("dplyr")) {
#' library(dplyr)
#' my_data %>% my_function()
#' }
DESCRIPTION Title Field
CRAN enforces strict Title requirements:
Use Title Case
Capitalize all words except articles like 'a', 'the'. Use tools::toTitleCase() to help format.
Avoid Redundancy
Common phrases that get flagged:
- "A Toolkit for" → Remove
- "Tools for" → Remove
- "for R" → Remove
Examples:
# BAD
Title: A Toolkit for the Construction of Modeling Packages for R
# GOOD
Title: Construct Modeling Packages
# BAD
Title: Command Argument Parsing for R
# GOOD
Title: Command Argument Parsing
Quote Software/Package Names
Put all software and R package names in single quotes:
# GOOD
Title: Interface to 'Tiingo' Stock Price API
Length Limit
Keep titles under 65 characters.
DESCRIPTION Description Field
Never Start With Forbidden Phrases
CRAN will reject descriptions starting with:
- "This package"
- Package name
- "Functions for"
# BAD
Description: This package provides functions for rendering slides.
Description: Functions for rendering slides to different formats.
# GOOD
Description: Render slides to different formats including HTML and PDF.
Expand to 3-4 Sentences
Single-sentence descriptions are insufficient. Provide a broader description of:
- What the package does
- Why it may be useful
- Types of problems it helps solve
# BAD (too short)
Description: Render slides to different formats.
# GOOD
Description: Render slides to different formats including HTML and PDF.
Supports custom themes and progressive disclosure patterns. Integrates
with 'reveal.js' for interactive presentations. Designed for technical
presentations and teaching materials.
Quote Software Names, Not Functions
# BAD
Description: Uses 'case_when()' to process data.
# GOOD
Description: Uses case_when() to process data with 'dplyr'.
Software, package, and API names get single quotes (including 'R'). Function names do not.
Expand All Acronyms
All acronyms must be fully expanded on first mention:
# BAD
Description: Implements X-SAMPA processing.
# GOOD
Description: Implements Extended Speech Assessment Methods Phonetic
Alphabet (X-SAMPA) processing.
Publication Titles Only in Double Quotes
Only use double quotes for publication titles, not for phrases or emphasis:
# BAD
Description: Handles dates like "the first Monday of December".
# GOOD
Description: Handles dates like the first Monday of December.
URL and Link Validation
All URLs Must Use HTTPS
CRAN requires https:// protocol for all URLs. HTTP links will be rejected.
# BAD
URL: http://paleobiodb.org/
# GOOD
URL: https://paleobiodb.org/
No Redirecting URLs
CRAN rejects URLs that redirect to other locations. Example rejection:
Found the following (possibly) invalid URLs:
URL: https://h3geo.org/docs/core-library/coordsystems#faceijk-coordinates
(moved to https://h3geo.org/docs/core-library/coordsystems/)
Use urlchecker Package
# Find redirecting URLs
urlchecker::url_check()
# Automatically update to final destinations
urlchecker::url_update()
Ignore URLs That Will Exist After Publication
Some URLs that don't currently resolve will exist once the package is published on CRAN. These should NOT be changed:
- CRAN badge URLs (e.g.,
https://cran.r-project.org/package=pkgname) - CRAN status badges (e.g.,
https://www.r-pkg.org/badges/version/pkgname) - CRAN check results (e.g.,
https://cranchecks.info/badges/pkgname) - Package documentation URLs on r-universe or pkgdown sites that deploy after release
When urlchecker::url_check() flags these URLs, leave them as-is. They are aspirational URLs that will work once the package is on CRAN.
Check for Invalid File URIs
Relative links in README must exist after package build. Common issue:
Found the following (possibly) invalid file URI:
URI: CODE_OF_CONDUCT.md
From: README.md
This occurs when files are in .Rbuildignore. Solutions:
- Remove file from
.Rbuildignore - Use
usethis::use_code_of_conduct()which generates sections without relative links
Administrative Requirements
Copyright Holder Role
Always add [cph] role to Authors field, even if you're the only author:
# Required
Authors@R: person("John", "Doe", role = c("aut", "cre", "cph"))
Posit-Supported Packages
For packages in Posit-related GitHub organizations (posit-dev, rstudio, r-lib, tidyverse, tidymodels) or maintained by someone with a @posit.co email address, include Posit Software, PBC as copyright holder and funder:
Authors@R: c(
person("Jane", "Doe", role = c("aut", "cre"),
email = "jane.doe@posit.co"),
person("Posit Software, PBC", role = c("cph", "fnd"),
comment = c(ROR = "03wc8by49"))
)
LICENSE Year
Update LICENSE year to current submission year:
# If LICENSE shows 2024 but submitting in 2026
# Update: 2024 → 2026
Method References
CRAN may ask:
If there are references describing the methods in your package, please add these in the description field...
If there are no references, reply to the email explaining this. Consider adding a preemptive note in cran-comments.md:
## Method References
There are no published references describing the methods in this package.
The package implements original functionality for [brief description].
Key Files to Review
Work through these files systematically:
- DESCRIPTION: Title, Description, Authors@R, URLs, License year
- R/*.R: Function documentation (
@return,@examples,@examplesIf,@noRd) - README.Rmd (if exists): Edit this file (NOT README.md), then run
devtools::build_readme() - README.md: Review for install instructions, relative links, URLs. Only edit directly if no README.Rmd exists
- cran-comments.md: Preemptive notes for reviewers
- NEWS.md: Version notes for this release
- .Rbuildignore: Files referenced in README
Common Fix Patterns
DESCRIPTION Title:
# Before
Title: A Toolkit for the Construction of Modeling Packages for R
# After
Title: Construct Modeling Packages
DESCRIPTION Description:
# Before
Description: This package provides functions for rendering slides.
# After
Description: Render slides to different formats including HTML and PDF.
Supports custom themes and progressive disclosure. Integrates with
'reveal.js' for interactive presentations.
Function Documentation:
# Before - Missing @return
#' Calculate total
#' @param x Values
#' @export
calc_total <- function(x) sum(x)
# After - Complete documentation
#' Calculate total
#' @param x Numeric values to sum
#' @return A numeric value representing the sum
#' @examples
#' calc_total(1:10)
#' @export
calc_total <- function(x) sum(x)
Useful Tools
tools::toTitleCase()- Format titles with proper capitalizationurlchecker::url_check()- Find problematic URLsurlchecker::url_update()- Fix redirecting URLsusethis::use_news_md()- Create NEWS.mdusethis::use_cran_comments()- Create cran-comments.mddevtools::build_readme()- Re-render README.md from README.Rmdusethis::use_code_of_conduct()- Add CoC without relative linksusethis::use_build_ignore()- Ignore files in R package buildusethis::use_package()- Add a package dependency to DESCRIPTIONusethis::use_tidy_description()- Tidy up DESCRIPTION formatting
Final Verification Checklist
Use this checklist to ensure nothing is missed before submission:
Files and Structure
-
NEWS.mdexists and documents changes for this version -
cran-comments.mdexists with submission notes - If README.Rmd exists, it was edited (not README.md) and
devtools::build_readme()was run - README includes valid install instructions (
install.packages("pkgname")) - README has no relative links (all links are full URLs or removed)
DESCRIPTION File
-
Title:uses title case -
Title:has no redundant phrases ("A Toolkit for", "Tools for", "for R") -
Title:quotes all software/package names in single quotes -
Title:is under 65 characters -
Description:does NOT start with "This package", package name, or "Functions for" -
Description:is 3-4 sentences explaining purpose and utility -
Description:quotes software/package/API names (including 'R') but NOT function names -
Description:expands all acronyms on first mention -
Description:uses double quotes only for publication titles -
Authors@R:includes copyright holder with[cph]role - For Posit packages: Includes
person("Posit Software, PBC", role = c("cph", "fnd"), comment = c(ROR = "03wc8by49")) - LICENSE year matches current submission year
Function Documentation
- All exported functions with
.Rdfiles have@returndocumentation - All documented exported functions with meaningful returns have
@examples - S3 methods with
@export-only roxygen blocks are correctly exempt (no.Rdfile, no@return/@examplesneeded) - S3 generics added by the package have full documentation (
@return,@examples) since they are ordinary exported functions - No example sections use commented-out code
- Examples avoid
\dontrun{}unless truly necessary - Examples requiring suggested packages use
@examplesIforifguards - Un-exported functions with examples use
:::notation or@noRd
URLs and Links
-
urlchecker::url_check()was run - All URLs use https protocol (no http links)
- No redirecting URLs (except aspirational CRAN badge URLs)
- Aspirational URLs (CRAN badges, etc.) are left as-is
- No relative links in README that reference
.Rbuildignorefiles
Optional but Recommended
- If concerns about method references, added preemptive note to
cran-comments.md - Reviewed bundled file licensing if including third-party files
FAQ
What does the r-cran-extrachecks skill do?
Prepare R packages for CRAN submission by checking for common ad-hoc requirements not caught by devtools::check(). Use when: (1) Preparing a package for first CRAN release, (2) Preparing a package update for CRAN resubmission, (3) Reviewing a package to ensure CRAN compliance, (4) Responding to CRAN reviewer feedback. Covers documentation requirements, DESCRIPTION field standards, URL validation, examples, and administrative requirements.
How do I install r-cran-extrachecks?
Run npx skills add https://github.com/posit-dev/skills --skill r-cran-extrachecks in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/r-cran-extrachecks/ (personal) or .claude/skills/r-cran-extrachecks/ (project).
Which AI agents can use r-cran-extrachecks?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is r-cran-extrachecks safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains r-cran-extrachecks?
It is published by posit-dev in posit-dev/skills. It has 67 recorded installs.
More from posit-dev/skills
quarto-authoring
posit-dev/skills
Use when the user is explicitly working with Quarto, .qmd files, quarto.yml, Quarto projects, or Quarto features such as callouts, cross-references, citations, Mermaid diagrams, extensions, websites, books, presentations, and reports. Also use for explicit migration from or comparison with R Markdown, bookdown, blogdown, xaringan, distill, or Jupyter notebooks to Quarto. Do not use for general R Markdown or related-format questions unless Quarto or migration to Quarto is explicitly mentioned.
critical-code-reviewer
posit-dev/skills
Rigorously review code or pull requests for correctness, security, accessibility, maintainability, tests, and edge cases. Use when users request a critical code review, want a guided walkthrough of findings, need implementer-facing feedback, or want to prepare, create, or submit a GitHub pull request review.
brand-yml
posit-dev/skills
Create and use brand.yml files for consistent branding across Shiny apps and Quarto documents. Covers: (1) Creating new brand.yml files, (2) Applying to Shiny (R and Python), (3) Using in Quarto, (4) Modifying existing files, and (5) Troubleshooting. Includes complete specifications and integration guides.
r-package-development
posit-dev/skills
R package development with devtools, testthat, and roxygen2. Use when the user is working on an R package, running tests, writing documentation, or building package infrastructure.
shiny-bslib
posit-dev/skills
Build modern Shiny dashboards and applications using bslib (Bootstrap 5). Use when creating new Shiny apps, modernizing legacy apps (fluidPage, fluidRow/column, tabsetPanel, wellPanel, shinythemes), or working with bslib page layouts, grid systems, cards, value boxes, navigation, sidebars, filling layouts, theming, accordions, tooltips, popovers, toasts, or bslib inputs. Assumes familiarity with basic Shiny.
describe-design
posit-dev/skills
Research a codebase and create architectural documentation describing how features or systems work. Use when the user asks to: (1) Document how a feature works, (2) Create an architecture overview, (3) Explain code structure for onboarding or knowledge transfer, (4) Research and describe a system's design. Produces markdown documents with Mermaid diagrams and stable code references suitable for humans and AI agents.
Popular security skills
azure-compliance
microsoft/azure-skills
Run Azure compliance and security audits with azqr plus Key Vault expiration checks. Covers best-practice assessment, resource review, policy/compliance validation, and security posture checks. WHEN: compliance scan, security audit, BEFORE running azqr (compliance cli tool), Azure best practices, Key Vault expiration check, expired certificates, expiring secrets, orphaned resources, compliance assessment.
minimal-run-and-audit
lllllllama/rigorpilot-skills
Rigor Run skill for README-first deep learning repo reproduction. Use when the task is specifically to capture or normalize evidence from the selected smoke test or documented inference or evaluation command and write standardized reprooutputs/ files, including patch notes when repository files changed. Do not use for training execution, initial repo intake, generic environment setup, paper lookup, target selection, hidden scientific-meaning changes, or end-to-end orchestration by itself.
seo-audit
coreyhaines31/marketingskills
When the user wants to audit, review, or diagnose SEO issues on their site. Also use when the user mentions "SEO audit," "technical SEO," "why am I not ranking," "SEO issues," "on-page SEO," "meta tags review," "SEO health check," "my traffic dropped," "lost rankings," "not showing up in Google," "site isn't ranking," "Google update hit me," "page speed," "core web vitals," "crawl errors," "indexing issues," "stuck on page 2," "striking distance keywords," "title tag rewrite," "low CTR," "local SEO," "Google Business Profile," or "map pack." Use this even if the user just says something vague like "my SEO is bad" or "help with SEO" — start with an audit. For building pages at scale to target keywords, see programmatic-seo. For adding structured data, see schema. For AI search optimization, see ai-seo.
firebase-security-rules-auditor
firebase/agent-skills
Audits Firebase (Firestore, Cloud Storage) security rules for vulnerabilities, privilege escalation, role bypasses, create vs update inconsistencies, resource exhaustion, type safety, size limits, and hasOnly ownership checks. Use when auditing/reviewing rules, running red-team rule assessments, or scoring against auditor checklists. Don't use for Firebase CLI (login, deploy), Auth, Crashlytics, Remote Config, or database queries.
audit
pbakaus/impeccable
Run technical quality checks across accessibility, performance, theming, responsive design, and anti-patterns. Generates a scored report with P0-P3 severity ratings and actionable plan. Use when the user wants an accessibility check, performance audit, or technical quality review.
competitors
coreyhaines31/marketingskills
When the user wants to create competitor comparison or alternative pages for SEO and buyer-facing use. Also use when the user mentions 'alternative page,' 'vs page,' 'competitor comparison,' 'comparison page,' '[Product] vs [Product],' '[Product] alternative,' 'competitive landing pages,' 'how do we compare to X,' 'competitor teardown,' 'audit our competitor pages,' 'are our comparison pages out of date,' or 'competitive asset audit.' Use this for any content that positions your product against competitors. Covers four formats: singular alternative, plural alternatives, you vs competitor, and competitor vs competitor. For auditing existing claims (not researching competitors from scratch, which is competitor-profiling; not technical SEO on these pages, which is seo-audit), use the asset audit here. For internal battle cards and sales-specific competitor docs, see sales-enablement.