A Claude Code plugin that helps analysts implement Reproducible Analytical Pipelines (RAP) in R and Python, based on the UK Government Analysis Function methodology.
RAP applies software engineering best practices — version control, automated testing, dependency management, and build automation — to the production of official statistics, replacing manual spreadsheet processes with reproducible, auditable code.
Claude Code has a built-in plugin marketplace. No bootstrap or shell commands required.
In Claude Code, run:
/plugin marketplace add ivyleavedtoadflax/RapSkill
/plugin install rap
This installs 10 RAP skill files into your project, making them available as slash commands.
/rap-init my-statistics-pipeline # R project
/rap-py-init my-statistics-pipeline # Python project
| Command | Description |
|---|---|
/rap-init [name] |
Scaffold a RAP-compliant R project with standard directory structure, configuration files, and starter templates |
/rap-check |
Audit your R project against the three UK government RAP maturity levels (Baseline, Silver, Gold) |
/rap-output <type> |
Generate accessible statistical outputs: spreadsheet (a11ytables), charts (GOV.UK theme), report (R Markdown) |
/rap-test |
Set up testthat infrastructure and generate test skeletons for existing R functions |
/rap-pipeline |
Configure {targets} build automation with a dependency-aware _targets.R |
| Command | Description |
|---|---|
/rap-py-init [name] |
Scaffold a RAP-compliant Python project with src/ layout, pyproject.toml, and uv dependency management |
/rap-py-check |
Audit your Python project against the three UK government RAP maturity levels (Baseline, Silver, Gold) |
/rap-py-output <type> |
Generate accessible statistical outputs: spreadsheet (gptables), charts (matplotlib GOV.UK theme), report (Jupyter notebook or Quarto) |
/rap-py-test |
Set up pytest infrastructure and generate test skeletons for existing Python functions |
/rap-py-pipeline [type] |
Configure build automation: make (default, Makefile) or dvc (for complex data pipelines) |
The UK government defines three cumulative levels of RAP compliance. /rap-check and /rap-py-check audit your project against all 18 checks.
- Code written in an open-source language (R or Python)
- Version controlled with Git
- Repository includes README with reproduction steps
- Code has been peer reviewed
- Code is published openly
| Requirement | R Tooling | Python Tooling |
|---|---|---|
| Minimal manual intervention | {targets} | Makefile / DVC |
| Comprehensive documentation | roxygen2 | Docstrings (numpy-style) |
| Standard directory structure | R/ package layout |
src/ package layout |
| Reusable functions | R functions | Python functions |
| Coding standards | lintr / styler | ruff |
| Testing framework | testthat | pytest |
| Dependency management | renv | uv |
| Automatic logging | {logger} | logging (stdlib) |
| Tidy data format | tidyverse | pandas |
| Requirement | R Tooling | Python Tooling |
|---|---|---|
| Fully packaged | R package (NAMESPACE) | Python package (pyproject.toml + build-system) |
| CI/CD automation | GitHub Actions | GitHub Actions |
| Event/schedule triggers | CI triggers | CI triggers |
| Changelog & versioning | NEWS.md | CHANGELOG.md |
RapSkill/
├── plugins/rap/
│ ├── manifest.yml # Plugin manifest
│ ├── skills/ # RAP skill files (installed by /plugin install)
│ │ ├── rap-init/ # R project scaffolding
│ │ ├── rap-check/ # R compliance audit
│ │ ├── rap-output/ # R accessible outputs
│ │ ├── rap-test/ # R testing setup
│ │ ├── rap-pipeline/ # R build automation
│ │ ├── rap-py-init/ # Python project scaffolding
│ │ ├── rap-py-check/ # Python compliance audit
│ │ ├── rap-py-output/ # Python accessible outputs
│ │ ├── rap-py-test/ # Python testing setup
│ │ └── rap-py-pipeline/ # Python build automation
│ └── templates/
│ ├── r-project/ # R project scaffolding templates
│ ├── output/ # R output generation templates
│ ├── test/ # R testing templates
│ ├── pipeline/ # R build automation templates
│ ├── python-project/ # Python project scaffolding templates
│ ├── python-output/ # Python output generation templates
│ ├── python-test/ # Python testing templates
│ └── python-pipeline/ # Python build automation templates
└── specs/ # Feature specifications
- Government Analysis Function — RAP
- RAP Strategy
- NHS RAP Community of Practice
- Building Reproducible Analytical Pipelines with R
- RAP Companion
- Code of Practice for Statistics
Contributions are welcome. To add or improve RAP skills:
- Fork this repository
- Create a feature branch from
main - Make your changes
- Open a pull request for review
Skill files are Markdown with YAML frontmatter — see plugins/rap/skills/ for examples.
MIT