AGENT SKILL
method-r
Routes R work: analysis design, tidyverse, event-study DiD, packages, testthat, CRAN, profiling, targets. Use when a project is R-first or the user needs R help; diffs and PRs go to method-review.
- License 许可
- MIT
- 最近更新
- 2026-11-01
- Stars
- ★ 6
- Forks
- 0
01 前言 Front Matter
- name
- method-r
- description
- Routes R work: analysis design, tidyverse, event-study DiD, packages, testthat, CRAN, profiling, targets. Use when a project is R-first or the user needs R help; diffs and PRs go to method-review.
- argument-hint
- [analysis|review|tidyverse|event-studies|package|testing|cran|performance|targets]
02 资源文件 8
- 参考文档references/cran.md1.6 KB
- 参考文档references/event-studies.md2.7 KB
- 参考文档references/package-development.md1.4 KB
- 参考文档references/package-testing.md1.4 KB
- 参考文档references/performance.md1.5 KB
- 参考文档references/review.md1.7 KB
- 参考文档references/targets.md1.7 KB
- 参考文档references/tidyverse.md1.9 KB
03 SKILL.md 正文
R Statistics Router
Skill Value
- Problem it solves: R projects need language-specific workflow guidance without bypassing Methodsmith design, data-QA, and reporting gates.
- Use when: The project uses R, RStudio,
.R,.Rmd,.qmd,renv,DESCRIPTION, or_targets.R. - Output: A selected R workflow with the relevant analytical contract and validation plan.
- Ask only if: The task could reasonably belong to more than one R workflow.
- Do not do: Do not change package dependencies, publish to CRAN, or replace failed data with synthetic examples without explicit authorization.
Route
Pick the narrowest row and read its reference file before writing code. Each file holds that workflow's scope, steps, and guardrails.
| Task | Workflow |
|---|---|
| R analysis design, base R, modeling, sensitivity analysis | Use the shared R workflow below |
| Read-only R code review | Read references/review.md |
| dplyr, tidyr, ggplot2, purrr, joins | Read references/tidyverse.md |
| Event-study or staggered adoption design | Read references/event-studies.md |
| Package API, documentation, release structure | Read references/package-development.md |
| testthat fixtures, snapshots, mocks | Read references/package-testing.md |
| CRAN readiness and submission preparation | Read references/cran.md |
| Profiling and performance improvement | Read references/performance.md |
targets pipeline authoring and validation |
Read references/targets.md |
Shared R workflow
- Inspect
renv.lock,DESCRIPTION,_targets.R, Quarto/R Markdown files, and existing project conventions before proposing packages or file layout. - Load the
method-notebook-standardsskill before creating or materially extending an.Rmdor.qmdanalysis. - For research analysis, load
method-planto establish the canonical SAP; addmethod-saponly when a complex clinical design needs claim-to-dataset and decision-evidence modeling. - Load the
method-data-qaskill before model code and keep R transformations fail-loud at schema, join, and type boundaries. - Preserve lockfiles and record
sessionInfo()or the project-equivalent environment evidence with any reproducible result. - Load the
method-reviewskill for causal, survival, or reporting claims; language-specific R syntax does not validate methodology by itself. - When
phi_environment.modein.methodsmith/config.local.yamlisschema-only, run R scripts that read data asmethod-safe-run -- Rscript <script>(ormethod-safe-run -- quarto render <doc>), using the path the guard's deny message gives; it shows only the exit code, files written, and a stderr summary of traceback frames and error types. Runtargets::tar_make(),rmarkdown::render(), andmakethe same way. Write results withwrite.csv()orknitr::kable()as aggregate tables, counts under 11 suppressed, underoutput/or anotherphi_environment.aggregate_dirsentry.
Evidence-first R guidance
- Treat the project lockfile and installed package version as the starting point; do not recommend a current R API from memory when version-specific behavior matters.
- When available, use Ref MCP to read the official documentation for the exact R package and function before proposing an unfamiliar, version-sensitive, or safety-relevant call. Record the package/version or a version gap with the recommendation.
- When current ecosystem or CRAN-policy discovery is necessary, use Tavily MCP to find candidate primary sources, then read the official package, CRAN, R-project, or rOpenSci source. A search snippet or a third-party blog is not sufficient evidence for an API or submission rule.
- If the configured research tool is unavailable, state the verification gap and use only repository-local evidence or stable base-R behavior; never invent an option, version, benchmark, or policy.
04 同仓库更多 Skills
skill-one
Sample skill
★ 6
disabled-skill
A skill with model invocation disabled
★ 6
claude-only-skill
A skill restricted to Claude Code only
★ 6
default-skill
暂无简介
★ 6
custom-skill
暂无简介
★ 6
method-write
Drafts, revises, and audits evidence-bound manuscripts, sections, abstracts, and reviewer responses with claim provenance. Use when scientific prose must be written or revised (entry point).
★ 6