Clinical Research
Operational support for running clinical studies: structuring a protocol so it
survives review, choosing endpoints that are actually analysable, designing
eligibility criteria that do not strangle accrual, planning sample size and
power, and testing whether the site network can deliver the enrolment target.
Scope and limits. This skill supports study operations — planning,
structuring, and auditing. It is not a substitute for a qualified
biostatistician, and it is not regulatory advice. The sample-size calculator
assumes a simple parallel design with no interim analyses, multiplicity
adjustment, covariate adjustment, or clustering; any design departing from
those assumptions requires a statistician. The protocol auditor checks
structure and internal consistency, not regulatory acceptability. Every
artifact produced here needs sign-off from qualified biostatistics, clinical,
and regulatory affairs personnel before it enters a submission.
When to use this skill
- Planning a study and needing a defensible sample size before the budget
and site count can be set
- Auditing a draft protocol for missing ICH E6 elements before it goes to an
ethics committee or a sponsor review board
- Choosing between candidate endpoints where one is clinically meaningful
and the other is achievable in the available sample
- Designing inclusion and exclusion criteria and needing to see the accrual
cost of each additional restriction
- Assessing site feasibility — deciding how many sites, and which, are
needed to hit an enrolment target inside the accrual window
- Diagnosing an under-accruing study and deciding between adding sites,
extending the window, or amending eligibility
Inputs the skill expects
- Study phase, design (parallel, crossover, single-arm), and blinding
- The primary question in a form that names the comparison
- Candidate endpoints with their measurement instrument and timepoint
- Effect size assumptions and their source — prior study, pilot, or literature
- Expected dropout rate, from comparable studies where possible
- For feasibility: candidate sites with eligible population, prior accrual
attainment, startup time, and competing studies
Clarify First
Before generating, confirm these inputs. If any is unknown or vague, ASK — do not assume:
Stop rule: ask only the 2-3 that most change the output. If the user says "just draft it," proceed and list your assumptions at the top of the artifact.
Workflows
Workflow 1 — Plan sample size and power
- Fix the primary endpoint and its type: binary, continuous, or time-to-event.
This selects the design, and the design selects the formula.
- State the effect size you want to detect and where it came from. [PROVEN]
Power for the smallest effect that would change clinical practice, not for
the effect you hope to see — the latter systematically under-powers studies.
- Set alpha (0.05 two-sided unless the protocol justifies otherwise), power
(80% minimum, 90% where feasible), allocation ratio, and dropout rate.
- Run the calculator. Read both the analysed n and the enrol n — the dropout
inflation is the number that drives the budget.
- If you have a fixed n constrained by budget or accrual, pass it as
planned_n_per_group and read the achieved power instead.
- Take the result to a biostatistician. This step is not optional.
python3 research-ops/clinical-research/scripts/sample_size_calculator.py \
--input research-ops/clinical-research/assets/sample_power_spec.json \
--format text
Workflow 2 — Audit a protocol outline
- Map the draft protocol's sections onto the ICH E6 element keys.
- Enter endpoints with role, measure, timepoint, and analysis population;
enter inclusion and exclusion criteria verbatim.
- Run the auditor. It reports missing sections, endpoints that cannot be
analysed as written, eligibility criteria that conflict or duplicate, and
gaps in the statistical and safety sections.
- Clear every
fail before circulating the draft. Missing sections and an
unadjusted interim analysis are the two findings most likely to cost you a
review cycle.
python3 research-ops/clinical-research/scripts/protocol_auditor.py \
--input research-ops/clinical-research/assets/sample_protocol.json \
--format text
Workflow 3 — Test the site network against the enrolment target
- Collect per-site data: eligible annual population, self-reported accrual
estimate, prior accrual attainment, startup time, coordinator status, and
competing studies.
- Run the feasibility scorer. It discounts self-reported estimates, blends in
the site's historical attainment, caps against eligible population, and
subtracts startup time from the accrual window.
- Read the shortfall. If it is positive, the choice is more sites, a longer
window, or looser eligibility — decide deliberately rather than discovering
it at month 14.
- Use
--select to test whether a smaller, higher-quality site set beats a
larger one. It usually does on cost, and often on total accrual.
python3 research-ops/clinical-research/scripts/site_feasibility_scorer.py \
--input research-ops/clinical-research/assets/sample_sites.json \
--select 5 --format text
Decision frameworks
Endpoint type drives everything
| Endpoint type |
Design |
Sample driver |
Typical relative n |
| Continuous (change in a scale) |
Two means |
Standardised effect size δ/σ |
Smallest |
| Binary (responder yes/no) |
Two proportions |
Absolute difference and baseline rate |
2-4x the continuous equivalent |
| Time-to-event |
Log-rank |
Hazard ratio and event probability |
Driven by events, not enrolment |
| Count / rate |
Poisson or negative binomial |
Rate ratio and dispersion |
Requires a statistician |
| Composite |
Depends on components |
The component that dominates |
Interpretation risk is high |
[PROVEN] Where the same clinical question can be posed as continuous or
binary, the continuous version needs materially fewer participants.
Dichotomising a continuous measure discards information and inflates n — do it
only when the threshold itself is what is clinically meaningful.
Effect size sources and their reliability
| Source |
Reliability |
Adjustment |
| Large completed trial in the same population |
[PROVEN] highest |
Use as-is |
| Meta-analysis of comparable trials |
[PROVEN] high |
Use the pooled estimate; check heterogeneity |
| Single published trial, different population |
[RECOMMENDED] moderate |
Discount by 20-30%; effects rarely transfer intact |
| Internal pilot study |
[RECOMMENDED] moderate |
Add 10-15% to n; a pilot SD is imprecise |
| Clinician consensus on the minimum meaningful difference |
[RECOMMENDED] |
Best basis for the target, not for the variance |
| The effect needed to make the business case work |
Not a source |
This is how under-powered studies get funded |
That last row is a real failure mode. When the affordable sample size is
back-solved into an effect size, the study is designed to fail and the failure
is uninterpretable — you cannot distinguish "no effect" from "not enough people."
Eligibility restrictiveness
Every criterion trades internal validity for accrual and generalisability.
| Criteria count |
Typical effect |
| Under 15 |
Broad, fast accrual, high generalisability |
| 15-25 |
Standard for a phase 3 study |
| 25-35 |
Screen failure rates climb steeply; accrual timelines stretch |
| Over 35 |
Accrual frequently fails; the treated population may not resemble the studied one |
[RECOMMENDED] For every criterion beyond about 20, require a written
justification naming the specific safety or interpretability risk it addresses.
Criteria accumulate through review by addition — nobody is ever assigned to
remove one — and the cumulative accrual cost is invisible at the point each is
added.
Anti-Patterns
Back-Solved Power
Mistake: Deciding the affordable sample size first, then choosing the effect
size that makes that n reach 80% power.
Why it happens: The budget is fixed before the science is planned, and the
calculation is treated as a document to produce rather than a constraint to
respect.
Instead: Compute n from the smallest clinically meaningful effect. If that n
is unaffordable, the honest options are to seek more funding, run a smaller
study explicitly labelled as a pilot with a feasibility objective, or not run
it. A study powered for an implausibly large effect consumes the same budget and
produces an uninterpretable result.
The Optimistic Site Estimate
Mistake: Building the accrual plan on the enrolment rates sites report during
feasibility questionnaires.
Why it happens: Sites want to be selected, the estimate is made by someone
who is not the person who will do the recruiting, and nobody is ever penalised
for an optimistic feasibility response.
Instead: Discount every self-reported estimate substantially and weight by
the site's actual attainment on previous studies. Cross-check against the
eligible population they reported — a site claiming 8 participants a month from
a clinic seeing 180 eligible patients a year is claiming a screening yield that
does not occur. Plan for the discounted number and treat outperformance as
upside.
Criterion Creep
Mistake: Each protocol review round adds two or three exclusion criteria, and
the final protocol has 40.
Why it happens: Every reviewer can name a subgroup that might complicate
interpretation, and adding an exclusion is a costless-looking way to resolve the
comment. Nobody's job is to remove one.
Instead: Cap the criteria count in the protocol plan and treat additions as
trade-offs requiring an explicit removal or a written justification of the
accrual cost. Track the projected screen failure rate as criteria accumulate and
put that number in front of reviewers.
The Unanalysable Endpoint
Mistake: A primary endpoint like "improvement in patient wellbeing" with no
named instrument, threshold, or timepoint.
Why it happens: It is written early as a placeholder during objective-setting
and is never converted into an operational definition.
Instead: Every endpoint needs four things before the protocol circulates: the
instrument, the metric derived from it, the threshold or contrast that defines
the outcome, and the timepoint. If any of the four is missing, the endpoint
cannot be powered, collected consistently, or analysed.
Silent Interim Looks
Mistake: Planning an interim analysis without an alpha spending function,
or examining accumulating data informally "just to see how it is going."
Why it happens: Interim looks feel like prudent management, and the
statistical cost is invisible to anyone not looking for it.
Instead: Pre-specify every interim analysis with its alpha spending function
and stopping boundaries, and restrict access to unblinded accumulating data to
an independent monitoring committee. Unadjusted repeated testing inflates type I
error, and an informal look by the sponsor team compromises the trial's
integrity even when nothing is acted on.
Files
| File |
Purpose |
scripts/sample_size_calculator.py |
Sample size and power CLI: input validation, dropout inflation, planning warnings, and reporting |
scripts/power_formulas.py |
Design formulas imported by sample_size_calculator.py: the two-proportion, two-mean (with t-correction), and log-rank sample-size calculations, the achieved-power inversions, and the method notes reported with every result. Edit here to revise the statistics |
scripts/protocol_auditor.py |
Audits a protocol outline against ICH E6 elements, endpoint definitions, and eligibility consistency |
scripts/protocol_rules.py |
Rule definitions imported by protocol_auditor.py: the ICH E6 required-section table and its guidance strings, vague-measure and DSMB-phase thresholds, the SAE reporting window, severity ordering, and the finding accumulator. Edit here to revise what the audit expects |
scripts/site_feasibility_scorer.py |
Discounts site accrual estimates and tests the network against the enrolment target |
references/protocol-and-endpoint-design.md |
ICH E6 protocol contents, endpoint hierarchies, eligibility design, estimand framing |
references/statistical-planning.md |
Formulas, worked examples, design effects, interim analysis, and when to escalate to a statistician |
assets/protocol-outline-template.md |
The protocol skeleton with every required element |
assets/sample_power_spec.json |
Runnable input for the sample size calculator |
assets/sample_protocol.json |
Runnable input for the protocol auditor |
assets/sample_sites.json |
Runnable input for the site feasibility scorer |
1---2name: clinical-research3description: Clinical study operations — protocol structure, endpoint selection, eligibility design, sample-size and power planning, site feasibility, and documentation readiness. Use when planning, auditing, or costing a study.4license: MIT + Commons Clause5---6
7# Clinical Research
8
9Operational support for running clinical studies: structuring a protocol so it
10survives review, choosing endpoints that are actually analysable, designing
11eligibility criteria that do not strangle accrual, planning sample size and
12power, and testing whether the site network can deliver the enrolment target.
13
14> **Scope and limits.** This skill supports **study operations** — planning,
15> structuring, and auditing. It is not a substitute for a qualified
16> biostatistician, and it is not regulatory advice. The sample-size calculator
17> assumes a simple parallel design with no interim analyses, multiplicity
18> adjustment, covariate adjustment, or clustering; any design departing from
19> those assumptions requires a statistician. The protocol auditor checks
20> structure and internal consistency, not regulatory acceptability. Every
21> artifact produced here needs sign-off from qualified biostatistics, clinical,
22> and regulatory affairs personnel before it enters a submission.
23
24## When to use this skill
25
26- **Planning a study** and needing a defensible sample size before the budget
27 and site count can be set
28- **Auditing a draft protocol** for missing ICH E6 elements before it goes to an
29 ethics committee or a sponsor review board
30- **Choosing between candidate endpoints** where one is clinically meaningful
31 and the other is achievable in the available sample
32- **Designing inclusion and exclusion criteria** and needing to see the accrual
33 cost of each additional restriction
34- **Assessing site feasibility** — deciding how many sites, and which, are
35 needed to hit an enrolment target inside the accrual window
36- **Diagnosing an under-accruing study** and deciding between adding sites,
37 extending the window, or amending eligibility
38
39## Inputs the skill expects
40
41- Study phase, design (parallel, crossover, single-arm), and blinding
42- The primary question in a form that names the comparison
43- Candidate endpoints with their measurement instrument and timepoint
44- Effect size assumptions and their source — prior study, pilot, or literature
45- Expected dropout rate, from comparable studies where possible
46- For feasibility: candidate sites with eligible population, prior accrual
47 attainment, startup time, and competing studies
48
49## Clarify First
50
51Before generating, confirm these inputs. If any is unknown or vague, ASK — do not assume:
52
53- [ ] **The primary endpoint and its measurement timepoint** — everything downstream (sample size, visit schedule, site burden, cost) derives from it
54- [ ] **The effect size and where it came from** — a literature effect and a pilot effect carry very different uncertainty, and a pilot-derived SD needs an inflation allowance
55- [ ] **Design features that break the simple formulas** — interim analyses, co-primary endpoints, cluster randomisation, or crossover each require a different calculation and a statistician
56- [ ] **The enrolment window and site network available** — a sample size that cannot be accrued is not a plan
57
58Stop rule: ask only the 2-3 that most change the output. If the user says "just draft it," proceed and list your assumptions at the top of the artifact.
59
60## Workflows
61
62### Workflow 1 — Plan sample size and power
63
641. Fix the primary endpoint and its type: binary, continuous, or time-to-event.
65 This selects the design, and the design selects the formula.
662. State the effect size you want to detect and where it came from. **[PROVEN]**
67 Power for the smallest effect that would change clinical practice, not for
68 the effect you hope to see — the latter systematically under-powers studies.
693. Set alpha (0.05 two-sided unless the protocol justifies otherwise), power
70 (80% minimum, 90% where feasible), allocation ratio, and dropout rate.
714. Run the calculator. Read both the analysed n and the enrol n — the dropout
72 inflation is the number that drives the budget.
735. If you have a fixed n constrained by budget or accrual, pass it as
74 `planned_n_per_group` and read the achieved power instead.
756. Take the result to a biostatistician. This step is not optional.
76
77```bash
78python3 research-ops/clinical-research/scripts/sample_size_calculator.py \
79 --input research-ops/clinical-research/assets/sample_power_spec.json \
80 --format text
81```
82
83### Workflow 2 — Audit a protocol outline
84
851. Map the draft protocol's sections onto the ICH E6 element keys.
862. Enter endpoints with role, measure, timepoint, and analysis population;
87 enter inclusion and exclusion criteria verbatim.
883. Run the auditor. It reports missing sections, endpoints that cannot be
89 analysed as written, eligibility criteria that conflict or duplicate, and
90 gaps in the statistical and safety sections.
914. Clear every `fail` before circulating the draft. Missing sections and an
92 unadjusted interim analysis are the two findings most likely to cost you a
93 review cycle.
94
95```bash
96python3 research-ops/clinical-research/scripts/protocol_auditor.py \
97 --input research-ops/clinical-research/assets/sample_protocol.json \
98 --format text
99```
100
101### Workflow 3 — Test the site network against the enrolment target
102
1031. Collect per-site data: eligible annual population, self-reported accrual
104 estimate, prior accrual attainment, startup time, coordinator status, and
105 competing studies.
1062. Run the feasibility scorer. It discounts self-reported estimates, blends in
107 the site's historical attainment, caps against eligible population, and
108 subtracts startup time from the accrual window.
1093. Read the shortfall. If it is positive, the choice is more sites, a longer
110 window, or looser eligibility — decide deliberately rather than discovering
111 it at month 14.
1124. Use `--select` to test whether a smaller, higher-quality site set beats a
113 larger one. It usually does on cost, and often on total accrual.
114
115```bash
116python3 research-ops/clinical-research/scripts/site_feasibility_scorer.py \
117 --input research-ops/clinical-research/assets/sample_sites.json \
118 --select 5 --format text
119```
120
121## Decision frameworks
122
123### Endpoint type drives everything
124
125| Endpoint type | Design | Sample driver | Typical relative n |
126|---------------|--------|---------------|--------------------|
127| **Continuous** (change in a scale) | Two means | Standardised effect size δ/σ | Smallest |
128| **Binary** (responder yes/no) | Two proportions | Absolute difference and baseline rate | 2-4x the continuous equivalent |
129| **Time-to-event** | Log-rank | Hazard ratio and event probability | Driven by events, not enrolment |
130| **Count / rate** | Poisson or negative binomial | Rate ratio and dispersion | Requires a statistician |
131| **Composite** | Depends on components | The component that dominates | Interpretation risk is high |
132
133**[PROVEN]** Where the same clinical question can be posed as continuous or
134binary, the continuous version needs materially fewer participants.
135Dichotomising a continuous measure discards information and inflates n — do it
136only when the threshold itself is what is clinically meaningful.
137
138### Effect size sources and their reliability
139
140| Source | Reliability | Adjustment |
141|--------|-------------|------------|
142| Large completed trial in the same population | **[PROVEN]** highest | Use as-is |
143| Meta-analysis of comparable trials | **[PROVEN]** high | Use the pooled estimate; check heterogeneity |
144| Single published trial, different population | **[RECOMMENDED]** moderate | Discount by 20-30%; effects rarely transfer intact |
145| Internal pilot study | **[RECOMMENDED]** moderate | Add 10-15% to n; a pilot SD is imprecise |
146| Clinician consensus on the minimum meaningful difference | **[RECOMMENDED]** | Best basis for the *target*, not for the variance |
147| The effect needed to make the business case work | Not a source | This is how under-powered studies get funded |
148
149That last row is a real failure mode. When the affordable sample size is
150back-solved into an effect size, the study is designed to fail and the failure
151is uninterpretable — you cannot distinguish "no effect" from "not enough people."
152
153### Eligibility restrictiveness
154
155Every criterion trades internal validity for accrual and generalisability.
156
157| Criteria count | Typical effect |
158|----------------|----------------|
159| Under 15 | Broad, fast accrual, high generalisability |
160| 15-25 | Standard for a phase 3 study |
161| 25-35 | Screen failure rates climb steeply; accrual timelines stretch |
162| Over 35 | Accrual frequently fails; the treated population may not resemble the studied one |
163
164**[RECOMMENDED]** For every criterion beyond about 20, require a written
165justification naming the specific safety or interpretability risk it addresses.
166Criteria accumulate through review by addition — nobody is ever assigned to
167remove one — and the cumulative accrual cost is invisible at the point each is
168added.
169
170## Anti-Patterns
171
172### Back-Solved Power
173**Mistake:** Deciding the affordable sample size first, then choosing the effect
174size that makes that n reach 80% power.
175**Why it happens:** The budget is fixed before the science is planned, and the
176calculation is treated as a document to produce rather than a constraint to
177respect.
178**Instead:** Compute n from the smallest clinically meaningful effect. If that n
179is unaffordable, the honest options are to seek more funding, run a smaller
180study explicitly labelled as a pilot with a feasibility objective, or not run
181it. A study powered for an implausibly large effect consumes the same budget and
182produces an uninterpretable result.
183
184### The Optimistic Site Estimate
185**Mistake:** Building the accrual plan on the enrolment rates sites report during
186feasibility questionnaires.
187**Why it happens:** Sites want to be selected, the estimate is made by someone
188who is not the person who will do the recruiting, and nobody is ever penalised
189for an optimistic feasibility response.
190**Instead:** Discount every self-reported estimate substantially and weight by
191the site's actual attainment on previous studies. Cross-check against the
192eligible population they reported — a site claiming 8 participants a month from
193a clinic seeing 180 eligible patients a year is claiming a screening yield that
194does not occur. Plan for the discounted number and treat outperformance as
195upside.
196
197### Criterion Creep
198**Mistake:** Each protocol review round adds two or three exclusion criteria, and
199the final protocol has 40.
200**Why it happens:** Every reviewer can name a subgroup that might complicate
201interpretation, and adding an exclusion is a costless-looking way to resolve the
202comment. Nobody's job is to remove one.
203**Instead:** Cap the criteria count in the protocol plan and treat additions as
204trade-offs requiring an explicit removal or a written justification of the
205accrual cost. Track the projected screen failure rate as criteria accumulate and
206put that number in front of reviewers.
207
208### The Unanalysable Endpoint
209**Mistake:** A primary endpoint like "improvement in patient wellbeing" with no
210named instrument, threshold, or timepoint.
211**Why it happens:** It is written early as a placeholder during objective-setting
212and is never converted into an operational definition.
213**Instead:** Every endpoint needs four things before the protocol circulates: the
214instrument, the metric derived from it, the threshold or contrast that defines
215the outcome, and the timepoint. If any of the four is missing, the endpoint
216cannot be powered, collected consistently, or analysed.
217
218### Silent Interim Looks
219**Mistake:** Planning an interim analysis without an alpha spending function,
220or examining accumulating data informally "just to see how it is going."
221**Why it happens:** Interim looks feel like prudent management, and the
222statistical cost is invisible to anyone not looking for it.
223**Instead:** Pre-specify every interim analysis with its alpha spending function
224and stopping boundaries, and restrict access to unblinded accumulating data to
225an independent monitoring committee. Unadjusted repeated testing inflates type I
226error, and an informal look by the sponsor team compromises the trial's
227integrity even when nothing is acted on.
228
229## Files
230
231| File | Purpose |
232|------|---------|
233| `scripts/sample_size_calculator.py` | Sample size and power CLI: input validation, dropout inflation, planning warnings, and reporting |
234| `scripts/power_formulas.py` | Design formulas imported by `sample_size_calculator.py`: the two-proportion, two-mean (with t-correction), and log-rank sample-size calculations, the achieved-power inversions, and the method notes reported with every result. Edit here to revise the statistics |
235| `scripts/protocol_auditor.py` | Audits a protocol outline against ICH E6 elements, endpoint definitions, and eligibility consistency |
236| `scripts/protocol_rules.py` | Rule definitions imported by `protocol_auditor.py`: the ICH E6 required-section table and its guidance strings, vague-measure and DSMB-phase thresholds, the SAE reporting window, severity ordering, and the finding accumulator. Edit here to revise what the audit expects |
237| `scripts/site_feasibility_scorer.py` | Discounts site accrual estimates and tests the network against the enrolment target |
238| `references/protocol-and-endpoint-design.md` | ICH E6 protocol contents, endpoint hierarchies, eligibility design, estimand framing |
239| `references/statistical-planning.md` | Formulas, worked examples, design effects, interim analysis, and when to escalate to a statistician |
240| `assets/protocol-outline-template.md` | The protocol skeleton with every required element |
241| `assets/sample_power_spec.json` | Runnable input for the sample size calculator |
242| `assets/sample_protocol.json` | Runnable input for the protocol auditor |
243| `assets/sample_sites.json` | Runnable input for the site feasibility scorer |