$npx -y skills add Learning-Bayesian-Statistics/baygent-skills --skill causal-inferenceProduction-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 es
| 1 | # Causal Inference |
| 2 | |
| 3 | ## Dependencies |
| 4 | |
| 5 | This skill requires the **bayesian-workflow** skill for all PyMC modeling steps (priors, sampling, |
| 6 | diagnostics, calibration, reporting). |
| 7 | |
| 8 | Detect it: |
| 9 | |
| 10 | ```bash |
| 11 | ls ~/.claude/skills/bayesian-workflow/SKILL.md 2>/dev/null || ls .claude/skills/bayesian-workflow/SKILL.md 2>/dev/null |
| 12 | ``` |
| 13 | |
| 14 | If not found, install it: |
| 15 | |
| 16 | ```bash |
| 17 | git clone https://github.com/Learning-Bayesian-Statistics/baygent-skills.git /tmp/baygent-skills |
| 18 | cp -r /tmp/baygent-skills/bayesian-workflow ~/.claude/skills/ |
| 19 | ``` |
| 20 | |
| 21 | For all PyMC modeling steps (priors, sampling, diagnostics, calibration, reporting), follow the |
| 22 | bayesian-workflow skill. |
| 23 | |
| 24 | ## Workflow overview |
| 25 | |
| 26 | Every causal analysis follows this sequence. Steps 1-4 are the thinking phase (no code). Steps 5-8 |
| 27 | are the doing phase. Think before you do. |
| 28 | |
| 29 | 1. **Formulate the causal question** — Propose precise estimand (ATE, ATT, LATE, etc.). ⚠️ ASK USER TO CONFIRM. |
| 30 | 2. **Draw the DAG** — Propose causal graph with nodes, edges, and explicit non-edges. ⚠️ ASK USER TO CONFIRM. See [references/dags-and-identification.md](references/dags-and-identification.md) |
| 31 | 3. **Identify** — Determine identification strategy (backdoor, front-door, IV, RDD, DiD). ⚠️ ASK USER TO CONFIRM untestable assumptions. See [references/dags-and-identification.md](references/dags-and-identification.md) |
| 32 | 4. **Choose design** — Match problem to method using table below. ⚠️ ASK USER TO CONFIRM. See [references/quasi-experiments.md](references/quasi-experiments.md) or [references/structural-models.md](references/structural-models.md) |
| 33 | 5. **Estimate** — Build and fit the model. Delegate all PyMC mechanics to bayesian-workflow skill. |
| 34 | 6. **Refute** — MANDATORY. Run design-specific robustness checks. See [references/refutation.md](references/refutation.md) |
| 35 | 7. **Interpret** — Effect size + decision-relevant HDIs + probability of direction. |
| 36 | 8. **Report** — Generate `<treatment>-on-<outcome>/report.md` using the canonical template in [references/reporting.md](references/reporting.md). Run `scripts/check_refutation.py` to turn refutation outcomes into pass/marginal/fail ratings, calibrated causal language (causal / suggestive / associational / descriptive), and an ordered next-steps list. Use that output to fill the report's section 7 (causal language calibration) and Suggested Next Steps. |
| 37 | |
| 38 | ## Design selection guide |
| 39 | |
| 40 | Before reading the table, walk the **intake** — it routes you to a design *and* surfaces the assumptions you'll have to defend later: |
| 41 | |
| 42 | 1. **Restate the estimand.** ATE, ATT, LATE, or a CATE? On whom, over what period? If you can't write the one-sentence estimand, you don't have a causal question yet — you have a dataset. |
| 43 | 2. **Identify the data shape.** Single time series, wide panel of units, long unit–time panel, cross-section, or pre/post group data? |
| 44 | 3. **Identify the treatment assignment.** Known intervention time, staggered adoption, a threshold/cutoff, a kink, an instrument, or observed treatment with confounders? |
| 45 | 4. **State the identifying story.** What makes the comparison causal — parallel trends, no anticipation, no manipulation at the cutoff, a valid instrument, overlap/positivity, donor support? This is exactly what you'll refute later. |
| 46 | 5. **Recommend one primary design + alternatives — and reconcile with the estimand.** Name the best-fit design from the table plus any plausible cross-check. Then check that the estimand from step 1 is the one the design *actually identifies*: DiD → ATT (on the treated); RDD → a *local* effect at the cutoff; IV → LATE for compliers (under monotonicity); SC → the treated-unit effect. If they differ, change the design or re-scope the estimand and say so. If two designs agree later, that's convergent evidence rather than reliance on a single identification. |
| 47 | |
| 48 | | Design | Use when | Key assumption | Tool | |
| 49 | |---|---|---|---| |
| 50 | | DiD | Treatment at known time, control group available | Parallel trends | CausalPy | |
| 51 | | Staggered DiD | Treatment rolls out at different times | Parallel trends per cohort | CausalPy | |
| 52 | | Synthetic Cont |