schema_version: 2 name: calc-sample-size layer: A owner_domain: study_design maturity: official when_to_use: - User asks for a sample size, power calculation, or "how many patients/subjects do I need" - Drafting an IRB sample size justification before /write-protocol Methods - Re-deriving N when a reviewer challenges the original power assumption - Estimating events-per-variable (EPV) for survival or logistic regression when_NOT_to_use: - Statistical analysis of collected data (use /analyze-stats) - Choosing the test itself rather than its N (use /design-study) - Replicating a prior study's reported N without recomputation (still re-derive) inputs: - study_design (proportions, continuous, agreement, survival, ANOVA, logistic, NI/equivalence, diagnostic accuracy, repeated measures, Cox EPV) - parameters (effect size, alpha, power, attrition rate, etc.) outputs: - protocol/sample_size_justification.md # IRB-ready prose, Output Format §"IRB Justification Text" - protocol/sample_size_calc.R # reproducible R script - protocol/sample_size_calc.py # alternative reproducible Python script deterministic_scripts: - inline R/Python code blocks (skill-emitted, not packaged) side_effects: - none # no external API calls; pure computation + literature anchoring downstream_consumers: - write-protocol # embeds Output §"IRB Justification Text" verbatim into Methods §Sample Size - write-paper # embeds same text into Methods (post-IRB) - design-study # cross-reference for analysis-unit / cohort-logic alignment ssot_boundary: - protocol/sample_size_justification.md is the canonical sample size text. write-protocol and write-paper EMBED VERBATIM; do not rephrase numbers. quality_gates: - parameters_documented: every parameter has a Source column entry (user / literature / convention) - effect_size_interpretation: Cohen's benchmark classification present - methodological_reference: cited (e.g., "Schoenfeld, 1981" for survival) - reproducible_code: both R and Python emitted (skill default), runnable standalone forbidden_actions: - fabricate_effect_size_from_unverified_assumption - omit_attrition_or_loss_to_followup - silent_protocol_modification # changes to N must update both justification.md and protocol Methods # v2.1 quality card purpose: "Compute sample size / power with decision-tree test selection and reproducible R/Python code plus IRB-ready justification." safety_boundaries: - "Effect-size assumptions are justified and sourced, not fabricated; attrition/loss is accounted for." - "Any change to N updates both the justification and the protocol Methods (no silent change)." known_limitations: - "Emits inline R/Python, not a packaged script; the user runs it." - "Output is only as valid as the assumed effect size and design." validation_commands: - "re-run the emitted power code and confirm N matches the justification" - "python3 skills/calc-sample-size/tests/test_worked_examples.py # every formula block vs its package Check; add --require-r where R and the reference packages are installed" evidence_surface: manual_workflow