$npx -y skills add RConsortium/pharma-skills --skill group-sequential-designDesign group sequential clinical trials for survival endpoints (OS, PFS, DFS) with interim analyses, spending functions, boundaries, multiplicity, and event/enrollment prediction. Triggers on: Phase 3 trial design, sample size/events for survival endpoints, alpha spending, group
| 1 | ## Bundled Resources |
| 2 | |
| 3 | | File | What it contains | When to read | |
| 4 | |------|-----------------|--------------| |
| 5 | | `reference.md` | Design guidance, parameter tables, spending functions, key rules, failure modes, analysis framework, protocol references | After collecting user inputs, before writing R code | |
| 6 | | `examples.md` | All R code examples organized by design pattern | When you need code for a specific pattern — read only the relevant section | |
| 7 | | `post_design.md` | IA timing checks (warning messages, user options), verification procedure (pass criteria, lrsim code, log template) | After computing the design (step 6), before delivering | |
| 8 | | `scripts/gsd_report_template.py` | Bundled Python report template — reads gsd_results.json, generates gsd_report.docx with zero hardcoded values | Step 9: copy to output dir and run (or extend for design-specific features) | |
| 9 | |
| 10 | Do NOT read these files upfront. Read them only when you reach the corresponding step. |
| 11 | |
| 12 | --- |
| 13 | |
| 14 | ## Compact Instructions |
| 15 | |
| 16 | When the conversation gets long and context is compressed, preserve information in this priority order: |
| 17 | |
| 18 | 1. **Architecture decisions** — never re-summarize these; they are settled |
| 19 | 2. **Key changes** — what was computed, what parameters were chosen |
| 20 | 3. **Current verification status** — pass/fail only, drop verbose logs |
| 21 | 4. **Tool outputs** — can be deleted; keep only essential numbers (events, boundaries, power, sample size) |
| 22 | |
| 23 | --- |
| 24 | |
| 25 | ## Workflow |
| 26 | |
| 27 | **Task Progress Tracking:** At the start of step 6 (after user confirms inputs), create a task checklist using `TaskCreate` for all remaining steps. Mark each task `in_progress` when starting and `completed` when done. Typical tasks: |
| 28 | 1. Write and run R design script (gsd_design.R) |
| 29 | 2. Check IA timing constraints |
| 30 | 3. Run verification simulation (gsd_verification.R) |
| 31 | 4. Generate Word report (gsd_report.py) |
| 32 | |
| 33 | This gives the user a visual progress indicator (spinner → checkmark) throughout the computation. |
| 34 | |
| 35 | **Pacing — one artifact per turn.** Do not bundle multiple major artifacts into a single response. Each of these is its own turn: |
| 36 | - Writing `gsd_design.R` (then stop — let the tool result come back) |
| 37 | - Running `gsd_design.R` (then stop) |
| 38 | - Writing `gsd_verification.R` |
| 39 | - Running the verification |
| 40 | - Writing the report |
| 41 | |
| 42 | When you call `Write` for a script, do not also include long reasoning or a parallel `Bash` execution in the same turn. Save explanations for the final report. This keeps each assistant turn well under the output token cap and avoids truncation. |
| 43 | |
| 44 | --- |
| 45 | |
| 46 | 0. **Scope check — do this before anything else.** |
| 47 | |
| 48 | This skill supports **standard group sequential designs (GSD) for survival endpoints** (OS, PFS, DFS). Before collecting any inputs, assess whether the user's request falls within this scope. |
| 49 | |
| 50 | **In scope — proceed to Step 1:** |
| 51 | - Fixed set of hypotheses tested at pre-planned interim and final analyses |
| 52 | - Survival endpoints (time-to-event): OS, PFS, DFS, EFS |
| 53 | - Single or co-primary endpoints; single or multiple nested populations (subgroup + ITT) |
| 54 | - Pre-specified alpha spending, futility boundaries, multiplicity graphs |
| 55 | - Non-proportional hazard evaluation as a sensitivity analysis on a fixed GSD |
| 56 | |
| 57 | **Out of scope — stop and explain.** If the user's request matches any of the patterns below, do NOT proceed with the GSD workflow. Instead, reply with the message template at the end of this step. |
| 58 | |
| 59 | | Pattern | Key signals in the user's description | |
| 60 | |---------|--------------------------------------| |
| 61 | | **Adaptive enrichment** | "enrich to biomarker-positive patients based on interim data", "narrow the population if the subgroup is responding", "population selection at interim", "pick the responders mid-trial" | |
| 62 | | **Sample size re-estimation (SSR)** | "increase the sample size based on interim results", "blinded or unblinded SSR", "adaptive sample size", "re-estimate events or N at interim" | |
| 63 | | **Dose selection / seamless Phase 2/3** | "select the best dose at interim and continue", "drop losing arms", "pick the winner dose", "seamless adaptive Phase 2/3" | |
| 64 | | **Platform / master protocol** | "add or remove treatment arms dynamically", "master protocol", "basket or umbrella trial arm management" | |
| 65 | | **Non-survival primary endpoint** | Binary response rate, continuous endpoint, count data as the primary — note: survival co-primaries alongside a binary endpoint are borderline; ask the user to clarify which endpoint drives the GSD | |
| 66 | | **Adaptive randomization** | "response-adaptive randomization", "update allocation ratios based on |