calc-sample-size

calc-sample-size is a skill for Claude Code from Aperivue/medsci-skills. It costs 63 tokens per session (3,181 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.

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 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,181 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.00063 $0.03181
Opus 5.5 $0.00025 $0.01272
Sonnet 5.5 $0.00013 $0.00636
Haiku 4.5 $0.00006 $0.00318

Measured 8d ago against content hash d49ee99c27b1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 8d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (tests/test_worked_examples.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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 · 230 lines

How it starts

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

Calc-Sample-Size Skill

Decision Tree

Walk the user through this tree one question at a time; do not assume answers. Reader studies, segmentation and model-comparison designs sit outside the tree: see Tests 14–17.

What is your primary outcome?
|
+-- Binary (yes/no, positive/negative)
|   |
|   +-- Paired data (same subjects, two methods)?
|   |   +-- YES --> [5] McNemar test
|   |   +-- NO  --> How many groups?
|   |       +-- 2 groups, superiority     --> [4] Two-proportion comparison (chi-square)
|   |       +-- 2 groups, non-inferiority --> [10] Non-inferiority / equivalence
|   |       +-- Multivariable model       --> single-predictor hypothesis test? --> [9] Logistic regression
|   |                                     --> clinical prediction / AI model for use?
|   |                                         +-- developing the model  --> [12] Prediction-model development (Riley)
|   |                                         +-- externally validating  --> [13] External-validation (Riley)
|   |
+-- Continuous (measurement, score)
|   |
|   +-- How many groups?
|       +-- 2 groups  --> [6] Independent t-test
|       +-- 3+ groups --> [8] One-way ANOVA
|
+-- Time-to-event (survival, recurrence)
|   |
|   +-- Two groups, unadjusted      --> [7] Log-rank test
|   +-- Multivariable / adjusted HR  --> [7] Log-rank (Schoenfeld) + [11] Cox EPV
|
+-- Agreement (inter-rater, reproducibility)
|   |
|   +-- Continuous measurements --> [2] ICC
|   +-- Categorical ratings     --> [3] Kappa
|
+-- Diagnostic accuracy (Se, Sp, AUC precision)
    |
    +--> [1] Diagnostic accuracy (precision-based)

Tests 1–11

Once the test is chosen, read ${CLAUDE_SKILL_DIR}/references/formulas.md § Test N — the parameter table with defaults, the effect-size interpretation, the formula, R/Python code and the methodological reference.

# Test Use when
1 Diagnostic accuracy — Se/Sp precision desired 95% CI half-width for sensitivity or specificity
2 ICC agreement (Walter 1998 test; Bonett 2002 CI width) inter-/intra-rater agreement on continuous measurements (tumor size, angle)
3 Kappa agreement (Donner & Eliasziw 1992; needs the trait prevalence) agreement on categorical ratings (BI-RADS category, lesion present/absent)
4 Two-proportion comparison (chi-square) two independent groups (AI vs conventional detection rate)
5 McNemar (paired proportions) paired binary outcomes (two readers on the same cases, before/after)
6 Independent t-test means in two independent groups (lesion size, malignant vs benign)
7 Survival / log-rank (Schoenfeld events, then patients) time-to-event between two groups
8 One-way ANOVA means across 3+ independent groups
9 Logistic regression (Peduzzi EPV + Hsieh 1998, continuous or binary predictor) multivariable binary outcome, single-predictor hypothesis test
10 Non-inferiority / equivalence new method not worse than standard by more than a pre-specified margin, or equivalent within it
11 Cox regression EPV multivariable Cox model — enough events for stable estimates

Read the full file on GitHub · 230 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. 8d ago Changed · +12 lines d49ee99c27b1
  2. 2mo ago Changed · -431 lines · -3 tokens per session ee07845a609e
  3. 3mo 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 (406 stars, last pushed 4d ago), licensed MIT. It adds 63 tokens to every session and 3,181 once invoked, about $0.0003 per session on Opus 5.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.

Related

calc-sample-size compared with skills from other repositories

calc-sample-size next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
calc-sample-sizeAperivue/medsci-skillsSkill4064d agoMITA63Claude Code
clinical-trials-searchbeita6969/ScienceClawSkill1.0k7d agoMITB28Claude Code, Codex
shidiIcyCreamDAS/shidi-skillSkill151mo agoMITA126Claude Code, Codex
shidiIcyCreamDAS/shidi-skillSkill151mo agoMITA69Claude Code, Codex
clinical-researchbestagentkits/agency-skillsSkill285mo agoMITA152Codex
sr-search-recordqiaomiaojoe/ai-academic-workflowSkill138d agononeA447Claude Code, Codex
critical-paper-readingqiaomiaojoe/ai-academic-workflowSkill138d agononeA191Claude Code, Codex