Runs R CMD check to verify package structure, documentation, and code quality, ensuring CRAN-like standards.

Install

mkdir -p .claude/skills/cmd-check && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10451" && unzip -o skill.zip -d .claude/skills/cmd-check && rm skill.zip

Installs to .claude/skills/cmd-check

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

GitHub Copilot Chat Assistant
29 chars · catalog descriptionno explicit “when” trigger
Intermediate

Key capabilities

  • Execute R package validation checks
  • Identify syntax errors and broken NAMESPACE files
  • Detect missing package dependencies
  • Generate CRAN-style quality reports
  • Provide actionable feedback for documentation mismatches

How it works

The tool runs R CMD check to verify package structure and documentation against quality standards. It utilizes devtools for standard development loops or rcmdcheck for programmatic control.

Inputs & outputs

You give it
R package source code
You get back
Validation report containing errors, warnings, and notes

When to use cmd-check

  • Validate R package before merging to main
  • Run CRAN-style package checks locally
  • Fix documentation mismatches in NAMESPACE

About this skill

GitHub Copilot Chat Assistant


name: cmd-check trigger: run R CMD check / check package / validate package description: Enforce and explain R CMD check for R packages. Use when verifying code quality before merging or completing a task.

R CMD check

Run R CMD check to ensure the package structure, documentation, and code meet CRAN-like quality standards. Per the standard workflow in AGENTS.md, this should be run after tests pass.

Running checks

Use devtools::check() for the standard development loop. Use rcmdcheck for more detailed programmatic control or CI-like local runs.

# Standard check (as defined in AGENTS.md)
devtools::check(error_on = "warning")

# Comprehensive CRAN-style check
rcmdcheck::rcmdcheck(args = "--as-cran")

Interpreting results

LevelActionDescription
ERRORBlockerMust be fixed immediately. Includes failing tests, broken NAMESPACE, or invalid syntax.
WARNINGHigh PriorityShould be fixed before merging. Includes missing imports, documentation mismatches, or invalid cross-references.
NOTEReviewNon-blocking but should be minimized. Includes large file sizes, missing Title/Description fields, or global variable issues.

Common fixes

Missing dependencies

Add missing packages to the Imports (runtime) or Suggests (test/doc only) section of DESCRIPTION. Ensure all external functions are called using package::function().

Documentation out of sync

If Rd files or NAMESPACE are flagged, run:

devtools::document()

Then re-run the check.

Global variable NOTES

If check warns about "no visible binding for global variable", add the variables to R/HockeyModel-package.R or use utils::globalVariables() to quiet the note, especially when using dplyr or data.table.

Examples failing

If examples take too long or require internet access, wrap them in \dontrun{} or \donttest{} in the roxygen comments. Use @examplesIf interactive() for network-dependent functions.

Best practices

  • Check locally before PR: Always run devtools::check() before pushing to ensure CI passes.
  • Clean environment: Run checks in a fresh R session to avoid contamination from the global environment.
  • Namespace hygiene: Ensure NAMESPACE only exports intended functions. Use @keywords internal to hide helpers from the documentation index while keeping them exported if necessary.
  • News update: If fixing a check issue that affects users, add a note to NEWS.md.

References

  • rcmdcheck documentation
  • CRAN Repository Policy
  • r-lib GitHub Actions

When not to use it

  • When tests have not yet passed
  • When the environment is not clean

Limitations

  • Examples requiring internet access may fail unless wrapped in specific tags
  • Global variable notes require manual suppression via R/HockeyModel-package.R or utils::globalVariables

How it compares

Unlike manual inspection, this tool automates the detection of global variable issues and documentation sync errors through standardized R session execution.

Compared to similar skills

cmd-check side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
cmd-check (this skill)03moNo flagsIntermediate
python-testing-patterns772moReviewIntermediate
pr-review62moReviewIntermediate
pytest87moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry