experiment-design
Helps design rigorous research studies, including A/B tests, RCTs, and statistical power analysis.
Install
mkdir -p .claude/skills/experiment-design && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/16122" && unzip -o skill.zip -d .claude/skills/experiment-design && rm skill.zipInstalls to .claude/skills/experiment-design
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Design scientific experiments including sample size calculation, randomization, control groups, blinding, and study protocols. Covers RCTs, quasi-experiments, factorial designs, A/B tests, survey design, and observational studies. Use when user asks to design an experiment, calculate sample size, plan a study, set up controls, or create a research protocol. Triggers on "design experiment", "sample size", "power analysis", "study design", "control group", "randomization", "A/B test", "factorial design", "survey design".Key capabilities
- →Select appropriate study designs
- →Calculate sample sizes for experiments
- →Perform power analysis
- →Design control groups and blinding strategies
- →Develop study protocols
How it works
The skill provides guidance on selecting experimental designs, calculates sample sizes using statistical formulas, and outlines principles for controls, randomization, and blinding.
Inputs & outputs
When to use experiment-design
- →Calculate sample size for A/B test
- →Design a randomized control trial
- →Select experimental methodology
About this skill
Experiment Design
Scientific experiment planning, power analysis, and protocol development.
Design Selection Guide
| Research Question | Recommended Design |
|---|---|
| Does X cause Y? | RCT (gold standard) |
| Does X cause Y? (can't randomize) | Quasi-experiment, natural experiment |
| How do factors interact? | Factorial design |
| Which version performs better? | A/B test |
| What is the prevalence/association? | Cross-sectional survey |
| How does outcome change over time? | Longitudinal / cohort study |
| What is the lived experience? | Qualitative (interviews, ethnography) |
| Does intervention work in practice? | Pragmatic trial |
Power Analysis & Sample Size
source /Users/zhangmingda/clawd/.venv/bin/activate
python3 << 'EOF'
from scipy import stats
import numpy as np
# --- Two-sample t-test ---
def sample_size_ttest(effect_size, alpha=0.05, power=0.80):
"""Cohen's d effect sizes: small=0.2, medium=0.5, large=0.8"""
from scipy.stats import norm
z_alpha = norm.ppf(1 - alpha/2)
z_beta = norm.ppf(power)
n = 2 * ((z_alpha + z_beta) / effect_size) ** 2
return int(np.ceil(n))
# --- Chi-square test ---
def sample_size_chi2(effect_size, alpha=0.05, power=0.80, df=1):
"""Cohen's w effect sizes: small=0.1, medium=0.3, large=0.5"""
from scipy.stats import norm, chi2
z_beta = norm.ppf(power)
z_alpha = norm.ppf(1 - alpha)
n = ((z_alpha + z_beta) / effect_size) ** 2
return int(np.ceil(n))
# --- Correlation ---
def sample_size_correlation(r, alpha=0.05, power=0.80):
from scipy.stats import norm
z_alpha = norm.ppf(1 - alpha/2)
z_beta = norm.ppf(power)
z_r = 0.5 * np.log((1+r)/(1-r)) # Fisher's z
n = ((z_alpha + z_beta) / z_r) ** 2 + 3
return int(np.ceil(n))
# Examples
print(f"t-test (d=0.5): n={sample_size_ttest(0.5)} per group")
print(f"t-test (d=0.3): n={sample_size_ttest(0.3)} per group")
print(f"Chi-square (w=0.3): n={sample_size_chi2(0.3)}")
print(f"Correlation (r=0.3): n={sample_size_correlation(0.3)}")
EOF
Key Design Principles
Controls
- Positive control: Known to produce effect (validates method works)
- Negative control: Known to produce no effect (validates baseline)
- Placebo control: Inert treatment (controls for expectation effects)
- Active control: Existing standard treatment (for superiority/non-inferiority)
Randomization
- Simple: Coin flip / random number
- Block: Ensures equal groups per block
- Stratified: Randomize within strata (age, sex, severity)
- Cluster: Randomize groups, not individuals
Blinding
- Single-blind: Participants don't know assignment
- Double-blind: Participants and researchers don't know
- Triple-blind: Participants, researchers, and analysts don't know
Bias Mitigation
| Bias | Mitigation |
|---|---|
| Selection bias | Random sampling, clear inclusion criteria |
| Allocation bias | Random assignment, concealed allocation |
| Performance bias | Blinding, standardized protocols |
| Detection bias | Blinded outcome assessment |
| Attrition bias | ITT analysis, minimize dropout |
| Reporting bias | Pre-registration, analysis plan |
Study Protocol Template
# Study Protocol: [Title]
## 1. Background & Rationale
## 2. Objectives & Hypotheses
- Primary:
- Secondary:
## 3. Study Design
- Type: [RCT / quasi-experiment / observational / ...]
- Duration:
## 4. Participants
- Population:
- Inclusion criteria:
- Exclusion criteria:
- Sample size: N = [calculated], power = 0.80, α = 0.05
## 5. Intervention / Exposure
## 6. Outcome Measures
- Primary:
- Secondary:
## 7. Randomization & Blinding
## 8. Data Collection Procedures
## 9. Statistical Analysis Plan
- Primary analysis:
- Secondary analyses:
- Handling of missing data:
## 10. Ethical Considerations
- IRB/Ethics approval:
- Informed consent:
- Data privacy:
## 11. Timeline
## 12. Budget
Pre-registration
Recommend pre-registration for confirmatory studies:
- OSF: osf.io (general)
- ClinicalTrials.gov: clinical trials
- PROSPERO: systematic reviews
- AsPredicted: aspredicted.org (quick)
Tips
- Always justify sample size with power analysis
- Pre-register hypotheses and analysis plan
- Plan for 10-20% attrition in sample size calculation
- Document all deviations from protocol
- Consider pilot study for novel methods
When not to use it
- →When the user is not asking to design an experiment or plan a study
- →When the task is purely qualitative research without experimental design elements
Limitations
- →The skill focuses on scientific experiment design.
- →Sample size calculations are provided for specific statistical tests (t-test, chi-square, correlation).
- →It provides templates and principles, but specific implementation details are left to the user.
How it compares
This skill offers structured guidance and code for scientific experiment design, including sample size calculations, unlike general research planning.
Compared to similar skills
experiment-design side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| experiment-design (this skill) | 0 | 5mo | No flags | Intermediate |
| literature-review | 559 | 2mo | Review | Advanced |
| openalex-database | 48 | 7mo | Review | Intermediate |
| scientific-critical-thinking | 18 | 7mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
literature-review
K-Dense-AI
Conduct comprehensive, systematic literature reviews using multiple academic databases (PubMed, arXiv, bioRxiv, Semantic Scholar, etc.). This skill should be used when conducting systematic literature reviews, meta-analyses, research synthesis, or comprehensive literature searches across biomedical, scientific, and technical domains. Creates professionally formatted markdown documents and PDFs with verified citations in multiple citation styles (APA, Nature, Vancouver, etc.).
openalex-database
davila7
Query and analyze scholarly literature using the OpenAlex database. This skill should be used when searching for academic papers, analyzing research trends, finding works by authors or institutions, tracking citations, discovering open access publications, or conducting bibliometric analysis across 240M+ scholarly works. Use for literature searches, research output analysis, citation analysis, and academic database queries.
scientific-critical-thinking
davila7
Evaluate research rigor. Assess methodology, experimental design, statistical validity, biases, confounding, evidence quality (GRADE, Cochrane ROB), for critical analysis of scientific claims.
biorxiv-database
lifangda
Efficient database search tool for bioRxiv preprint server. Use this skill when searching for life sciences preprints by keywords, authors, date ranges, or categories, retrieving paper metadata, downloading PDFs, or conducting literature reviews.
physics-validator
omriwen
Validate optical physics parameters including Fresnel numbers, diffraction regimes, and resolution limits. This skill should be used when configuring Telescope, Microscope, or Camera instruments to ensure physically realistic parameters.
fda-database
davila7
Query openFDA API for drugs, devices, adverse events, recalls, regulatory submissions (510k, PMA), substance identification (UNII), for FDA regulatory data analysis and safety research.