Production-grade Bayesian causal inference with PyMC, CausalPy, and DoWhy.

MITAuto-check passedResearch & Science

Install Causal Inference

skills CLI
$ npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill causal-inference -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install brycewang-stanford/Auto-Empirical-Research-Skills causal-inference --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/brycewang-stanford/Auto-Empirical-Research-Skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/23-Learning-Bayesian-Statistics-baygent-skills/causal-inference .claude/skills/causal-inference && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
causal-inference
GitHub stars
4.6k
Token cost
~2k tokens
SKILL.md length
853 words
Files
7 (incl. references)
Skills in repo
383
Repo updated
First seen
Licence
MIT

At a glance

Production-grade Bayesian causal inference with PyMC, CausalPy, and DoWhy.

  • Works in 8 steps: Formulate the causal question — Propose… → Draw the DAG — Propose causal graph with… → Identify — Determine identification… → …
  • : causal inference
  • SKILL.md covers Dependencies, Workflow overview, Design selection guide and Critical rules, plus 2 more sections
  • Calls git; reaches github.com

What it does

Causal Inference is an agent skill from brycewang-stanford/Auto-Empirical-Research-Skills. Production-grade Bayesian causal inference with PyMC, CausalPy, and DoWhy. Enforces DAG-first thinking, mandatory user checkpoints for assumptions, design-specific refutation, and defensible reporting with causal language guardrails. Trigger on: causal inference, causal effect estimation, treatment effects, counterfactuals, difference-in-differences (DiD), synthetic control, regression discontinuity (RDD), interrupted time series (ITS), instrumental variables (IV), propensity scores, DAGs, causal graphs…

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including reference files (for example `README.md`, `references/dags-and-identification.md` and `references/quasi-experiments.md`).

It sits in Research & Science, covering Econometrics and empirical research. It works with PyMC. The repository describes itself as: 🔬 A curated collection of 23,000+ agent skills for empirical research across 8 social science disciplines. | 精选 23,000+ AI Agent 技能库,覆盖8大社会科学学科的实证研究。CoPaper.AI… The licence is MIT.

When your agent uses it

  • : causal inference
  • Causal effect estimation
  • Treatment effects
  • Counterfactuals

Example prompts

  • “does X cause Y”
  • “what is the effect of X on Y.”
  • “/causal-inference”

Workflow steps

8 steps, taken from the first numbered list in SKILL.md.

  1. Formulate the causal question — Propose precise estimand (ATE, ATT, LATE, etc.). ⚠️ ASK USER TO CONFIRM.
  2. Draw the DAG — Propose causal graph with nodes, edges, and explicit non-edges. ⚠️ ASK USER TO CONFIRM. See…
  3. Identify — Determine identification strategy (backdoor, front-door, IV, RDD, DiD). ⚠️ ASK USER TO CONFIRM untestable assumptions. See…
  4. Choose design — Match problem to method using table below. ⚠️ ASK USER TO CONFIRM. See references/quasi-experiments.md or…
  5. Estimate — Build and fit the model. Delegate all PyMC mechanics to bayesian-workflow skill.
  6. Refute — MANDATORY. Run design-specific robustness checks. See references/refutation.md
  7. Interpret — Effect size + decision-relevant HDIs + probability of direction.
  8. Report — Generate causal analysis report. See references/reporting.md

What it can do on your machine

Read from SKILL.md and the folder at commit 9fa87d8. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Causal Inference loads about 2k tokens when it runs, and up to ~19k if it reads all its reference files. Until then it costs about 202 tokens; SKILL.md has 853 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~202
When it runs · the whole SKILL.md, loaded when a task matches
~2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~19k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from brycewang-stanford/Auto-Empirical-Research-Skills at commit 9fa87d8, republished under its MIT licence (© brycewang-stanford). 853 words, ~2,049 tokens.

