write-roxygen-docs
정보
이 Claude Skill은 함수, 데이터셋, 클래스를 포함한 R 패키지 구성요소에 대한 roxygen2 문서를 생성합니다. tidyverse 스타일을 따르며, 표준 태그와 상호 참조를 처리하고 적절한 NAMESPACE 항목을 만듭니다. 새로운 내보내기 항목, 내부 헬퍼 함수, S3/S4/R6 메서드를 문서화하거나 R CMD check 문서 문제를 해결할 때 사용하세요.
빠른 설치
Claude Code
추천npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/write-roxygen-docsClaude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요
문서
書 Roxygen 文
立 R 包函、數、類之全 roxygen2 文。
用
- 為新出函加文→用
- 錄內輔函→用
- 錄包數→用
- 錄 S3/S4/R6 類與法→用
- 修文相關
R CMD check註→用
入
- 必:欲錄之 R 函、數、類
- 可:交參之關函(
@family、@seealso) - 可:函是否出
行
一:書函文
置 roxygen 註於函上:
#' Compute the weighted mean of a numeric vector
#'
#' Calculates the arithmetic mean of `x` weighted by `w`. Missing values
#' in either `x` or `w` are handled according to the `na.rm` parameter.
#'
#' @param x A numeric vector of values.
#' @param w A numeric vector of weights, same length as `x`.
#' @param na.rm Logical. Should missing values be removed? Default `FALSE`.
#'
#' @return A single numeric value representing the weighted mean.
#'
#' @examples
#' weighted_mean(1:5, rep(1, 5))
#' weighted_mean(c(1, 2, NA, 4), c(1, 1, 1, 1), na.rm = TRUE)
#'
#' @export
#' @family summary functions
#' @seealso [stats::weighted.mean()] for the base R equivalent
weighted_mean <- function(x, w, na.rm = FALSE) {
# implementation
}
得:完 roxygen 塊含題、述、各參之 @param、@return、@examples、@export。
敗:標不確→察 ?roxygen2::rd_roclet。常漏為 @return,CRAN 對諸出函要。
二:要標參
| 標 | 用 | 出函必? |
|---|---|---|
#' Title | 首行、一句 | 是 |
#' Description | 空行後段 | 是 |
@param | 參文 | 是 |
@return | 返值述 | 是(CRAN) |
@examples | 用例 | 強薦 |
@export | 加 NAMESPACE | 是,公 API |
@family | 關函組 | 薦 |
@seealso | 交參 | 可 |
@keywords internal | 標內 | 為非出文 |
得:函型須標皆辨。出函至少有 @param、@return、@examples、@export。
敗:標未識→參 roxygen2 文 之用與法。
三:錄數
建 R/data.R:
#' Example dataset of city temperatures
#'
#' A dataset containing daily temperature readings for major cities.
#'
#' @format A data frame with 365 rows and 4 variables:
#' \describe{
#' \item{date}{Date of observation}
#' \item{city}{City name}
#' \item{temp_c}{Temperature in Celsius}
#' \item{humidity}{Relative humidity percentage}
#' }
#' @source \url{https://example.com/data}
"city_temperatures"
得:R/data.R 含每數之 roxygen 塊附述構之 @format 與述源之 @source。
敗:R CMD check 警未錄數→確引串(如 "city_temperatures")精配 usethis::use_data() 存物名。
四:錄包
建 R/packagename-package.R:
#' @keywords internal
"_PACKAGE"
## usethis namespace: start
## usethis namespace: end
NULL
得:R/packagename-package.R 存附 @keywords internal 與 "_PACKAGE" 標。devtools::document() 生 man/packagename-package.Rd。
敗:R CMD check 報缺包文→驗檔名為 R/<packagename>-package.R 且含 "_PACKAGE" 串。
五:應特例
含點函(S3 法):
#' @export
#' @rdname process
process.myclass <- function(x, ...) {
# S3 method
}
復用文 以 @inheritParams:
#' @inheritParams weighted_mean
#' @param trim Fraction of observations to trim.
trimmed_mean <- function(x, w, na.rm = FALSE, trim = 0.1) {
# implementation
}
無見綁修 用 .data 代詞:
#' @importFrom rlang .data
my_function <- function(df) {
dplyr::filter(df, .data$column > 5)
}
得:特例(S3 法、繼參、.data 代詞)正錄。@rdname 組 S3 法。@inheritParams 復用參文無重。
敗:R CMD check 警「no visible binding for global variable」→加 #' @importFrom rlang .data 或末計用 utils::globalVariables()。
六:生文
devtools::document()
得:man/ 目更附每錄物之 .Rd 檔。NAMESPACE 重生附正出與入。
敗:察 roxygen 法誤。常疾:\describe{} 中括未閉、行缺 #' 前綴、無效標名。修後再行 devtools::document()。
驗
- 每出函有
@param、@return、@examples -
devtools::document()行無誤 -
devtools::check()無文警 -
@family標正組關函 - 例行無誤(以
devtools::run_examples()試)
忌
- 缺
@return:CRAN 要諸出函錄返值 - 例需網/認:以
\dontrun{}包附註釋以何 - 慢例:CRAN 過長之有效例用
\donttest{} - roxygen 中 markdown:DESCRIPTION 中啟
Roxygen: list(markdown = TRUE) - 忘行
devtools::document():man 頁為生、非手書
參
create-r-package- 包設始含 roxygen 配write-testthat-tests- 試所錄函write-vignette- 函參之外長文submit-to-cran- CRAN 之文要
GitHub 저장소
연관 스킬
content-collections
메타이 스킬은 콘텐츠 콜렉션(Content Collections)을 위한 프로덕션 검증된 설정을 제공합니다. 콘텐츠 콜렉션은 Markdown/MDX 파일을 Zod 검증이 포함된 타입 안전한 데이터 콜렉션으로 변환해주는 TypeScript 최우선 도구입니다. 블로그, 문서 사이트 또는 콘텐츠 중심의 Vite + React 애플리케이션을 구축할 때 타입 안전성과 자동 콘텐츠 검증을 보장하기 위해 사용하세요. Vite 플러그인 구성과 MDX 컴파일부터 배포 최적화 및 스키마 검증에 이르기까지 모든 것을 다룹니다.
polymarket
메타이 스킬은 개발자들이 Polymarket 예측 시장 플랫폼을 활용한 애플리케이션을 구축할 수 있도록 지원하며, 거래 및 시장 데이터를 위한 API 통합 기능을 포함합니다. 또한 WebSocket을 통한 실시간 데이터 스트리밍을 제공하여 실시간 거래와 시장 활동을 모니터링할 수 있습니다. 이를 통해 거래 전략을 구현하거나 실시간 시장 업데이트를 처리하는 도구를 생성하는 데 활용할 수 있습니다.
creating-opencode-plugins
메타이 스킬은 개발자들이 명령어, 파일, LSP 작업 등 25개 이상의 이벤트 유형에 연결되는 OpenCode 플러그인을 만들 수 있도록 돕습니다. JavaScript/TypeScript 모듈을 위한 플러그인 구조, 이벤트 API 명세, 구현 패턴을 제공합니다. OpenCode AI 어시스턴트의 라이프사이클을 사용자 정의 이벤트 기반 로직으로 가로채거나, 모니터링하거나, 확장해야 할 때 사용하세요.
sglang
메타SGLang은 RadixAttention 프리픽스 캐싱을 활용하여 JSON, 정규식, 에이전트 워크플로우를 위한 고속 구조화 생성에 특화된 고성능 LLM 서빙 프레임워크입니다. 특히 반복되는 프리픽스가 있는 작업에서 상당히 빠른 추론 속도를 제공하여 복잡한 구조화 출력 및 다중 턴 대화에 이상적입니다. 제약 디코딩이 필요하거나 광범위한 프리픽스 공유가 있는 애플리케이션을 구축할 때는 vLLM과 같은 대안보다 SGLang을 선택하십시오.
