leonardodalinky/scider/causal-inference
Claude Code and agent skill by leonardodalinky/scider
- community
Checking that the SKILL.md file is still in the repository.
Causal inference methods — DAG-based causal thinking, distinguishing observational from experimental data, IV, DiD, RDD, propensity score matching, and sensitivity analysis. Use when making causal claims from data.
Install
npx vskill@latest install leonardodalinky/scider/causal-inferenceSKILL.md
Causal Inference
Overview
Causal inference provides methods for estimating causal effects rather than merely correlational associations. Use this skill whenever you need to claim that X causes Y, not just that X and Y are correlated.
When to Use This Skill
- When your research question is causal ("Does X increase Y?")
- When you have observational data and want to make causal claims
- When designing a study and choosing between experimental and observational approaches
- When a reviewer asks about confounding, endogeneity, or causal identification
When NOT to Use This Skill
- When your goal is purely predictive (correlations are sufficient for prediction)
- When you have a true RCT with perfect compliance (standard t-test is enough)
Hard Rules
- Never use causal language (causes, increases, reduces) without causal identification — observational correlation alone is insufficient
- Draw the DAG before choosing a method — the causal graph determines what you can and cannot control for
- Conditioning on a collider opens a backdoor path — it can create spurious associations
- Always run a placebo test — if your method claims an effect where no effect should exist, the method is flawed
1. Causal DAGs (Directed Acyclic Graphs)
Drawing the causal graph is the first step before any analysis.
Node types:
- Treatment (T): the variable you want to study
- Outcome (Y): the variable you want to affect
- Confounder (C): common cause of T and Y — must control for
- Mediator (M): on the causal path T → M → Y — do NOT control for if you want total effect
- Collider (K): caused by both T and Y (or their descendants) — do NOT condition on
Backdoor criterion: A set of variables Z satisfies the backdoor criterion if:
- Z blocks all backdoor paths from T to Y
- Z does not contain any descendant of T
If you can find such Z, controlling for Z gives you the causal effect.
2. Experimental Design (Gold Standard)
Randomized Controlled Trial (RCT):
- Randomly assign treatment → eliminates all confounding by design
- Check balance at baseline: run t-tests on pre-treatment covariates
Encouragement design: Randomize access/encouragement (instrument), not actual treatment → use IV to estimate LATE.
3. Instrumental Variables (IV)
When to use: Treatment is endogenous (correlated with unobservables), but you have a valid instrument.
Validity conditions for instrument Z:
- Relevance: Z is correlated with T (test: first-stage F-statistic > 10)
- Exclusion restriction: Z affects Y ONLY through T (must be argued theoretically)
- Independence: Z is as-good-as-random (no confounders of Z-Y)
4. Difference-in-Differences (DiD)
When to use: Panel data with treatment affecting some units at some point in time.
Key assumption (parallel trends): In the absence of treatment, treated and control groups would have followed parallel trends. Test by checking pre-treatment trends.
Two-way fixed effects (multiple periods):
5. Regression Discontinuity Design (RDD)
When to use: Treatment is assigned based on crossing a threshold of a continuous "running variable".
6. Propensity Score Matching (PSM)
When to use: Observational data where selection into treatment depends on observed covariates.
For robust matching, use causalml or dowhy:
7. Sensitivity Analysis
After estimating a causal effect, test its robustness:
Placebo tests:
- Replace treatment with random assignment → estimate should be ~0
- Apply treatment to pre-treatment period → estimate should be ~0
- Apply to a group that shouldn't be affected → estimate should be ~0
Rosenbaum bounds: How strong would unmeasured confounding need to be to explain away the effect?
E-value: Minimum strength of association an unmeasured confounder would need with both treatment and outcome to fully explain the observed association.
Libraries Quick Reference
| Library | Best for | |
|---|---|---|
dowhy | End-to-end causal analysis with refutation tests | |
econml | Heterogeneous treatment effects (CATE), double ML | |
causalml | Uplift modeling, propensity-based methods | |
linearmodels | IV (2SLS, LIML), panel data (FE, RE, GMM) | |
statsmodels | DiD, OLS with robust SEs, basic regression |
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.scider/skills/causal-inference/SKILL.md
Popularity
- Repository stars
- 88
- Repository forks
- 7
- 7-day trend score
- 22
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/leonardodalinky/scider/causal-inference)