MCP HubMCP Hub
스킬 목록으로 돌아가기

write-roxygen-docs

pjt222
업데이트됨 Yesterday
2 조회
17
2
17
GitHub에서 보기
메타worddata

정보

이 Claude Skill은 R 패키지에 대한 포괄적인 roxygen2 문서를 생성하며, 함수, 데이터셋, 클래스, 메서드를 다루고 tidyverse 스타일을 따릅니다. 표준 태그, 상호 참조, 예제, NAMESPACE 항목을 자동으로 처리합니다. 새로운 내보내기 항목이나 내부 도우미 함수를 문서화하거나, 문서와 관련된 R CMD check 경고를 수정할 때 사용하세요.

빠른 설치

Claude Code

추천
기본
npx skills add pjt222/agent-almanac -a claude-code
플러그인 명령대체
/plugin add https://github.com/pjt222/agent-almanac
Git 클론대체
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/write-roxygen-docs

Claude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요

문서

Write Roxygen Docs

Complete roxygen2 docs → R fns, datasets, classes.

Use When

  • New exported fn → docs
  • Internal helper fns
  • Pkg datasets
  • S3/S4/R6 classes + methods
  • Fix doc-related R CMD check notes

In

  • Required: R fn|dataset|class to doc
  • Optional: Related fns → cross-ref (@family, @seealso)
  • Optional: Export fn?

Do

Step 1: Fn Docs

Roxygen comments directly above fn:

#' 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
}

Got: Complete roxygen w/ title, desc, @param per param, @return, @examples, @export.

If err: Unsure tag → ?roxygen2::rd_roclet. Common omission @return → CRAN required for all exports.

Step 2: Essential Tags

TagPurposeRequired for export?
#' TitleFirst line, one sentenceYes
#' DescriptionParagraph after blank lineYes
@paramParameter documentationYes
@returnReturn value descriptionYes (CRAN)
@examplesUsage examplesStrongly recommended
@exportAdd to NAMESPACEYes, for public API
@familyGroup related functionsRecommended
@seealsoCross-referencesOptional
@keywords internalMark as internalFor non-exported docs

Got: Required tags ID'd. Exports have @param, @return, @examples, @export minimum.

If err: Tag unfamiliar → roxygen2 docs for usage + syntax.

Step 3: Doc Datasets

Create 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"

Got: R/data.R has roxygen blocks per dataset w/ @format describing structure + @source for provenance.

If err: R CMD check warns undocumented dataset → ensure quoted string ("city_temperatures") exactly matches obj name saved w/ usethis::use_data().

Step 4: Doc Pkg

Create R/packagename-package.R:

#' @keywords internal
"_PACKAGE"

## usethis namespace: start
## usethis namespace: end
NULL

Got: R/packagename-package.R exists w/ @keywords internal + "_PACKAGE" sentinel. devtools::document() generates man/packagename-package.Rd.

If err: R CMD check reports missing pkg doc page → verify file R/<packagename>-package.R + contains "_PACKAGE".

Step 5: Special Cases

Fns w/ dots in names (S3 methods):

#' @export
#' @rdname process
process.myclass <- function(x, ...) {
  # S3 method
}

Reuse docs w/ @inheritParams:

#' @inheritParams weighted_mean
#' @param trim Fraction of observations to trim.
trimmed_mean <- function(x, w, na.rm = FALSE, trim = 0.1) {
  # implementation
}

No visible binding fix w/ .data pronoun:

#' @importFrom rlang .data
my_function <- function(df) {
  dplyr::filter(df, .data$column > 5)
}

Got: Special cases (S3 methods, inherited params, .data pronoun) documented correctly. @rdname groups S3 methods. @inheritParams reuses params w/o duplicate.

If err: R CMD check warns "no visible binding for global variable" → #' @importFrom rlang .data or utils::globalVariables() last resort.

Step 6: Generate Docs

devtools::document()

Got: man/ updated w/ .Rd files per documented obj. NAMESPACE regenerated w/ correct exports + imports.

If err: Roxygen syntax errs. Common: unclosed brackets in \describe{}, missing #' prefix, invalid tag names. Re-run devtools::document() after fix.

Check

  • Every exported fn has @param, @return, @examples
  • devtools::document() runs no errs
  • devtools::check() no doc warnings
  • @family tags group correctly
  • Examples run no errs (devtools::run_examples())

Traps

  • Missing @return: CRAN requires all exports doc return value
  • Examples need internet/auth: Wrap \dontrun{} w/ comment why
  • Slow examples: \donttest{} for examples that work but slow for CRAN
  • Markdown in roxygen: Enable Roxygen: list(markdown = TRUE) in DESCRIPTION
  • Forget devtools::document(): Man pages generated, not hand-written

  • create-r-package — initial pkg setup including roxygen config
  • write-testthat-tests — test fns you doc
  • write-vignette — long-form docs beyond fn ref
  • submit-to-cran — doc requirements for CRAN

GitHub 저장소

pjt222/agent-almanac
경로: i18n/caveman-ultra/skills/write-roxygen-docs
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

연관 스킬

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을 선택하십시오.

스킬 보기