REFERENCE.md told a README reader to run renv::restore() on the host. For anything the R scaffolds produce that is wrong: renv::init() is the user's post-scaffold step, and renv::restore() then runs inside the image build (containerize-project/Dockerfile.r-*.tpl), so the reader's entry point is 'just build-dev' then 'just up'. The rule is now stated as evidence — justfile, Dockerfile, lockfile — with 'omit the section' as the fallback, since a bare restore is right only for a repo with a committed lockfile and no container. build-r-package pointed at a README 'Out of scope' heading that does not exist; it now names generic write-readme, which already covers r-package, and blueprint 001 for the dedicated skill. Blueprint 001 was sounded against the earlier, half-right reading and is corrected with it: the install clause now says what the Dockerfiles do, and the REFERENCE fix leaves its seam list and Out of scope, having landed here instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3.0 KiB
3.0 KiB
name: build-r-package
description: Scaffold an R package: renv + justfile + DESCRIPTION + testthat ed. 3; Docker via containerize-project.
disable-model-invocation: true
build-r-package
When to use
- User says "new R package", "scaffold R package", "/build-r-package".
- A fresh empty directory needs the renv + rocker + DESCRIPTION setup.
Inputs to collect (one grouped prompt)
- Package name (letters, numbers, dots; starts with a letter; no trailing dot). Validate.
- Author name + email for
Authors@R. - One-line title (sentence-case, no trailing period).
- One-paragraph description.
- License (default:
MIT + file LICENSE).
Process
- Confirm target directory is empty (or user-confirmed override).
- Materialise files from sibling templates:
<package>/ ├── R/<package>-package.R ├── tests/testthat/test-<package>.R ├── justfile ← justfile.tpl ├── DESCRIPTION ← DESCRIPTION.tpl └── .gitignore ← gitignore.tpl - Delegate Docker to
/containerize-project(r-package variant): it writesDockerfile,docker-compose.yml,.dockerignore, and appends the Docker recipes to the justfile. - Stop. Do not run
jj describe. Tell the user:"Review with
jj diff. Then runjust build-dev→just up→R -e 'renv::init()'to lock dependencies; thenjust documentandjust check. Describe the change with/commit-atomic-jjwhen satisfied." - Suggest
/write-readme, which already covers r-package; its dedicated R counterpart is blueprint 001, still a draft.
Placeholders used by templates
<package-name>— R package name (validated above).<author-name>,<author-email>— forAuthors@R.<title>— one-line title.<description>— one-paragraph description.<license>— defaultMIT + file LICENSE.
Guardrails
- Never scaffold into a non-empty directory without confirmation.
- Never invoke
jj describe— first commit is the user's call. - Never invoke
renv::init()for the user —renv.lockshould be generated from inside the container so the lock matches the runtime. - Never generate
NAMESPACEhere — it's roxygen2's job, run viajust documentafter the first edit. R/is empty by design apart from<package>-package.R. Don't invent stub functions.
See also
../containerize-project/SKILL.md— owns the Docker templates and the three-stage pattern rationale.../../engineering/develop-r/SKILL.md— workflow auto-detects DESCRIPTION → R-package loop.../../engineering/style-r/SKILL.md— coding standards every function inR/must follow.