calc-sample-size

calc-sample-size is a skill for Claude Code from Aperivue/medsci-skills. It costs 66 tokens per session (8,308 once invoked), scanned A, original, MIT.

An interactive tool for calculating how many participants or observations a medical study needs. It helps choose a suitable calculation, explains the expected effect size, and produces R or Python code and text for an ethics application.

In plain words
What is it for?
It is for planning diagnostic, agreement, proportion, continuous-outcome, survival, ANOVA, logistic-regression, observational-cohort, prediction-model, and reader-study research.
Why use it?
It replaces guesswork about study size with a documented calculation matched to the research question and study design.

Skill for Claude Code

Written for Claude Code: ${CLAUDE_SKILL_DIR} variable. Also seen: model in frontmatter.

Part of the medsci-data plugin — 8 skills shipped together

Good fit It is for planning diagnostic, agreement, proportion, continuous-outcome, survival, ANOVA, logistic-regression, observational-cohort, prediction-model, and reader-study research.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/aperivue/medsci-skills/calc-sample-size
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Aperivue/medsci-skills --skill calc-sample-size
Clone the repo
git clone --depth 1 https://github.com/Aperivue/medsci-skills

Made for: Claude Code.

Or install medsci-data, the plugin that ships this one along with the rest of its 8 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for calc-sample-size

README.md
[![agentmods](https://agentmods.dev/badge/skills/aperivue/medsci-skills/calc-sample-size/github.svg)](https://agentmods.dev/skills/aperivue/medsci-skills/calc-sample-size)
Your own site
<a href="https://agentmods.dev/skills/aperivue/medsci-skills/calc-sample-size"><img src="https://agentmods.dev/badge/skills/aperivue/medsci-skills/calc-sample-size/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for calc-sample-size

Your own site · 80×15
<a href="https://agentmods.dev/skills/aperivue/medsci-skills/calc-sample-size"><img src="https://agentmods.dev/badge/skills/aperivue/medsci-skills/calc-sample-size.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 66 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 8,308 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 2 findings, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium analysis-evasion · line 1
    Suspicious Unicode normalization or mixed-script content
    Fix: Review the flagged content for security risks. Ensure no credentials, secrets, or sensitive data are exposed.
  • medium Excessive Agency · line 647
    Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
    Fix: Add human-in-the-loop confirmation for destructive, irreversible, or high-impact operations. Never auto-execute commands that modify files, send data, or alter system state.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00066 $0.08308
Opus 5 $0.00033 $0.04154
Sonnet 5 $0.00013 $0.01662
Haiku 4.5 $0.00007 $0.00831

Measured 10d ago against content hash 623d9b99d03e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

calc-sample-size scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/calc-sample-size/SKILL.md · 649 lines

How it starts

The opening of the file, as written. The whole thing — 649 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Calc-Sample-Size Skill

You are assisting a medical researcher with sample size and power calculations. Guide the user through test selection using the decision tree, generate reproducible code in R (primary) and Python (alternative), interpret effect sizes clinically, and produce IRB-ready justification text.

Reference Files

  • Formulas: ${CLAUDE_SKILL_DIR}/references/formulas.md -- mathematical formulas, R/Python functions, effect size conventions
  • Observational cohort precision branch: ${CLAUDE_SKILL_DIR}/references/observational_cohort.md
  • Prediction-model / medical-AI sample size (Riley): ${CLAUDE_SKILL_DIR}/references/prediction_model_sample_size.md -- the current TRIPOD+AI-aligned standard for a clinical prediction/classification model (development via pmsampsize, external validation via pmvalsampsize, net-benefit precision). Use this instead of EPV-10 whenever the goal is risk prediction for use rather than a single-predictor hypothesis test (Tests 12-13).
  • MRMC reader-study sample size (Obuchowski–Rockette): ${CLAUDE_SKILL_DIR}/references/mrmc_reader_study_sample_size.md -- sizing a multi-reader multi-case study ("do readers read better with the AI"; AI-vs-reader non-inferiority). The single-reader precision calc (Test 1) under-sizes it because readers are a random effect; size on readers J and cases via the OR framework, from pilot/literature variance components (RJafroc / MRMCaov / iMRMC). Use whenever a reader study is the design (Test 14).
  • Segmentation-metric precision (Dice / HD95 / NSD): ${CLAUDE_SKILL_DIR}/references/segmentation_metric_sample_size.md -- sizing a segmentation validation by the precision of the per-case overlap/boundary score (not a proportion): n ≈ (1.96·SD/δ)² from the pilot SD of per-case Dice, per structure (size on the worst), bootstrap-BCa CI, paired for a model comparison, and size the external cohort. Use whenever the outcome is Dice/HD95/NSD (Test 15).
  • Between-model comparison sample size: ${CLAUDE_SKILL_DIR}/references/multi_model_comparison_sample_size.md -- sizing a study whose claim is that one model beats others (several models head-to-head). Single-model precision under-sizes it: power the difference. Pair the design (same cases through all models) → size on the SD of the per-case difference; DeLong for a paired ΔAUC, bootstrap-paired for ΔDice; for >2 models pre-specify one primary contrast or pay the family-wise multiplicity; and for a ranking claim, seed for rank stability (Nadeau–Bengio variance, Demšar critical-difference). Use whenever the endpoint is "model A > B/C/…" (Test 16).
  • Segmentation usability sample size: ${CLAUDE_SKILL_DIR}/references/segmentation_acceptability_sample_size.md -- sizing a usability claim rather than a metric: the acceptability endpoint is a proportion (n ≈ (z/δ)²p(1−p), size on the pessimistic p, size per structure class); ratings by m readers are nested, so pooling n·m overstates precision by 1+(m−1)ρ; bounding a catastrophic-failure rate needs the rule of three (≤1% ⇒ ~300 clean cases — a metric-precision study bounds nothing); edit time is a paired per-case difference sized per structure and per site. Use whenever the claim is "clinicians can use this" (Test 17).
  • Justification prose exemplars: ${CLAUDE_SKILL_DIR}/references/justification_examples.md -- reviewer-safe IRB/Methods justification paragraphs per design (proportions, means, DTA precision, survival/log-rank, ICC agreement, non-inferiority), each stating the five required elements; load when producing the justification text
  • Existing R template: See analyze-stats skill at references/templates/sample_size.R for the 7 original tests

Read the full file on GitHub · 649 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 649 lines · 66 tokens per session scan A 623d9b99d03e

Subscribe to this mod's changes

calc-sample-size is a skill published in the GitHub repository Aperivue/medsci-skills (291 stars, last pushed 2d ago), licensed MIT. It adds 66 tokens to every session and 8,308 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.