meta-analysis-skill
R でペアワイズおよびネットワークメタアナリシスを実行し、連続、二値、有病率、汎用効果量、NMA データをサポートします。リハビリテーションおよびスポーツ科学の研究者が、抽出済みの数値 CSV を用いて検証、統合、作図、診断を行い、再現可能な Markdown レポートを生成するのに適しています。文献検索、PDF からの数値抽出、自動 GRADE/CINeMA 評価は担当しません。
git clone https://github.com/Lokenqaq111/meta-analysis-skill.gitBefore / After 効果比較
1 组研究者は R スクリプトを手作業で書く必要がある:CSV を整理し、モデルを選択し、meta/network meta パッケージを実行し、フォレストプロットとファンネルプロットを作成し、診断を確認し、レポートを組み立てる。反復作業が多く、検証ステップを漏らしやすい。
リポジトリ内のテスト済みスクリプトを呼び出して、データ検証、連続・二値・有病率・ネットワークメタアナリシス、図表診断、Markdown レポートを自動で完了する。ログと rerun.sh を保持し、ワークフローは再現可能。
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
- Never invent numeric data. An empty required cell stops validation.
- 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.
- Never install R packages silently. Report missing packages and the exact install command, then wait for authorization.
- Validate before analysis. Do not bypass a failed validator.
- Refuse meta-analysis with one independent study; suggest narrative synthesis.
- Preserve
analysis.log, input data, parameters,rerun.sh, plots, summaries, notes, andreport.mdunder the selected output directory. - Do not apply a universal MCID. Use only a population-appropriate source supplied by the user.
- 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
| Mode | Measure | Template | Use |
|---|---|---|---|
continuous | SMD or MD | templates/continuous_empty.csv | Two-arm aggregate continuous outcomes |
binary | RR or OR | templates/binary_empty.csv | Comparative event counts with intervention/control arms |
generic | Declared effect measure | templates/generic_empty.csv | Pre-calculated TE and seTE |
prevalence | PLOGIT | templates/prevalence_empty.csv | Single-group prevalence (events / total) |
network | RR, OR, SMD, or MD | templates/network_empty.csv | Connected 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
- Before preparing or validating any CSV, read references/data-dictionary.md.
- For model, direction, HK, prediction-interval, and diagnostic defaults, read references/methods-defaults.md.
- For prevalence, read references/prevalence.md and references/jbi-prevalence-rob.md.
- For NMA, read references/nma-limits.md; connectivity does not establish transitivity.
- When a funnel plot or asymmetry test is relevant, read references/egger-and-bias.md.
- Before interpreting
report.md, read references/report-spec.md.
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.txtand executablererun.sh;analysis.log;data/input.csv,data/validation.txt,data/summary.txt,data/notes.txtwhen notes exist, anddata/sessionInfo.txt;- gated files under
plots/anddata/; report.mdin 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, andnetmeta; - 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
| Mode | Template | Notes |
|---|---|---|
continuous | templates/continuous_empty.csv | Direction is explicit; MD requires comparable units |
binary | templates/binary_empty.csv | Comparative intervention/control events |
generic | templates/generic_empty.csv | Pre-calculated TE / seTE |
prevalence | templates/prevalence_empty.csv | Single-group events / total; no control columns |
network | templates/network_empty.csv | Binary 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)
レビューを書く
レビューなし
統計データ
ユーザー評価
この Skill を評価