.claude/skills/tidy-deprecate-function/SKILL.md
Guide for deprecating R functions/arguments. Use when a user asks to deprecate a function or parameter, including adding lifecycle warnings, updating documentation, adding NEWS entries, and updating tests.
npx skillsauth add r-lib/testthat tidy-deprecate-functionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when deprecating functions or function parameters in dbplyr.
This skill guides you through the complete process of deprecating a function or parameter, ensuring all necessary changes are made consistently:
lifecycle::deprecate_warn().Read the current version from DESCRIPTION and calculate the deprecation version:
MAJOR.MINOR.PATCH.9000 (development).MAJOR.(MINOR+1).0.2.5.1.9000, deprecation version is 2.6.0.lifecycle::deprecate_warn() callAdd the deprecation warning to the function:
# For a deprecated function:
function_name <- function(...) {
lifecycle::deprecate_warn("X.Y.0", "function_name()", "replacement_function()")
# rest of function
}
# For a deprecated parameter:
function_name <- function(param1, deprecated_param = deprecated()) {
if (lifecycle::is_present(deprecated_param)) {
lifecycle::deprecate_warn("X.Y.0", "function_name(deprecated_param)")
}
# rest of function
}
Key points:
lifecycle::is_present() to check if a deprecated parameter was supplied.Find all existing tests that use the deprecated function or parameter and silence lifecycle warnings. Add at the beginning of test blocks that use the deprecated feature:
test_that("existing test with deprecated feature", {
withr::local_options(lifecycle_verbosity = "quiet")
# existing test code
})
Then add a new test to verify the deprecation message in the appropriate test file (usually tests/testthat/test-{name}.R):
test_that("function_name(deprecated_param) is deprecated", {
expect_snapshot(. <- function_name(deprecated_param = value))
})
You'll need to supply any additional arguments to create a valid call.
Then run the tests and verify they pass.
For function deprecation, add to the description section:
#' @description
#' `r lifecycle::badge("deprecated")`
#'
#' This function is deprecated. Please use [replacement_function()] instead.
If the documentation does not already contain @description, you will need to add it.
For argument deprecation, add to the appropriate @param tag:
#' @param deprecated_param `r lifecycle::badge("deprecated")`
When deprecating a function or parameter in favor of a replacement, add old/new examples to the @examples section to help users migrate. These should relace all existing examples.
#' @examples
#' # Old:
#' old_function(arg1, arg2)
#' # New:
#' replacement_function(arg1, arg2)
#'
#' # Old:
#' x <- "value"
#' old_function("prefix", x, "suffix")
#' # New:
#' replacement_function("prefix {x} suffix")
Key points:
Then re-document the package.
Add a bullet point to the top of the "# dbplyr (development version)" section in NEWS.md:
# dbplyr (development version)
* `function_name(parameter)` is deprecated and will be removed in a future
version.
* `function_name()` is deprecated. Use `replacement_function()` instead.
Place the entry:
When deprecating a function or parameter, ensure you:
lifecycle::deprecate_warn() call in the function.withr::local_options(lifecycle_verbosity = "quiet") to existing tests.expect_snapshot().@examples section (for function deprecation).devtools::document() to update documentation.air format . to format code.testing
Create, edit, improve, or audit AgentSkills. Use when creating a new skill from scratch or when asked to improve, review, audit, tidy up, or clean up an existing skill or SKILL.md file. Also use when editing or restructuring a skill directory (moving files to references/ or scripts/, removing stale content, validating against the AgentSkills spec). Triggers on phrases like "create a skill", "author a skill", "tidy up a skill", "improve this skill", "review the skill", "clean up the skill", "audit the skill".
testing
Host security hardening and risk-tolerance configuration for OpenClaw deployments. Use when a user asks for security audits, firewall/SSH/update hardening, risk posture, exposure review, OpenClaw cron scheduling for periodic checks, or version status checks on a machine running OpenClaw (laptop, workstation, Pi, VPS).
testing
Create, edit, improve, or audit AgentSkills. Use when creating a new skill from scratch or when asked to improve, review, audit, tidy up, or clean up an existing skill or SKILL.md file. Also use when editing or restructuring a skill directory (moving files to references/ or scripts/, removing stale content, validating against the AgentSkills spec). Triggers on phrases like "create a skill", "author a skill", "tidy up a skill", "improve this skill", "review the skill", "clean up the skill", "audit the skill".
testing
Host security hardening and risk-tolerance configuration for OpenClaw deployments. Use when a user asks for security audits, firewall/SSH/update hardening, risk posture, exposure review, OpenClaw cron scheduling for periodic checks, or version status checks on a machine running OpenClaw (laptop, workstation, Pi, VPS).