Install
$ agentstack add skill-jskherman-engg-skills-process-causal-inference-dags ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Process Causal Inference (DAG-Based Adjustment)
Overview
For observational process data, the right adjustment set determines whether a regression coefficient is a confounded estimate, a partial mediated estimate, or the total effect. This skill provides DAG tooling:
- Build a DAG from an edge list (YAML or CLI).
- Test d-separation between sets given conditioning.
- Enumerate parents of the treatment as a candidate back-door adjustment
set; verify the criterion.
- Export DOT source for the user to render with Graphviz.
The implementation is pure-Python (no NetworkX dependency). For larger problems, swap in networkx/pgmpy.
Scope is deliberately narrow per design review:
- It DOES NOT estimate causal effects. Pair it with
engineering-statistics,
censored-regression, distributed-lag-models, or bayesian-hierarchical-process-models for that.
- It DOES NOT do front-door or instrument-variable analysis. Extend as
needed.
Prerequisites
uvavailable.- On first use, the script writes
LICENSE_NOTIFICATION.txt.
When to Use
- Designing an observational study and you need a defensible adjustment
set.
- Resolving confounding-vs-mediation disagreements in plant data.
- Drawing a DAG for an internal report or for HAZOP-style review of an
empirical claim.
Don't use for
- Estimating effect sizes (see other skills).
- Bayesian network learning from data (use
pgmpy). - Counterfactual analysis (no potential-outcomes implementation here).
Utility Scripts
uv run scripts/dag.py check --edges "A,B;A,C;B,D;C,D" --treatment B --outcome D --output /tmp/check.jsonuv run scripts/dag.py dsep --edges "A,B;A,C;B,D;C,D" --x B --y C --z A --output /tmp/dsep.jsonuv run scripts/dag.py dot --edges "A,B;A,C;B,D;C,D" --output /tmp/g.dot
Procedure
- List variables (predictors, candidate confounders, mediators, colliders,
regime indicators, lab outcomes).
- Classify each variable (confounder vs mediator vs collider vs regime).
- Draw the DAG (one edge per causal direction; no cycles).
- Identify the treatment and the outcome.
- Get the parent set of the treatment; verify it satisfies the back-door
criterion via check.
- Use d-separation tests for alternative paths.
- Export DOT and render externally for review.
Pitfalls
- Adjusting for mediators when estimating a total effect; this introduces
bias.
- Adjusting for colliders (variables caused by both treatment and outcome);
this opens a spurious path.
- Drawing an unsigned graph and assuming the direction is obvious;
always be explicit.
- Equating "correlation with the outcome" with "is a confounder"; a
mediator is correlated too but should not be adjusted for total effect.
- Forgetting the regime / selection indicator; if operators routinely
intervene in response to the outcome, that intervention may be a collider conditional on the response.
- Reporting "no confounding" because a regression coefficient barely moves
with adjustment. The right test is graphical, not numerical.
- Treating descendants of the treatment as legitimate adjustment variables.
Fallback Strategies
- If the DAG has many nodes (> ~30), switch to
networkx+pgmpyfor
efficient enumeration of separation sets.
Verification
- Run the listed script with representative inputs and an
--outputfile when a deterministic calculation is available. - Confirm the JSON result contains
ok: true, expected units, and no unhandled warnings. - Check result magnitudes against the stated assumptions, references, and a hand calculation or known operating range before reporting them.
References
references/dag_glossary.md— confounders, mediators, colliders,
back-door criterion.
- Pearl, Causality (2nd ed).
- Hernán & Robins, Causal Inference: What If.
Anti-Patterns
- Drawing a DAG only after seeing the regression results.
- Adjusting "for everything"; that controls for mediators and colliders.
- Claiming causal effect from a coefficient without naming the DAG used.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: jskherman
- Source: jskherman/engg-skills
- License: Apache-2.0
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.