SkillAgentSearch skills...

causal-inference-mixtape

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 pa…

Install / Use

npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill 10-Jill0099-causal-inference-mixtape

Installs into whichever agent you are using.

About this skill
📄

SKILL.md

Installable skill definition

Quality Score

89/100

Category

Automation

Supported Platforms

Universal

Our assessment of causal-inference-mixtape

causal-inference-mixtape scores 89/100 on our quality scale, 1342nd of 2,790 Automation skills we index (top 49%).

Its SKILL.md is 5.8 KB long, well organised into 17 sections with 3 code examples: a solid amount of guidance for an agent.

With 4,360 GitHub stars, it is one of the more widely adopted skills in the catalogue.

Substance
26/30
Structure
18/20
Description
15/15
Adoption
15/20
Freshness
15/15

Maintenance, license and trust

  • The repository was last updated about 2 months ago, so causal-inference-mixtape is actively maintained.
  • Our last check on 2026-10-31 found the source still online.
  • No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
  • Its trust signals score 88/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.

Safety scan

No issues found

Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.

AI review by kimi-k2.7-code on 2026-09-29. Automated pattern scan on 2026-09-29. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.

causal-inference-mixtape compared with similar skills

All 4 of these similar skills score higher than causal-inference-mixtape; compare them before choosing.

SkillScoreStarsUpdatedFormat
causal-inference-mixtape (this skill)by brycewang-stanford894.4k54d agoSKILL.md
taste-skillby Leonxlnx100116.8k8d agoCLAUDE.md
Agent-Reachby Panniantong100112.3k8d agoCLAUDE.md
rufloby ruvnet10081.9ktodayCLAUDE.md
headroomby headroomlabs-ai10079.8ktodayCLAUDE.md

Frequently asked questions

How do I install causal-inference-mixtape?
Run npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill causal-inference-mixtape. The install tabs above show the steps for each supported agent.
Which AI agents does causal-inference-mixtape work with?
It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
Is causal-inference-mixtape safe to use?
Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It declares no license and scores 88/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
Is causal-inference-mixtape still maintained?
The repository was last updated about 2 months ago, so causal-inference-mixtape is actively maintained.

name: causal-inference-mixtape description: '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.' version: 1.0.0

Causal Inference: The Mixtape — Code Skill

Practitioner-oriented causal inference skill built from Scott Cunningham's Causal Inference: The Mixtape repository. Covers 10 identification strategies with ready-to-run code templates in Python, R, and Stata.


Methods Covered

| Method | Python | R | Stata | Reference | |--------|--------|---|-------|-----------| | OLS / Regression | statsmodels | estimatr | reg/reghdfe | references/method-patterns.md §1 | | Difference-in-Differences | statsmodels + C() | lfe/fixest | xtreg/reghdfe | references/method-patterns.md §2 | | Event Study (Dynamic DiD) | manual lead/lag | estimatr | reghdfe | references/method-patterns.md §3 | | Staggered DiD / TWFE | statsmodels | bacondecomp | bacondecomp | references/method-patterns.md §4 | | Regression Discontinuity | statsmodels polynomial | rdrobust | rdplot/rdrobust | references/method-patterns.md §5 | | Instrumental Variables | linearmodels IV2SLS | AER/ivreg | ivregress 2sls | references/method-patterns.md §6 | | Synthetic Control | rpy2 → R Synth | Synth + SCtools | synth | references/method-patterns.md §7 | | Matching / PSM / IPW | manual logit + weights | MatchIt + Zelig | teffects/cem | references/method-patterns.md §8 | | DAGs / Collider Bias | dagitty (conceptual) | dagitty/ggdag | — | references/method-patterns.md §9 | | Randomization Inference | permutation loop | ri2 | ritest | references/method-patterns.md §10 |


Core Workflow

Implement a Causal Method

  1. Identify the method from the table above
  2. Load the appropriate template from references/method-patterns.md
  3. Adapt variable names, fixed effects, and clustering to the user's data
  4. Add robustness checks (parallel trends for DiD, McCrary for RDD, first-stage F for IV)

