首页/医疗与健康/meta-analysis-skill
M

meta-analysis-skill

by @Lokenqaq111v
4.0(20)

在 R 中运行成对与网络荟萃分析,支持连续、二分类、患病率、通用效应量和 NMA 数据。适合康复与运动科学研究者将已提取的数值 CSV 用于验证、合成、绘图、诊断,并生成可复现 Markdown 报告;不负责文献检索、PDF 数值提取或自动 GRADE/CINeMA 评分。

meta-analysisrhealthcareevidence-synthesisnetwork-meta-analysisGitHub
安装方式
git clone https://github.com/Lokenqaq111/meta-analysis-skill.git
compare_arrows

Before / After 效果对比

1 组
使用前

研究者需要手动编写 R 脚本:整理 CSV、选择模型、运行 meta/network meta 包、绘制森林图与漏斗图、检查诊断并拼装报告,重复劳动多且容易遗漏验证步骤。

使用后

调用仓库内经过测试的脚本自动完成数据校验、连续/二分类/患病率/网络荟萃分析、图表诊断和 Markdown 报告,保留日志与 rerun.sh,流程可复现。

SKILL.md

name: meta-analysis-r description: Run tested R scripts for pairwise continuous, binary, generic, prevalence, or network meta-analysis after numeric data have already been extracted into CSV. Use for validation, synthesis, plots, diagnostics, and a reproducible Markdown report. Do not use for literature-only searches, protocol writing, extracting numbers from PDFs/abstracts, or automatic GRADE/CINeMA/PRISMA scoring. metadata: short-description: Tested R engines for pairwise, prevalence, and network meta-analysis.

R Meta-analysis V2

Use repository scripts as the analysis engine. Do not rewrite a complete analysis.R from a prompt.

Hard rules

  1. Never invent numeric data. An empty required cell stops validation.
  2. Do not extract or estimate means, SDs, events, or sample sizes from a PDF or abstract. If the user explicitly requests a documented Cochrane 6.5.2 conversion from reported SE/CI/IQR data, record the source values, formula, and caveat in notes before analysis.
  3. Never install R packages silently. Report missing packages and the exact install command, then wait for authorization.
  4. Validate before analysis. Do not bypass a failed validator.
  5. Refuse meta-analysis with one independent study; suggest narrative synthesis.
  6. Preserve analysis.log, input data, parameters, rerun.sh, plots, summaries, notes, and report.md under the selected output directory.
  7. Do not apply a universal MCID. Use only a population-appropriate source supplied by the user.
  8. RoB, GRADE, and JBI content is a manual placeholder. Do not calculate an automatic certainty score.

Environment gate

Run from the skill repository root:

scripts/check_env.sh

Read ENV_REPORT.md. If R or required packages are unavailable, implement/validate what is possible, mark package-dependent work BLOCKED, and do not claim that the analysis pipeline was runtime-verified.

Select a mode

ModeMeasureTemplateUse
continuousSMD or MDtemplates/continuous_empty.csvTwo-arm aggregate continuous outcomes
binaryRR or ORtemplates/binary_empty.csvComparative event counts with intervention/control arms
genericDeclared effect measuretemplates/generic_empty.csvPre-calculated TE and seTE
prevalencePLOGITtemplates/prevalence_empty.csvSingle-group prevalence (events / total)
networkRR, OR, SMD, or MDtemplates/network_empty.csvConnected multi-treatment arm-level network

Prevalence is an independent mode. Never put single-group prevalence data into the comparative binary template.

Read references only when needed

Validate

The main runner validates automatically. A validation-only call is also available:

Rscript scripts/validate.R \
  --input path/to/input.csv \
  --mode continuous \
  --measure SMD

When a study contributes multiple outcomes, timepoints, or pairwise rows, select one using --outcome / --timepoint or stop and ask for a prespecified dependency decision. Pairwise shared controls stop by default.

Run

Rscript scripts/run_analysis.R \
  --input path/to/input.csv \
  --mode continuous \
  --measure SMD \
  --outdir output/topic \
  --topic topic

Optional arguments include:

  • --model random|common
  • --target-higher-is-better true|false
  • --outcome <name> and --timepoint <name>
  • --population <description> and --mcid-source <citation>
  • NMA: --reference <treatment> and --ranking P-score|SUCRA

Default output is ./output/<topic>/. Use a Desktop path only when the user explicitly asks for it.

Check outputs

Confirm that the output directory contains:

  • run_parameters.txt and executable rerun.sh;
  • analysis.log;
  • data/input.csv, data/validation.txt, data/summary.txt, data/notes.txt when notes exist, and data/sessionInfo.txt;
  • gated files under plots/ and data/;
  • report.md in the required section order.

Surface analysis failures verbatim. Do not edit outputs to conceal skipped or failed diagnostics.

Test the skill

tests/run_all.sh

A nonzero exit means V2 is not complete. BLOCKED is acceptable only when ENV_REPORT.md identifies environment branch B/C; every non-blocked test must pass.

--- README.md ---

meta-analysis-r V2

A Claude Code / Cursor skill backed by parameterized R scripts for aggregate-data meta-analysis. V2 validates an already extracted CSV, runs a repository-owned engine, saves reproducible parameters and logs, and writes plots plus a structured Markdown report.

