用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Morrison-Lab/ai-config --skill r-package-development命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | r-package-development |
| description | R package dev with devtools, testthat, and roxygen2. |
| user-invocable | true |
| allowed-tools | ["Read","Edit","Write","Bash"] |
| metadata | {"author":"Simon P. Couch (@simonpcouch)","version":"1.2"} |
# Run code in the package
Rscript -e "devtools::load_all(); code"
# Run all tests
Rscript -e "devtools::test()"
# Run all tests for files starting with {name}
Rscript -e "devtools::test(filter = '^{name}')"
# Run all tests for R/{name}.R
Rscript -e "devtools::test_active_file('R/{name}.R')"
# Run a single test "blah" for R/{name}.R
Rscript -e "devtools::test_active_file('R/{name}.R', desc = 'blah')"
# Redocument the package
Rscript -e "devtools::document()"
# Check pkgdown documentation
Rscript -e "pkgdown::check_pkgdown()"
# Check the package with R CMD check
Rscript -e "devtools::check()"
# Format code
air format .
air format . after generating code.|>) not the magrittr pipe (%>%).\() ... for single-line anonymous functions.
For all other cases, use function() {...}.For the full testthat API (fixtures, mocking, snapshots, BDD-style tests), see testing-r-packages.
Match the package's existing expect_error()/expect_warning() or snapshot-testing style where precedent exists.
On a fresh package with no precedent, follow testing-r-packages' preference for snapshot-based error/warning tests.
R/{name}.R go in tests/testthat/test-{name}.R.expect_true() and expect_false() in favour of a specific expectation which will give a better failure message.expect_snapshot(error = TRUE) for errors and expect_snapshot() for warnings, not expect_error() or expect_warning().
A snapshot lets the user review the full text of the output._pkgdown.yml.pkgdown::check_pkgdown() to check that all topics are included in the reference index.NEWS.mdThis is the tidyverse-style default.
When the package already has an established NEWS.md style, match that existing style instead --- see r-pkg-news, whose whole job is reading a package's precedent before drafting a new entry.
NEWS.md.
Do not add bullets for small documentation changes or internal refactorings.(#123)..This skill is a day-to-day dev-loop reference (load, test, document, format) with this author's own conventions. It does not replace, and does not cover:
r-pkg-check --- running and triaging devtools::check() output.r-pkg-cran-checklist --- the CRAN release mechanics (win-builder, revdep checks, devtools::release()).cran-extrachecks --- the ad-hoc/stylistic CRAN checklist (Title case, @return tags, URL hygiene) that devtools::check() doesn't catch on its own.r-pkg-news --- matching a package's existing NEWS.md style, which overrides this skill's own default above.testing-r-packages --- the full testthat API (fixtures, mocking, snapshots, BDD-style tests).
Match the package's existing expect_error()/expect_warning() or snapshot-testing style where precedent exists.
On a fresh package with no precedent, follow testing-r-packages' preference for snapshot-based error/warning tests, which agrees with this skill's own default above.