StatsPAI_skill — Claude Code skill: causal inference in Python
Wires the statspai Python package into a session: descriptives, estimator choice, treatment-effect estimation and post-estimation checks.
no license ★ 240 updated 2026-09-18
npx skills add franklee16/academic-research-skills --skill statspai_skill -a claude-codeWhat StatsPAI_skill does
The skill gives a Claude agent a single entry point to statspai: one import statspai as sp, 900+ functions behind a shared API. Work starts at descriptives and balance tables (sp.sumstats, sp.balance_table), passes through the research-question DSL sp.causal_question and ends at estimation via sp.causal or a named estimator. Classical methods cover OLS, IV, DID including staggered adoption, RDD, PSM and SCM; the ML side has DML, Causal Forest, Meta-Learners and TMLE.
Function discovery is built in. sp.list_functions(), sp.describe_function("did") and sp.function_schema("rdrobust") return schemas the model can read without opening docs. Estimators hand back a result object with .summary(), .plot(), .to_latex(), .to_word(), .to_excel(), .cite() plus a diagnostics dict that agent logic can branch on. Separate steps handle DAG proposals (sp.llm_dag_propose, sp.llm_dag_validate), text as treatment (sp.causal_text) and post-estimation checks (sp.diagnose, sp.spec_curve, sp.honest_did).
Cleaning stays out of scope. Missing values, type coercion and merges belong in pandas before the first sp.* call. Skip that and an estimator either raises or drops rows silently, which is your bug rather than the skill's. Draft writing through sp.paper() is excluded too; the flow stops at diagnostics and hands the result back.
What it helps with
- Estimate a training effect on wages with panel DID
- Pick between DID, RDD and IV for a stated estimand
- Build a covariate balance table before estimation
- Stress-test a fitted model with a specification curve and HonestDiD
- Locate the right package function from its schema
Example prompts for the agent
- Run a DID estimate of the training effect on wages, panel keyed on
worker_idandyear - Use
sp.causal_questionto decide between DID, RDD and IV on this data - Propose a DAG with
sp.llm_dag_propose, then runsp.diagnoseon the model
How to install StatsPAI_skill
1Skills CLI (Vercel)
npx skills add franklee16/academic-research-skills --skill statspai_skill -a claude-code2Manually: put the files in place
~/.claude/skills/StatsPAI_skill/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/StatsPAI_skill/
1Skills CLI (Vercel)
npx skills add franklee16/academic-research-skills --skill statspai_skill -a codex2Manually: put the files in place
.agents/skills/StatsPAI_skill/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add franklee16/academic-research-skills --skill statspai_skill -a cursor2Manually: put the files in place
.cursor/skills/StatsPAI_skill/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install franklee16/academic-research-skills data-analysis/StatsPAI_skill/SKILL.md2Manually: put the files in place
.github/skills/StatsPAI_skill/SKILL.md1Skills CLI (Vercel)
npx skills add franklee16/academic-research-skills --skill statspai_skill -a gemini-cli2Platform CLI
gemini skills install https://github.com/franklee16/academic-research-skills --path data-analysis/StatsPAI_skillManually: put the files in place
.devin/skills/StatsPAI_skill/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about StatsPAI_skill
How do I install StatsPAI_skill in Claude Code?
Run npx skills add franklee16/academic-research-skills --skill StatsPAI_skill -a claude-code. The skill file lands at ~/.claude/skills/StatsPAI_skill/SKILL.md.
What does StatsPAI_skill do?
It walks an agent through an empirical analysis in Python: descriptives, choosing an estimator for a declared estimand, estimating a treatment effect and running post-estimation checks. All from the single statspai import.
Does the skill handle data cleaning?
No. Missing values, type coercion and joins stay in pandas, because sp.* expects an analysis-ready DataFrame. On messy input an estimator will raise or drop rows without telling you.