Supported modes:

  • pairwise continuous: MD or Hedges' g SMD;
  • pairwise binary: RR or OR;
  • generic pre-calculated effects;
  • independent single-proportion prevalence mode;
  • technical frequentist network meta-analysis.

This project does not search literature, extract numeric data from PDFs, generate PRISMA flow diagrams, or automatically score GRADE, CINeMA, JBI, or risk of bias.

Requirements

  • R 4.0 or later;
  • R packages meta, metafor, and netmeta;
  • Claude Code or Cursor when used as an agent skill.

Check the actual runtime before analysis:

scripts/check_env.sh

If packages are missing, review ENV_REPORT.md and obtain approval before running:

install.packages(c("meta", "metafor", "netmeta"))

The skill never installs packages silently.

Install

Claude Code

git clone https://github.com/Lokenqaq111/meta-analysis-skill.git \
  ~/.claude/skills/meta-analysis-r

Cursor — user scope

git clone https://github.com/Lokenqaq111/meta-analysis-skill.git \
  ~/.cursor/skills/meta-analysis-r

Cursor — project scope

From the project root:

git clone https://github.com/Lokenqaq111/meta-analysis-skill.git \
  .cursor/skills/meta-analysis-r

Quick start

Copy an empty template and fill every required field:

cp templates/continuous_empty.csv my_input.csv

Validate without running a model:

Rscript scripts/validate.R \
  --input my_input.csv \
  --mode continuous \
  --measure SMD

Run the analysis:

Rscript scripts/run_analysis.R \
  --input my_input.csv \
  --mode continuous \
  --measure SMD \
  --outdir output/my-topic \
  --topic my-topic

The default output path is ./output/<topic>/; --outdir is configurable.

Input modes

ModeTemplateNotes
continuoustemplates/continuous_empty.csvDirection is explicit; MD requires comparable units
binarytemplates/binary_empty.csvComparative intervention/control events
generictemplates/generic_empty.csvPre-calculated TE / seTE
prevalencetemplates/prevalence_empty.csvSingle-group events / total; no control columns
networktemplates/network_empty.csvBinary or continuous arm-level data

Files ending in _template.csv contain synthetic Example* rows. Empty templates contain headers only.

Reproducible output

Each successful run writes:

output/<topic>/
├── analysis.log
├── report.md
├── rerun.sh
├── run_parameters.txt
├── data/
│   ├── input.csv
│   ├── validation.txt
│   ├── analysis_data.csv
│   ├── summary.txt
│   ├── notes.txt              # when warnings/skips exist
│   └── sessionInfo.txt
└── plots/
    └── ...                    # mode- and k-gated figures

Defaults and limits

  • Random effects with REML is the intervention default because the usual target is an average effect; it is configurable and is not a discipline-wide law.
  • The current non-deprecated Hartung-Knapp API is checked at runtime.
  • Diagnostics use unique study count, not CSV row count.
  • Small-study tests require at least ten studies and additional effect/precision checks.
  • No universal MCID is embedded. Clinical thresholds require a user-supplied, population-appropriate source.
  • NMA connectivity does not establish transitivity; V2 does not claim publication-grade NMA validity.

See references/ for the data dictionary, method rules, prevalence behavior, NMA limits, bias-test routing, report contract, and manual JBI checklist.

Tests

tests/run_all.sh

With R and all packages available, the R suite runs end-to-end examples. Without R, branch-C Python/shell checks run and package-dependent tests are reported as BLOCKED in TEST_LOG.md; they are never presented as passed.

License

MIT — see LICENSE.


中文说明

meta-analysis-r V2 是一个面向 Claude Code / Cursor 的 Meta 分析 Skill。与 V1 每次让模型重写整份 analysis.R 不同,V2 直接调用仓库内参数化 R 脚本:先校验 CSV,再运行分析,并保存日志、参数、复跑脚本、图和结构化报告。

支持连续型、二分类、预计算效应量、独立患病率和技术性网络 Meta 模式。患病率使用单组 events/total 模板,不能与治疗组/对照组的 binary 模板混用。

硬规则:不编造或从摘要猜数值;必填空格立即停止;不静默安装 R 包;一项独立研究拒绝做 Meta;风险偏倚、GRADE 和 JBI 只留人工填写栏,不自动打分。

安装路径:

# Claude Code
git clone https://github.com/Lokenqaq111/meta-analysis-skill.git ~/.claude/skills/meta-analysis-r

# Cursor 用户级
git clone https://github.com/Lokenqaq111/meta-analysis-skill.git ~/.cursor/skills/meta-analysis-r

# Cursor 项目级
git clone https://github.com/Lokenqaq111/meta-analysis-skill.git .cursor/skills/meta-analysis-r

正式运行前先执行 scripts/check_env.sh,再用 tests/run_all.sh 查看当前环境实际通过、失败或受阻的测试。没有 R 时必须保留 V2_VERIFIED=NO,不能宣称分析管线已经实测通过。

用户评价 (0)

发表评价

效果
易用性
文档
兼容性

暂无评价

统计数据

安装量8
评分4.0 / 5.0
版本
更新日期2026年9月19日
对比案例1 组

用户评分

4.0(20)
5
35%
4
35%
3
15%
2
10%
1
5%

为此 Skill 评分

0.0

兼容平台

🔧Manual

时间线

创建2026年9月19日
最后更新2026年9月19日
🎁 Agent 知识卡片
调研问卷