Lukasz Boryn e6f92335f9 docs(okf): cite registers with a B-/R- prefix in prose
Blueprints and the why-register number independently, so 013, 017 and
019 each already name two unrelated pages. A markdown link is safe —
its path says which — but a bare number in prose is not. Prose now
takes a register prefix: B-NNN blueprint, R-NNN why-register, D-n
ferry decision. Filenames, link targets, index labels and
superseded-by-NNN status values are untouched.

- adds decision 022 with the reasoning, including why D- was rejected:
  D-<n> already names a ferry decision on disk and in CONTEXT.md, so
  reusing it would fuse two namespaces that today collide only in type:
- CONTEXT.md states the rule in the intro; 109 of 110 after compressing
  the entry twice, since R-020 gives it no growth path short of a split
  it does not qualify for
- retrofits the live pages rather than applying it forward-only, which
  would leave two dialects — the defect phase 10 exists to remove
- ROADMAP.md:43, :84, :87, :94 and 021:32; moor and build-r-package
  each carried one genuinely ambiguous cite

LEARNINGS.md is deliberately not retrofitted: it is append-only by its
own header, so its bare numbers stand and new entries carry the prefix.
Locked blueprints are left as written for the same reason.

Nothing enforces this yet — a bare three-digit number outside a link is
a lint the okf-check blueprint should carry, or the rule decays exactly
as R-020 prune did. okf-check 0 errors, skill-check 0 errors.
2026-07-30 17:24:17 +02:00

70 lines
3.0 KiB
Markdown

---
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
1. **Confirm target directory** is empty (or user-confirmed override).
2. **Materialise files** from sibling templates:
```
<package>/
├── R/<package>-package.R
├── tests/testthat/test-<package>.R
├── justfile ← justfile.tpl
├── DESCRIPTION ← DESCRIPTION.tpl
└── .gitignore ← gitignore.tpl
```
3. **Delegate Docker** to
[`/containerize-project`](../containerize-project/SKILL.md)
(r-package variant): it writes `Dockerfile`, `docker-compose.yml`,
`.dockerignore`, and appends the Docker recipes to the justfile.
4. **Stop. Do not run `jj describe`.** Tell the user:
> "Review with `jj diff`. Then run `just build-dev` → `just up` → `R
> -e 'renv::init()'` to lock dependencies; then `just document` and
> `just check`. Describe the change with
> [`/commit-atomic-jj`](../../productivity/commit-atomic-jj/SKILL.md) when satisfied."
5. **Suggest** [`/write-readme`](../../engineering/write-readme/SKILL.md),
which already covers r-package; its dedicated R counterpart is
B-001, still a draft.
## Placeholders used by templates
- `<package-name>` — R package name (validated above).
- `<author-name>`, `<author-email>` — for `Authors@R`.
- `<title>` — one-line title.
- `<description>` — one-paragraph description.
- `<license>` — default `MIT + 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.lock` should be
generated from inside the container so the lock matches the runtime.
- **Never** generate `NAMESPACE` here — it's roxygen2's job, run via
`just document` after the first edit.
- **`R/` is empty by design** apart from `<package>-package.R`. Don't
invent stub functions.
## See also
- [`../containerize-project/SKILL.md`](../containerize-project/SKILL.md)
— owns the Docker templates and the three-stage pattern rationale.
- [`../../engineering/develop-r/SKILL.md`](../../engineering/develop-r/SKILL.md)
— workflow auto-detects DESCRIPTION → R-package loop.
- [`../../engineering/style-r/SKILL.md`](../../engineering/style-r/SKILL.md)
— coding standards every function in `R/` must follow.