R package development assistant for serocalculator - estimating infection rates from serological data. Follows UCD-SERG lab standards, automates documentation generation, testing, linting, and ensures CI compliance.
This skill helps you develop and maintain the serocalculator R package, which estimates infection rates from serological data. It follows UCD-SERG lab manual standards and automates common development workflows.
The repository includes `.github/workflows/copilot-setup-steps.yml` which automatically configures your environment when you start working. If this workflow runs successfully, skip manual setup.
For manual setup: R >= 4.1.0 required with devtools, rcmdcheck, lintr, spelling, testthat packages.
Before any development work:
```r
devtools::install_dev_deps(dependencies = TRUE)
devtools::dev_sitrep()
devtools::load_all()
```
**CRITICAL**: Always run this step when starting work on a PR to avoid missing dependency issues.
When modifying R code:
1. **BEFORE changing any function**: Create value-based unit tests in `tests/testthat/` to lock in current behavior
- Use snapshot tests for complex outputs: `expect_snapshot_value()`
- Use direct comparisons for simple cases: `expect_equal()`
2. Make your code changes in `R/` directory
3. Update roxygen2 comments above functions (parameters, return values, examples)
4. **ALWAYS regenerate documentation** after changes:
```r
devtools::document()
```
5. If you modified README content, edit `README.Rmd` (never `README.md` directly), then:
```r
rmarkdown::render("README.Rmd")
```
Run these checks in order before committing:
**Linting** (must pass before other checks):
```r
devtools::load_all() # REQUIRED before linting
lintr::lint_package()
```
Fix any issues. Key rules: use `|>` not `%>%`, snake_case naming, no trailing whitespace.
**Testing**:
```r
devtools::test()
```
All tests must pass. Add new tests for new functionality.
**Spelling**:
```r
spelling::spell_check_package()
```
Add legitimate terms to `inst/WORDLIST` if needed.
**Full Package Check**:
```r
devtools::check()
```
Must complete with 0 errors, 0 warnings, 0 notes (5-10 minutes).
Before submitting a PR, ensure:
1. **Version increment**: Run `usethis::use_version()` to bump version in DESCRIPTION
2. **NEWS.md update**: Add bullet point under development version header describing your changes (or add `no-changelog` label if change doesn't warrant entry)
3. **Documentation sync**: Verify `man/` and `NAMESPACE` are up to date (should be if you ran `devtools::document()`)
4. All validation checks pass (see step 3)
These workflows run automatically on PRs (all must pass for merge):
**PR Commands** (comment on PR to trigger):
**Documentation out of sync**: Run `devtools::document()` and commit changes
**Version not incremented**: Run `usethis::use_version()`
**Linting failures**: Check `.lintr` for custom rules. Common: wrong pipe operator, trailing whitespace
**Compilation errors**: Ensure C++ compiler installed (Rtools on Windows, Xcode tools on macOS, build-essential on Linux)
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/serocalculator-development/raw