Download SKILL.mdSave it as .claude/skills/causal-inference/SKILL.md (or your agent's skills folder). This skill also uses 6 other files; get the full folder from GitHub.
name
causal-inference
description
Production-grade Bayesian causal inference with PyMC, CausalPy, and DoWhy. Enforces DAG-first thinking, mandatory user checkpoints for assumptions, design-specific refutation, and defensible reporting with causal language guardrails. Trigger on: causal inference, causal effect estimation, treatment effects, counterfactuals, difference-in-differences (DiD), synthetic control, regression discontinuity (RDD), interrupted time series (ITS), instrumental variables (IV), propensity scores, DAGs, causal graphs, confounders, backdoor criterion, do-calculus, interventional distributions, pm.do(), pm.observe(), CausalPy, DoWhy, mediation analysis, refutation, sensitivity analysis, parallel trends, placebo tests, or any question of the form "does X cause Y" or "what is the effect of X on Y."
license
MIT
metadata.author
[Alexandre Andorra](https://alexandorra.github.io/)
metadata.version
1.0

Causal Inference

Dependencies

This skill requires the bayesian-workflow skill for all PyMC modeling steps (priors, sampling, diagnostics, calibration, reporting).

Detect it:

bash
ls ~/.claude/skills/bayesian-workflow/SKILL.md 2>/dev/null || ls .claude/skills/bayesian-workflow/SKILL.md 2>/dev/null

If not found, install it:

bash
git clone https://github.com/Learning-Bayesian-Statistics/baygent-skills.git /tmp/baygent-skills
cp -r /tmp/baygent-skills/bayesian-workflow ~/.claude/skills/

For all PyMC modeling steps (priors, sampling, diagnostics, calibration, reporting), follow the bayesian-workflow skill.

Workflow overview

Every causal analysis follows this sequence. Steps 1-4 are the thinking phase (no code). Steps 5-8 are the doing phase. Think before you do.

  1. Formulate the causal question — Propose precise estimand (ATE, ATT, LATE, etc.). ⚠️ ASK USER TO CONFIRM.
  2. Draw the DAG — Propose causal graph with nodes, edges, and explicit non-edges. ⚠️ ASK USER TO CONFIRM. See references/dags-and-identification.md
  3. Identify — Determine identification strategy (backdoor, front-door, IV, RDD, DiD). ⚠️ ASK USER TO CONFIRM untestable assumptions. See references/dags-and-identification.md
  4. Choose design — Match problem to method using table below. ⚠️ ASK USER TO CONFIRM. See references/quasi-experiments.md or references/structural-models.md
  5. Estimate — Build and fit the model. Delegate all PyMC mechanics to bayesian-workflow skill.
  6. Refute — MANDATORY. Run design-specific robustness checks. See references/refutation.md
  7. Interpret — Effect size + decision-relevant HDIs + probability of direction.
  8. Report — Generate causal analysis report. See references/reporting.md

Design selection guide

DesignUse whenKey assumptionTool
DiDTreatment at known time, control group availableParallel trendsCausalPy
Staggered DiDTreatment rolls out at different timesParallel trends per cohortCausalPy
Synthetic ControlSingle treated unit, donor pool availableWeighted donors approximate counterfactualCausalPy
ITSTime series, intervention at known time, no controlNo confounding event at treatment timeCausalPy
RDDTreatment by threshold on running variableNo manipulation at thresholdCausalPy
IVEndogenous treatment, valid instrumentExclusion restriction, relevanceCausalPy
IPSWObservational data, treatment modeledNo unmeasured confounders, positivityCausalPy
Structural (do/observe)Full causal theory, model mechanismsCorrect DAG specificationPyMC
Counterfactual"What would Y have been if X differed?"Correct structural modelPyMC

Critical rules

  • No estimation without a confirmed DAG. A causal graph is not optional decoration — it makes assumptions explicit and determines the adjustment set. If the user resists, explain why the DAG is non-negotiable before proceeding.
  • No causal claims without refutation. Every design has failure modes. Run at minimum one design-specific robustness check (placebo test, sensitivity analysis, falsification test) before reporting results. See references/refutation.md.
  • State assumptions before results. Lead with what must be true for the estimate to be causal. Bury the estimate after the assumptions, not before. This is not optional politeness — it prevents misuse of results.
  • Adapt HDIs to the decision context. The bayesian-workflow skill's 94% HDI is a sensible default; adapt it with explicit explanation when the decision stakes warrant it (e.g., 89% for exploratory, 97% for high-stakes policy). Report multiple intervals when the decision threshold matters.
  • Downgrade causal language when warranted. If identification assumptions are unverifiable or refutation raises flags, soften claims: "consistent with a causal effect" not "causes", "estimated effect" not "true effect". Flag uncertainty loudly in the report.
  • Ask the user when domain knowledge is needed. You cannot know whether an instrument is valid, whether parallel trends holds, or whether a confounder exists without domain expertise. Ask before assuming.
  • Delegate PyMC mechanics to bayesian-workflow. This skill handles causal structure and design. The bayesian-workflow skill handles priors, sampling, diagnostics, calibration, and reporting format. Don't duplicate those rules here.
Show full SKILL.md (326 more words)Show less

Common gotchas

These are battle-tested lessons that save hours of debugging:

  • CausalPy formula syntax uses C() for categoricals. Passing a string column directly without C() will silently produce wrong dummy coding. Always wrap categorical treatment and group variables: "y ~ C(treatment) + C(group)".
  • DoWhy requires explicit U nodes for unobserved confounders. Omitting them from the graph will make DoWhy treat your model as fully identified when it isn't. Add latent nodes explicitly and mark them as unobserved.
  • CausalPy's PyMC models don't auto-store log-likelihood. Same issue as bayesian-workflow: nutpie silently drops it. Call pm.compute_log_likelihood(idata, model=model) after sampling if you need it for model comparison.
  • Parallel trends is untestable in the post-treatment period. Pre-treatment trend tests are necessary but not sufficient — passing them doesn't prove the assumption holds after treatment. State this explicitly in every DiD report.
  • Synthetic control requires the treated unit to lie within the convex hull of donors. If the treated unit is an outlier (highest GDP, largest city), no weighted combination of donors can approximate its counterfactual. Check this before running — if violated, the design is invalid.
  • DiD group variable must be dummy-coded (0/1). CausalPy rejects string labels like "treatment"/"control". Use integers: 1 = treatment, 0 = control. Data also requires a unit column.
  • SyntheticControl expects wide-format data. Index = time, columns = unit names, values = outcome. If your data is long format, pivot first: df.pivot(index="date", columns="unit", values="outcome").

When things go wrong

SymptomLikely causeFix
Refutation failsAssumption violatedDiagnose which assumption, try alternative design or sensitivity bounds
DiD effect at placebo timeParallel trends violatedTry synthetic control or add group-specific time trends
RDD: bunching at thresholdManipulation of running variableDesign is invalid for this threshold — report and stop
SC: poor pre-treatment fitDonors don't span treated unitAdd donors, expand donor pool, or reconsider design
DoWhy says "not identifiable"Insufficient adjustment setRevise DAG, add measured variables, or change design
CausalPy formula errorWrong formula syntaxUse C() for categoricals, check variable names match dataframe columns

© brycewang-stanford, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 6 other files (references) in skills/23-Learning-Bayesian-Statistics-baygent-skills/causal-inference of brycewang-stanford/Auto-Empirical-Research-Skills.

  • SKILL.md
  • README.md
  • references/dags-and-identification.md
  • references/quasi-experiments.md
  • references/refutation.md
  • references/reporting.md
  • references/structural-models.md

Open the folder on GitHubat commit 9fa87d8

Compare with similar skills

Causal Inference next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Causal Inference compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Causal Inference this skillbrycewang-stanford/Auto-Empirical-Research-Skills4.6k—~2kAutomated safety check: PassMIT
Example Datasetspymc-labs/CausalPy1.2k—~587Automated safety check: PassApache-2.0
PymcK-Dense-AI/scientific-agent-skills48k1 repos~2.7kAutomated safety check: NotesApache-2.0
Stata Data Cleaningmeleantonio/awesome-econ-ai-stuff6462 repos~1.8kAutomated safety check: PassCustom licence
Ectheory Data Analysisfranklee16/academic-research-skills2231 repos~905Automated safety check: PassNone
Jape Identification Strategyfranklee16/academic-research-skills2231 repos~707Automated safety check: PassNone

Similar skills

  • Example Datasets

    pymc-labs/CausalPy

    Load built-in CausalPy example datasets for demos, tutorials, tests, and quick causal-analysis prototypes.

    1.2k GitHub stars~587 tokensUpdated today
    Research & ScienceAuto-check passed
  • Pymc

    K-Dense-AI/scientific-agent-skills

    Builds and checks Bayesian models with PyMC, including hierarchical models, NUTS MCMC, variational inference, mutable-data predictions, posterior predictive checks, diagnostics, and PSIS-LOO model…

    48k GitHub starsUsed in 1 repo~2.7k tokens
    Research & ScienceAuto-check: notes
  • Stata Data Cleaning

    meleantonio/awesome-econ-ai-stuff

    Clean and transform messy data in Stata with reproducible workflows

    646 GitHub starsUsed in 2 repos~1.8k tokens
    Research & ScienceAuto-check passed
  • Ectheory Data Analysis

    franklee16/academic-research-skills

    A skill your agent uses for the Monte Carlo and numerical-illustration component of an Econometric Theory (ET) paper — designing simulations that show finite-sample behavior tracks the asymptotics…

    223 GitHub starsUsed in 1 repo~905 tokens
    Research & ScienceAuto-check passed
  • Jape Identification Strategy

    franklee16/academic-research-skills

    A skill your agent uses when designing or defending the empirical identification of a Journal of Applied Econometrics (JAE) manuscript — a credible strategy applied to real data, with assumptions…

    223 GitHub starsUsed in 1 repo~707 tokens
    Research & ScienceAuto-check passed
  • Jbes Literature Positioning

    franklee16/academic-research-skills

    A skill your agent uses when positioning a Journal of Business & Economic Statistics (JBES) methods paper against prior econometric and statistical methods.

    223 GitHub starsUsed in 1 repo~924 tokens
    Research & ScienceAuto-check passed

More from brycewang-stanford/Auto-Empirical-Research-Skills

All 383 skills in this repo
  • Aer Consistency

    brycewang-stanford/Auto-Empirical-Research-Skills

    A skill your agent uses when auditing a finished or near-finished AER, AER:Insights, or AEJ manuscript for internal consistency: headline numbers across abstract, introduction, results, and tables…

    4.6k GitHub starsUsed in 1 repo~2.6k tokens
    Auto-check passed
  • Latex Paper En

    brycewang-stanford/Auto-Empirical-Research-Skills

    English LaTeX academic paper assistant for existing .tex projects.

    4.6k GitHub starsUsed in 1 repo~2.2k tokens
    Auto-check passed
  • Bayesian Workflow

    brycewang-stanford/Auto-Empirical-Research-Skills

    Opinionated Bayesian modeling workflow with PyMC and ArviZ. An agent skill from brycewang-stanford/Auto-Empirical-Research-Skills.

    4.6k GitHub stars~3.5k tokensUpdated 5 days ago
    Auto-check passed
  • Daily Paper Generator

    brycewang-stanford/Auto-Empirical-Research-Skills

    A skill your agent uses when the user asks to "generate daily paper", "search arXiv for EEG papers", "find EEG decoding papers", "review brain-computer interface papers", or wants to create paper…

    4.6k GitHub stars~2.2k tokensUpdated 5 days ago
    Auto-check passed
  • Five Questions

    brycewang-stanford/Auto-Empirical-Research-Skills

    Deeply analyze any empirical economics PDF using the five-question framework (五问框架): research question, identification strategy, core estimand, robustness logic, and scholarly contribution.

    4.6k GitHub stars~1.7k tokensUpdated 5 days ago
    Auto-check: notes
  • Kaggle Research

    brycewang-stanford/Auto-Empirical-Research-Skills

    A skill your agent uses when a research task needs reproducible Kaggle discovery, metadata inspection, bounded public-data downloads, competition or kernel discovery, model discovery, or an…

    4.6k GitHub stars~868 tokensUpdated 5 days ago
    Auto-check passed

Works with

Questions about Causal Inference

What does Causal Inference do?

Production-grade Bayesian causal inference with PyMC, CausalPy, and DoWhy. Causal Inference is an agent skill from brycewang-stanford/Auto-Empirical-Research-Skills. Production-grade Bayesian causal inference with PyMC, CausalPy, and DoWhy.

When should I use Causal Inference?

Causal Inference fits situations like: : causal inference; causal effect estimation; treatment effects; counterfactuals.

How do I install Causal Inference in Claude Code?

Run `npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill causal-inference -a claude-code`. Or copy the skill folder (skills/23-Learning-Bayesian-Statistics-baygent-skills/causal-inference in brycewang-stanford/Auto-Empirical-Research-Skills) into .claude/skills/causal-inference in your project. Claude Code loads it when a task matches its description.

How do I install Causal Inference in Codex?

Run `npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill causal-inference -a codex`. Or copy the skill folder (skills/23-Learning-Bayesian-Statistics-baygent-skills/causal-inference in brycewang-stanford/Auto-Empirical-Research-Skills) into .agents/skills/causal-inference in your project. Codex loads it when a task matches its description.

Can I use Causal Inference in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill causal-inference -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/causal-inference, .gemini/skills/causal-inference, .github/skills/causal-inference and .opencode/skills/causal-inference in your project.

What does Causal Inference need to run?

Going by SKILL.md and its folder, Causal Inference needs the command-line tools its instructions call (git).

Does Causal Inference access the network?

SKILL.md names 1 domain. In commands or code: github.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Causal Inference safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Causal Inference use?

Causal Inference is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Causal Inference use?

About 2k tokens (SKILL.md is roughly 8.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 17k tokens, read only when the agent opens those files.

What are the alternatives to Causal Inference?

Skills that share tags, products or a category with Causal Inference: Example Datasets (pymc-labs/CausalPy, 1.2k stars), Pymc (K-Dense-AI/scientific-agent-skills, 48k stars), Stata Data Cleaning (meleantonio/awesome-econ-ai-stuff, 646 stars) and Ectheory Data Analysis (franklee16/academic-research-skills, 223 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Causal Inference?

brycewang-stanford (a GitHub user) maintains it in brycewang-stanford/Auto-Empirical-Research-Skills, which has 4,556 GitHub stars. The repository holds 383 skills in this directory. The repository was last updated on October 5, 2026.

Source: brycewang-stanford/Auto-Empirical-Research-Skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.