From rap
Audit an R project against UK Government RAP compliance levels (Baseline, Silver, Gold)
How this skill is triggered — by the user, by Claude, or both
Slash command
/rap:rap-checkThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
```text
$ARGUMENTS
You are auditing the current R project against the UK Government Reproducible Analytical Pipelines (RAP) maturity levels. There are three cumulative levels: Baseline (5 checks), Silver (9 checks, requires all Baseline), and Gold (4 checks, requires all Silver).
First, check whether the current directory is an R project:
.R files, DESCRIPTION, or .Rproj files.This directory does not appear to be an R project.
Run `/rap-init` to scaffold a new RAP-compliant R project, or navigate
to an existing R project directory.
Then stop — do not proceed with checks.
DESCRIPTION exists, extract Package: value.Run each check using the tools available to you (Read, Grep, Glob, Bash). Record the result as PASS, FAIL, or PARTIAL with a brief detail.
| ID | Requirement | How to Check |
|---|---|---|
| B1 | Code in open-source language | Use Glob to find **/*.R or **/*.r files. PASS if at least one found. |
| B2 | Version controlled with Git | Check if .git/ directory exists. |
| B3 | README with reproduction steps | Check README.md exists. Grep for headings containing "run", "getting started", "reproduce", "steps", or "how to". PASS if file exists and contains at least one such heading. PARTIAL if file exists but lacks reproduction steps. |
| B4 | Code has been peer reviewed | Run git log --oneline --merges and check for merge commits. Alternatively check for CONTRIBUTING.md. PASS if either found. PARTIAL if repo is new with no history. |
| B5 | Code is published openly | Run git remote -v and check for a remote pointing to github.com, gitlab.com, or similar public host. |
Only evaluate Silver if the user requests it or if all Baseline checks pass.
| ID | Requirement | How to Check |
|---|---|---|
| S1 | Minimal manual intervention | Look for _targets.R, a run_all.R script, or a Makefile. PARTIAL if only numbered scripts exist (e.g. 01_*.R, 02_*.R). |
| S2 | Comprehensive documentation | Grep for roxygen2 comments (#' @) in R files. Check README length (> 50 lines). PASS if both present. |
| S3 | Standard directory structure | Check for R/ directory containing .R files. |
| S4 | Reusable functions | Grep for function( in R/ files. PASS if 3 or more function definitions found. |
| S5 | Coding standards | Check for .lintr config file. Alternatively check for styler in DESCRIPTION or scripts. |
| S6 | Testing framework | Check for tests/testthat/ directory with at least one test-*.R or test_*.R file. |
| S7 | Dependency management | Check for renv.lock file. |
| S8 | Automatic logging | Grep across R files for logger::, log_info, log_warn, log_error, message(, or futile.logger. PASS if found in at least 2 files. |
| S9 | Tidy data format | Grep across R files for tidyverse patterns: dplyr::, tidyr::, %>%, ` |
Only evaluate Gold if all Silver checks pass.
| ID | Requirement | How to Check |
|---|---|---|
| G1 | Fully packaged | Check that DESCRIPTION has a Package: field AND a NAMESPACE file exists. |
| G2 | CI/CD automation | Check for .github/workflows/*.yml files, or .gitlab-ci.yml. |
| G3 | Event/schedule triggers | Read CI config files and check for trigger definitions (on: push, on: schedule, on: pull_request). |
| G4 | Changelog & versioning | Check for NEWS.md or CHANGELOG.md. Check that DESCRIPTION has a Version: field. |
The levels are cumulative:
A PARTIAL counts as not achieved for level calculation but should be noted.
Use this format:
## RAP Compliance Report
**Project**: <project-name>
**Current Level**: BASELINE ✓/✗ | SILVER ✓/✗ | GOLD ✓/✗
### Baseline (<pass-count>/5)
- ✓/✗ B1: <requirement> (<detail>)
- ✓/✗ B2: <requirement> (<detail>)
- ✓/✗ B3: <requirement> (<detail>)
- ✓/✗ B4: <requirement> (<detail>)
- ✓/✗ B5: <requirement> (<detail>)
### Silver (<pass-count>/9)
- ✓/✗ S1: <requirement> (<detail>)
...
### Gold (<pass-count>/4) [or "not evaluated — complete Silver first"]
- ✓/✗ G1: <requirement> (<detail>)
...
### Next Steps
<numbered list of actionable steps to reach the next level>
For each FAIL or PARTIAL check, include specific remediation:
| Check | Remediation |
|---|---|
| B2 | Run git init to initialise version control |
| B3 | Add reproduction steps under a "How to Run" heading in README.md |
| B4 | Open a pull request and have a colleague review your code |
| B5 | Push to GitHub: git remote add origin <url> then git push |
| S1 | Run /rap-pipeline to configure {targets} automation |
| S5 | Run lintr::use_lintr(type = "tidyverse") to create .lintr config |
| S6 | Run /rap-test to set up testthat framework |
| S7 | Run renv::init() to create renv.lock |
| S8 | Add library(logger) and use log_info() in your pipeline scripts |
| G1 | Run usethis::use_namespace() and ensure DESCRIPTION has a Package field |
| G2 | Add a GitHub Actions workflow: usethis::use_github_action("check-standard") |
| G4 | Run usethis::use_news_md() to create NEWS.md |
Handle these situations gracefully:
No R/ directory: If R/ does not exist but .R files exist at the root, still run checks but note in S3 that the standard directory structure is not followed.
Git not initialised: If .git/ does not exist, B2 FAILS. Guidance: "Run git init or /rap-init to initialise version control."
packrat instead of renv: If packrat/packrat.lock exists but renv.lock does not, mark S7 as PARTIAL: "Using {packrat} — consider migrating to {renv}."
Non-standard test directory: If tests/ exists but not tests/testthat/, mark S6 as PARTIAL: "Test directory found but not using {testthat} framework."
Multiple .Rproj files: Use the first one found and note it.
Large repositories: If R/ contains more than 50 files, summarise rather than listing every check detail.
End your response with:
RAP Maturity Levels are defined by the NHS RAP Community of Practice based on the UK Government Analysis Function RAP strategy. Achieving higher levels improves reproducibility, transparency, and efficiency of official statistics production.
Learn more:
npx claudepluginhub ivyleavedtoadflax/rapskill --plugin rapCreates an R project structure compliant with GxP regulations (21 CFR Part 11, EU Annex 11) including validation documentation, qualification protocols, and change control.
Provides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.