power-optimization-patterns

power-optimization-patterns is a skill for Claude Code, Codex from choxos/BiostatAgent. It costs 33 tokens per session (2,325 once invoked), scanned A, original, MIT.

Reference patterns for optimizing clinical trial designs, such as choosing sample size, treatment allocation, or event counts to reach a target statistical power. It also covers comparing trade-offs and testing sensitivity to assumptions.

In plain words
What is it for?
Use it to determine sample sizes, select design parameters, compare competing objectives, and perform sensitivity analyses for clinical trials.
Why use it?
It helps turn design goals and constraints into explicit optimization problems. This makes it easier to find suitable design settings and see how results change under different assumptions.

Skill for Claude CodeCodex

Part of the clinical-trial-simulation plugin — 7 skills, 5 commands, 7 agents shipped together

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.

agentmods
npx agentmods add skills/choxos/biostatagent/power-optimization-patterns
Any agent
npx skills add choxos/BiostatAgent --skill power-optimization-patterns
Clone the repo
git clone --depth 1 https://github.com/choxos/BiostatAgent

Made for: Claude Code, Codex.

Or install clinical-trial-simulation, the plugin that ships this one along with the rest of its 7 skills, 5 commands, 7 agents.

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 power-optimization-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/choxos/biostatagent/power-optimization-patterns.svg)](https://agentmods.dev/skills/choxos/biostatagent/power-optimization-patterns)
Your own site
<a href="https://agentmods.dev/skills/choxos/biostatagent/power-optimization-patterns"><img src="https://agentmods.dev/badge/skills/choxos/biostatagent/power-optimization-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,325 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00033 $0.02325
Opus 5 $0.00016 $0.01162
Sonnet 5 $0.00007 $0.00465
Haiku 4.5 $0.00003 $0.00232

Measured 3d ago against content hash faab8838889c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

power-optimization-patterns 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 3d 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.

plugins/clinical-trial-simulation/skills/power-optimization-patterns/SKILL.md · 347 lines

How it starts

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

Power Optimization Patterns

When to Use This Skill

  • Optimizing sample size for target power
  • Selecting design parameters (randomization ratio, event count)
  • Trading off between competing objectives
  • Performing sensitivity analysis
  • Finding optimal regions across scenarios

Clinical Trial Optimization Framework

Problem Formulation

Components:

  • Data Model D(θ): Parameterized by θ (treatment effects, rates, etc.)
  • Analysis Model A(λ): Parameterized by λ (sample size, events, etc.)
  • Criterion ψ(λ | θ): Power or other metric

Objective: Find λ* that optimizes ψ(λ | θ) subject to constraints.

Direct Optimization

Sample Size Determination

Objective: Find minimum n such that Power(n) ≥ target

Binary Search Algorithm:

find_sample_size <- function(target_power, effect_size, alpha = 0.025,
                            n_low = 50, n_high = 500, n_sims = 10000) {

  while (n_high - n_low > 5) {
    n_mid <- round((n_low + n_high) / 2)

    # Run CSE with n_mid
    data.model <- DataModel() +
      OutcomeDist(outcome.dist = "NormalDist") +
      SampleSize(n_mid) +
      Sample(id = "Control", outcome.par = parameters(mean = 0, sd = 1)) +
      Sample(id = "Treatment", outcome.par = parameters(mean = effect_size, sd = 1))

    analysis.model <- AnalysisModel() +
      Test(id = "Primary", samples = samples("Control", "Treatment"), method = "TTest")

    evaluation.model <- EvaluationModel() +
      Criterion(id = "Power", method = "MarginalPower",
                tests = tests("Primary"), labels = "Power",
                par = parameters(alpha = alpha))

    results <- CSE(data.model, analysis.model, evaluation.model,
                   SimParameters(n.sims = n_sims, proc.load = "full", seed = 12345))

    power <- results$simulation.results$Power

    if (power >= target_power) {
      n_high <- n_mid
    } else {
      n_low <- n_mid
    }
  }

  return(n_high)
}

Event Count Optimization (TTE)

# Grid search over event counts
event_grid <- seq(200, 400, by = 25)
power_results <- numeric(length(event_grid))

for (i in seq_along(event_grid)) {
  results <- sim_fixed_n(
    n_sim = 10000,
    sample_size = 500,
    target_event = event_grid[i],
    enroll_rate = enroll_rate,
    fail_rate = fail_rate,
    timing_type = 2
  )
  power_results[i] <- mean(results$z < qnorm(0.025))
}

# Find minimum events for 90% power
min_events <- event_grid[min(which(power_results >= 0.90))]

Read the full file on GitHub · 347 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. 3d ago First seen · 347 lines · 33 tokens per session scan A faab8838889c

Subscribe to this mod's changes

power-optimization-patterns is a skill published in the GitHub repository choxos/BiostatAgent (11 stars, last pushed 3mo ago), licensed MIT. It adds 33 tokens to every session and 2,325 once invoked, about $0.0002 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.

Related

Other skills, from other repositories

biomcp

Search and retrieve biomedical data - genes, variants, clinical trials, diagnostic tests, articles, drugs, diseases, pathways, proteins, adverse events, pharmacogenomics, and phenotype-disease matching. Use for gene function, variant pathogenicity, trials, diagnostics, drug safety, pathway context, disease workups…

genomoncology/biomcp · 70 tokens

clinical-trials-search

Search ClinicalTrials.gov with natural language queries. Find clinical trials, enrollment, and outcomes using Valyu semantic search.

beita6969/ScienceClaw · 28 tokens

omop-migration-mapper

Generates a mapping schema to transform any EMR/healthcare database to OHDSI OMOP CDM format. Use when the user needs to map source healthcare data tables to OMOP using pyomop-migrate, extract a source database schema, define column mappings, resolve concept lookups, validate data quality, and produce a…

dermatologist/pyomop · 93 tokens

lifesciences-clinical

Queries clinical databases (Open Targets, ClinicalTrials.gov) via curl for target-disease associations, target tractability assessment, and clinical trial discovery. This skill should be used when the user asks to "validate drug targets", "find clinical trials", "assess target tractability", "discover disease…

donbr/lifesciences-research · 94 tokens

lifesciences-crispr

Validates synthetic lethality claims from CRISPR knockout screens using BioGRID ORCS 5-phase workflow. This skill should be used when the user asks to "validate synthetic lethality", "query CRISPR essentiality data", "find gene dependencies", "compare cell line screens", or mentions BioGRID ORCS, gene knockout data…

donbr/lifesciences-research · 102 tokens

lifesciences-graph-builder

Orchestrates life sciences APIs to build knowledge graphs using the Fuzzy-to-Fact protocol, combining MCPs for nodes and curl for edges, then persisting to Graphiti. This skill should be used when the user asks to "build knowledge graphs", "find biological connections", "explore drug repurposing", "validate drug…

donbr/lifesciences-research · 104 tokens