Choose the Right Language

| Scenario | Recommendation | |----------|---------------| | ML pipeline integration | Python (statsmodels + linearmodels) | | Synthetic Control | R (Synth package) or Stata (synth) — Python lacks mature implementation | | Bacon decomposition | R (bacondecomp) or Stata — no Python equivalent | | Publication-ready tables | Stata (outreg2/esttab) or R (stargazer/modelsummary) | | Coarsened Exact Matching | Stata (cem) or R (MatchIt) — no Python equivalent | | Quick prototyping | Python with statsmodels |

Cross-Language Equivalents

| Task | Python | R | Stata | |------|--------|---|-------| | OLS with robust SE | smf.ols().fit(cov_type='HC1') | lm_robust() | reg y x, robust | | Cluster SE | fit(cov_type='cluster', cov_kwds={'groups': g}) | felm(y ~ x | 0 | 0 | cluster) | reg y x, cluster(id) | | Two-way FE | C(id) + C(time) in formula | felm(y ~ x | id + time) | reghdfe y x, absorb(id time) | | IV / 2SLS | IV2SLS.from_formula('y ~ 1 + exog + [endog ~ inst]') | ivreg(y ~ exog | inst) | ivregress 2sls y exog (endog = inst) | | DiD | C(treat)*C(post) | treat:post in formula | did_multiplegt or interaction |


Key Python Patterns

DiD with Cluster-Robust SE

import statsmodels.formula.api as smf

model = smf.ols('y ~ C(treated)*C(post) + controls', data=df)
results = model.fit(cov_type='cluster', cov_kwds={'groups': df['firm_id']})

Event Study (Lead/Lag)

# Create relative time dummies
for k in range(-4, 5):
    col = f'rel_{k}' if k >= 0 else f'rel_m{abs(k)}'
    df[col] = (df['relative_time'] == k).astype(int)

# Drop t=-1 as reference
formula = 'y ~ ' + ' + '.join([c for c in rel_cols if c != 'rel_m1']) + ' + C(id) + C(year)'

IV / 2SLS

from linearmodels.iv import IV2SLS

model = IV2SLS.from_formula('y ~ 1 + exog + [endog ~ instrument]', data=df)
results = model.fit(cov_type='clustered', clusters=df['cluster_var'])

Robustness Check Patterns

| Method | Required Checks | |--------|----------------| | DiD | Parallel trends (event study plot), placebo treatment dates | | RDD | McCrary density test, bandwidth robustness (half/double IK optimal), polynomial robustness | | IV | First-stage F > 10, exclusion restriction argument, over-identification test | | Synthetic Control | Pre-treatment RMSPE, placebo distribution, leave-one-out | | Matching | Covariate balance table, caliper sensitivity |


Common Pitfalls

  1. TWFE with staggered treatment — standard two-way FE is biased when treatment timing varies. Use Bacon decomposition or Sun & Abraham / Callaway & Sant'Anna estimators.
  2. Synthetic Control with many treated units — the Synth package handles one treated unit. For multiple, use augmented synthetic control or stacked approach.
  3. RDD without McCrary test — always test for manipulation at the cutoff before estimating.
  4. IV weak instruments — report first-stage F-statistic. Below 10 indicates weak instrument bias.
  5. Python Synth gap — no mature Python Synth package exists. Use rpy2 to call R's Synth from Python.

Additional Resources

Reference Files

  • references/method-patterns.md — Detailed code templates for all 10 methods with full examples
  • references/r-stata-comparison.md — Cross-language package comparison and method coverage gaps

Prompt Files

  • prompts/01-implement-method.md — Copy-paste prompt for implementing any causal method
  • prompts/02-robustness-checks.md — Copy-paste prompt for generating robustness check code

Related Skills

View on GitHub
GitHub Stars4.4k
CategoryAutomation
Updated1mo ago
Forks527

Languages

Stata

Trust signals

88/100

From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.

1 medium