tidy-deprecate-function
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.
Install
mkdir -p .claude/skills/tidy-deprecate-function && curl -L -o skill.zip "https://mcp.directory/api/skills/download/2690" && unzip -o skill.zip -d .claude/skills/tidy-deprecate-function && rm skill.zipInstalls to .claude/skills/tidy-deprecate-function
About this skill
Deprecate functions and function arguments
Use this skill when deprecating functions or function parameters in this package.
Overview
This skill guides you through the complete process of deprecating a function or parameter, ensuring all necessary changes are made consistently:
- Add deprecation warning using
lifecycle::deprecate_warn(). - Silence deprecation warnings in existing tests.
- Add lifecycle badge to documentation.
- Add bullet point to NEWS.md.
- Create test for deprecation warning.
Workflow
Step 1: Determine deprecation version
Read the current version from DESCRIPTION and calculate the deprecation version:
- Current version format:
MAJOR.MINOR.PATCH.9000(development). - Deprecation version: Next minor release
MAJOR.(MINOR+1).0. - Example: If current version is
2.5.1.9000, deprecation version is2.6.0.
Step 2: Add lifecycle::deprecate_warn() call
Add 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:
- First argument is the deprecation version string (e.g., "2.6.0").
- Second argument describes what is deprecated (e.g., "function_name(param)").
- Optional third argument suggests replacement.
- Use
lifecycle::is_present()to check if a deprecated parameter was supplied.
Step 3: Update tests
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.
Step 4: Update documentation
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:
- Use "# Old:" and "# New:" comments to clearly show the transition.
- Include 2-3 practical examples covering common use cases.
- Make examples runnable and self-contained.
- Show how the new syntax differs from the old.
Then re-document the package.
Step 5: Add NEWS entry
Add a bullet point to the top of the "# packagename (development version)" section in NEWS.md:
# packagename (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:
- In the lifecycle subsection if it exists, otherwise at the top level under development version.
- Include the replacement if known.
- Keep entries concise and actionable.
Implementation checklist
When deprecating a function or parameter, ensure you:
- Read DESCRIPTION to determine deprecation version.
- Add
lifecycle::deprecate_warn()call in the function. - Add
withr::local_options(lifecycle_verbosity = "quiet")to existing tests. - Create new test for deprecation warning using
expect_snapshot(). - Run tests to verify everything works.
- Add lifecycle badge to roxygen documentation.
- Add migration examples to
@examplessection (for function deprecation). - Run
devtools::document()to update documentation. - Add bullet point to NEWS.md.
- Run
air format .to format code.
More by r-lib
View all skills by r-lib →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversStreamline project docs with Specs Workflow: automate software project plan templates, tracking, and OpenAPI-driven prog
AI Intervention Agent enables human-in-the-loop AI with real-time intervention via a web UI—review context, give feedbac
Agile Planner MCP Server — AI project management tool and agile backlog generator offering automated backlog creation an
Enhance productivity with customizable audio notifications in your development environment. Ideal for game dev softwares
Redpanda Docs — authoritative answers, guides, and troubleshooting for Redpanda users and developers. Learn, implement,
Access Intercom data securely via a remote MCP server with authenticated connections for AI tools and live updates.
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.