Install any skill in seconds. Free to start, no credit card required.
Get Started Free →posit-dev/testing-r-packages
Best practices for writing R package tests using testthat version 3+.
Passed 22 of 22 test cases with the skill, and 18 of 22 without it.
and 1 more in the full report
4 fixed18 passed either way0 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 4 test cases the skill fixed. Same model, same prompt, with and without the skill.
In testthat 3.3.0+, I want to assert that two vectors `set_a` and `set_b` have no overlapping elements. What expectation function checks that two sets are completely disjoint?
| Checked | Without skill | With skill |
|---|---|---|
| Recommends using expect_disjoint() | Missed | Passed |
The instructions your model reads when the skill loads.
Modern best practices for R package testing using testthat 3+.
Initialize testing with testthat 3rd edition:
usethis::use_testthat(3)
This creates tests/testthat/ directory, adds testthat to DESCRIPTION Suggests with Config/testthat/edition: 3, and creates tests/testthat.R.
Mirror package structure:
R/foofy.R → tests in tests/testthat/test-foofy.Rusethis::use_r("foofy") and usethis::use_test("foofy") to create paired filesSpecial files:
helper-*.R - Helper functions and custom expectations, sourced before testssetup-*.R - Run during R CMD check only, not during load_all()fixtures/ - Static test data files accessed via test_path()Tests follow a three-level hierarchy: File → Test → Expectation
test_that("descriptive behavior", {
result <- my_function(input)
expect_equal(result, expected_value)
})
Test descriptions should read naturally and describe behavior, not implementation.
test cases passed, vs 18 / 22 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.