Agent Skill
Causal Inference Mixtape skill
causal-inference-mixtapebrycewang-stanford/Auto-Empirical-Research-Skillsskills/10-Jill0099-causal-inference-mixtape/SKILL.md
This skill should be used when the user asks to "implement a DiD regression", "write a causal inference pipeline", "set up an event study", "implement instrumental variables", "run a regression discontinuity design", "build a synthetic control model", "implement propensity score matching", "write parallel trends test", "implement Bacon decomposition", or needs code templates for causal inference methods in Python, R, or Stata. Based on Scott Cunningham's Causal Inference: The Mixtape.
always on
108 tokname + description
once used
1,487 tokSKILL.md body
bundled files
528 KB
repo stars
4.7kGitHub
Install the Causal Inference Mixtape skill
Skills CLI (Claude Code, Codex, Cursor and others)
npx skills add https://github.com/brycewang-stanford/Auto-Empirical-Research-Skills --skill causal-inference-mixtape
Claude Code, by hand (all projects)
git clone --depth 1 https://github.com/brycewang-stanford/Auto-Empirical-Research-Skills.git /tmp/Auto-Empirical-Research-Skills mkdir -p ~/.claude/skills cp -R /tmp/Auto-Empirical-Research-Skills/skills/10-Jill0099-causal-inference-mixtape ~/.claude/skills/causal-inference-mixtape
For one project only, copy the folder into .claude/skills/ in that project instead. The agent picks it up when a task matches its description.
What it costs your context
Agent Skills load in three steps. Tokens counted with the o200k tokenizer; your model's count will differ a little.
| When | What loads | Cost |
|---|---|---|
| Every session | Name and description | 108 tok |
| When the agent uses it | The SKILL.md instructions | 1,487 tok |
| Only if opened | 5 bundled files (28 KB) | varies |
Until it is used, causal-inference-mixtape costs about 13× less than the median MCP server we measured (1,363 tokens on every turn). Installing all 150 skills from brycewang-stanford/Auto-Empirical-Research-Skills would load 14,926 tokens of descriptions. Skills vs MCP study
Checks
- The name doesn't match its folder name, as the specification requires.
Checked 2026-10-22 · method
What's inside
The headings of its SKILL.md. Read the full file on GitHub.
- Causal Inference: The Mixtape — Code Skill
- Methods Covered
- Core Workflow
- Implement a Causal Method
- Choose the Right Language
- Cross-Language Equivalents
- Key Python Patterns
- DiD with Cluster-Robust SE
- Event Study (Lead/Lag)
- IV / 2SLS
- Robustness Check Patterns
- Common Pitfalls
- Additional Resources
- Reference Files
- Prompt Files
More skills from brycewang-stanford/Auto-Empirical-Research-Skills
- Answering Research Questionsbrycewang-stanford/Auto-Empirical-Research-Skills
Main orchestration workflow for systematic literature research - search, evaluate, traverse, synthesize
4.7k22 tok idle · 4,546 in use - Building Paper Screening Rubricsbrycewang-stanford/Auto-Empirical-Research-Skills
Collaboratively build and refine paper screening rubrics through brainstorming, test-driven development, and iterative feedback
4.7k25 tok idle · 4,524 in use - Checking ChEMBL for Structured SAR Databrycewang-stanford/Auto-Empirical-Research-Skills
Check if medicinal chemistry papers are in ChEMBL database to access curated bioactivity data
4.7k26 tok idle · 3,679 in use - Cleaning Up Research Sessionsbrycewang-stanford/Auto-Empirical-Research-Skills
Safely remove intermediate files from completed research sessions while preserving important data
4.7k18 tok idle · 2,943 in use - Evaluating Paper Relevancebrycewang-stanford/Auto-Empirical-Research-Skills
Two-stage paper screening - abstract scoring then deep dive for specific data extraction
4.7k20 tok idle · 5,077 in use - Finding Open Access Papersbrycewang-stanford/Auto-Empirical-Research-Skills
Use Unpaywall API to find free full-text versions of paywalled papers
4.7k21 tok idle · 2,422 in use - Full-empirical-analysis-skillbrycewang-stanford/Auto-Empirical-Research-Skills
Classical end-to-end empirical analysis workflow in the traditional Python econometric stack — pandas + numpy + scipy + statsmodels + linearmodels + pyfixest + rdrobust + econml + causalml + matplotlib/seaborn. **Defaults to economics empirical-paper style** (AER / QJE / AEJ) — every run produces a publication-ready output set with a multi-column regression table (M1→M6 progressive controls/FE) as the centerpiece, plus Table 1 (descriptives), mechanism / heterogeneity / robustness tables, and event-study + coefficient + trend figures. Covers the full 8-step pipeline an applied economist or quantitative social scientist runs on every paper — (1) data cleaning, (2) variable construction & transformation, (3) descriptive statistics & Table 1, (4) statistical diagnostic tests, (5) baseline empirical modeling, (6) robustness battery, (7) further analysis (mechanism, heterogeneity, mediation, moderation), (8) publication-ready tables & figures. **Also covers two parallel domain modes that share the same 8-step scaffolding** — **Mode A — Epidemiology / public health** (target-trial emulation via `zepid` / hand-rolled `pandas`, IPTW + g-formula + TMLE doubly-robust triplet via `zepid` / `econml` / `lifelines`, Mendelian randomization via `pymr` / `mrtool` (or `rpy2` → `MendelianRandomization`/`TwoSampleMR`), KM / AFT / Cox survival via `lifelines`, E-value sensitivity, principal stratification — STROBE / TRIPOD reporting), and **Mode B — ML causal inference** (DML via `econml.dml` / `doubleml`, S/T/X/R/DR meta-learners via `econml.metalearners` / `causalml`, causal forest via `econml.grf` / `causalml`, Dragonnet / TARNet / CEVAE neural causal via `causalml`, BCF via `pymc-bart` / `bcf-py`, matrix completion, CATE distribution + policy tree via `econml.policy` / `policytree-py`, off-policy evaluation, conformal causal via `mapie`, fairness audit via `fairlearn`, DAG learning via `causal-learn` / `cdt` / LLM-assisted). Prescribes which library to reach for at each step, shows the canonical code, and links to deeper `references/` files for variant-specific patterns. Use when the user asks for a **complete empirical analysis** in Python, wants to replicate an applied-economics paper from scratch, needs a reproducible workflow that is NOT opinionated on any single vertical package (contrast with StatsPAI), wants explicit control over every estimator and diagnostic, or asks "how do I write a full empirical pipeline in Python?". Also triggers when the user names a specific classical step in isolation — "winsorize at 1/99%", "run Breusch-Pagan", "build a Table 1 balance table", "do a placebo test", "event study plot", "mediation analysis" — and wants it wired into the broader pipeline. Mode A triggers on "target trial emulation", "IPTW", "TMLE", "Mendelian randomization", "STROBE", "公共健康", "流行病学". Mode B triggers on "DML", "double machine learning", "causal forest", "meta-learner", "Dragonnet", "BCF", "policy tree", "conformal causal", "fairness audit", "因果机器学习".
4.7k779 tok idle · 31,086 in use - Full-empirical-analysis-skill-Rbrycewang-stanford/Auto-Empirical-Research-Skills
Classical end-to-end empirical analysis workflow in the modern tidyverse + econometrics R ecosystem — dplyr + tidyr + haven + fixest + sandwich + lmtest + clubSandwich + AER + ivreg + did + bacondecomp + HonestDiD + eventstudyr + rdrobust + rddensity + Synth + gsynth + synthdid + MatchIt + WeightIt + cobalt + ebal + grf + DoubleML + mediation + marginaleffects + modelsummary + kableExtra + gt + ggplot2 + ggpubr + cowplot + binsreg. **Defaults to economics empirical-paper style** (AER / QJE / AEJ) — every run produces a publication-ready output set with a multi-column regression table (M1→M6 progressive controls/FE) as the centerpiece, plus Table 1 (descriptives), mechanism / heterogeneity / robustness tables, and event-study + coefficient + trend figures. Covers the full 8-step R pipeline an applied economist runs on every paper — (1) data import & cleaning (read_dta/read_csv, naniar, janitor, validate-merges), (2) variable construction (mutate/across/winsorize/group_by + lag/lead with dplyr), (3) descriptive statistics & Table 1 (gtsummary, modelsummary::datasummary, tableone), (4) classical diagnostic tests (shapiro/jarque.bera.test/bptest/dwtest/bgtest/vif/adf.test/kpss.test/Hausman), (5) baseline modeling (fixest::feols, ivreg, did::att_gt, eventstudyr, sun_ab, did_imputation, synthdid, rdrobust, MatchIt, WeightIt, grf::causal_forest, DoubleML, mediation), (6) robustness battery (modelsummary stack, clubSandwich CRSE, fwildclusterboot, ri2, robomit Oster, bacondecomp, HonestDiD), (7) further analysis (interactions + marginaleffects, mediation::mediate, gsem via lavaan, dose-response splines, grf CATE), (8) publication-ready tables & figures (modelsummary, kableExtra, gt, stargazer, texreg, flextable to LaTeX/Word/HTML; ggplot2 + ggpubr + cowplot + binsreg + iplot for figures). **Also covers two parallel domain modes that share the same 8-step scaffolding** — **Mode A — Epidemiology / public health** (target-trial emulation, IPTW + g-formula + TMLE doubly-robust triplet via `WeightIt` / `gfoRmula` / `tmle` / `ltmle`, Mendelian randomization via `MendelianRandomization` / `TwoSampleMR` / `MRPRESSO`, KM / Cox / AFT / RMST survival via `survival` / `survminer` / `flexsurv`, E-value sensitivity via `EValue`, principal stratification — STROBE / TRIPOD reporting), and **Mode B — ML causal inference** (DML via `DoubleML`, S/T/X/R/DR meta-learners via `causalweight` / `grf`, causal forest via `grf::causal_forest`, BART/BCF via `bartCause` / `bcf`, matrix completion via `MCPanel`, CATE distribution + policy tree via `policytree`, off-policy evaluation, conformal causal via `conformalInference` / `cfcausal`, fairness audit via `fairmodels`, DAG learning via `pcalg` / `bnlearn` / LLM-assisted). Use when the user asks for a complete R empirical analysis, wants a tidyverse-style reproducible R script / Quarto workflow, prefers fixest over reghdfe, needs the R counterpart to StatsPAI / 00.1 / 00.2, or names a specific R step in isolation ("feols with cluster", "MatchIt nearest neighbor", "bacondecomp in R", "gtsummary table 1", "modelsummary to Word"). Mode A triggers on "target trial emulation R", "tmle ltmle", "MendelianRandomization", "TwoSampleMR", "MRPRESSO", "survival cox AFT", "STROBE R", "EValue R", "公共健康 R", "流行病学 R". Mode B triggers on "DoubleML R", "grf causal forest", "policytree", "bartCause bcf", "conformal causal R", "fairmodels", "pcalg NOTEARS", "因果机器学习 R".
4.7k990 tok idle · 34,618 in use