causal-dag-builder

causal-dag-builder is a skill for Claude Code from clamp-sh/analytics-skills. It costs 172 tokens per session (3,688 once invoked), scanned A, original, MIT.

A method for drawing a causal diagram before answering whether one thing caused another in observational data. The diagram names possible causes, intermediate steps, and misleading variables before deciding what to compare.

In plain words
What is it for?
Use it for questions like whether a product change caused a business result when no randomized experiment was run. It helps choose which variables to account for and produces a Mermaid diagram.
Why use it?
It reduces mistakes such as treating correlation as causation or adjusting for every available variable. It shows which assumptions and variables matter for a causal conclusion.

Skill for Claude Code

Written for Claude Code: when-to-use in frontmatter.

Part of the analytics-skills plugin — 13 skills shipped together

Good fit Use it for questions like whether a product change caused a business result when no randomized experiment was run. It helps choose which variables to account for and produces a Mermaid diagram.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/clamp-sh/analytics-skills/causal-dag-builder
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add clamp-sh/analytics-skills --skill causal-dag-builder
Clone the repo
git clone --depth 1 https://github.com/clamp-sh/analytics-skills

Made for: Claude Code.

Or install analytics-skills, the plugin that ships this one along with the rest of its 13 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for causal-dag-builder

README.md
[![agentmods](https://agentmods.dev/badge/skills/clamp-sh/analytics-skills/causal-dag-builder/github.svg)](https://agentmods.dev/skills/clamp-sh/analytics-skills/causal-dag-builder)
Your own site
<a href="https://agentmods.dev/skills/clamp-sh/analytics-skills/causal-dag-builder"><img src="https://agentmods.dev/badge/skills/clamp-sh/analytics-skills/causal-dag-builder/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for causal-dag-builder

Your own site · 80×15
<a href="https://agentmods.dev/skills/clamp-sh/analytics-skills/causal-dag-builder"><img src="https://agentmods.dev/badge/skills/clamp-sh/analytics-skills/causal-dag-builder.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 172 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,688 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00172 $0.03688
Opus 5 $0.00086 $0.01844
Sonnet 5 $0.00034 $0.00738
Haiku 4.5 $0.00017 $0.00369

Measured 10d ago against content hash 275239c32a51, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

causal-dag-builder scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/causal-dag-builder/SKILL.md · 253 lines

How it starts

The opening of the file, as written. The whole thing — 253 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Causal DAG builder

Observational analytics tempts everyone into two mistakes: assuming correlation is cause, and "controlling for everything" to launder it. Both mistakes go away when the assumed causal structure is written down first. A DAG forces the assumptions onto paper, where they can be argued with. This skill emits one, refines it as evidence arrives, and uses the back-door criterion to pick the adjustment set — instead of throwing every available variable into a regression.

When NOT to use this

  • The comparison is a properly-randomised A/B test with clean exposure events. Randomisation handles confounding by construction; the DAG adds nothing. Use experiment-result-reader instead.
  • The user is asking a descriptive question ("how many users converted last week?"), not a causal one. Descriptive answers don't need causal structure.
  • The DAG would have a single arrow (X → Y, no other variables in the system). That's not a DAG, that's an assertion. Either there genuinely are no other variables (rare) or the modeller hasn't thought hard enough yet.
  • The dataset is so thin that no adjustment set has support. A DAG can tell you which variables to condition on; it cannot conjure rows that aren't there.

What a DAG is, in 100 words

A causal DAG is a directed acyclic graph where nodes are variables and arrows mean "directly causes" (in the modeller's belief, not in the data). Acyclic = no variable causes itself through a loop. The DAG encodes assumptions, not facts; it is the modeller's hypothesis about the data-generating process, drawn so others can attack it. The point is not the picture. The point is that once the structure is explicit, the back-door criterion mechanically tells you which variables to condition on to estimate a causal effect — and, just as important, which variables you must not condition on.

The three structural patterns

Every triple of nodes in a DAG is one of three shapes. Conditioning rules differ for each.

Read the full file on GitHub · 253 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 253 lines · 172 tokens per session scan A 275239c32a51

Subscribe to this mod's changes

causal-dag-builder is a skill published in the GitHub repository clamp-sh/analytics-skills (8 stars, last pushed 3mo ago), licensed MIT. It adds 172 tokens to every session and 3,688 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

imaging-data-commons

Query and download public cancer imaging data from NCI Imaging Data Commons. Invoke for any question about IDC collections, cancer imaging datasets, DICOM data access, radiology (CT, MR, PET) or pathology AI training sets, metadata queries, visualization, or license checks — even when the user doesn't explicitly…

K-Dense-AI/scientific-agent-skills · 75 tokens

pkpd-modeling

Pharmacokinetic and pharmacodynamic modelling and simulation - non-compartmental analysis, compartmental and population PK, PK/PD and exposure-response, TMDD, PBPK orientation, bioequivalence, allometric scaling and first-in-human dose, drug interaction prediction, and Bayesian therapeutic drug monitoring. Use when…

K-Dense-AI/scientific-agent-skills · 273 tokens

statistical-analysis

Guided statistical analysis for research data - test selection, assumption checking, effect sizes, power analysis, Bayesian alternatives, and APA-formatted reporting. Use whenever a user wants to compare groups, test a hypothesis, analyze experimental or survey data, check statistical assumptions, compute required…

K-Dense-AI/scientific-agent-skills · 111 tokens

biopython

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use…

K-Dense-AI/scientific-agent-skills · 76 tokens

diffdock

DiffDock and DiffDock-L molecular docking. Use for protein-small-molecule pose prediction from PDB or sequence plus SMILES/SDF/MOL2, batch docking, virtual screening, and pose-confidence interpretation. Not for binding affinity prediction.

K-Dense-AI/scientific-agent-skills · 51 tokens

hypothesis-generation

Formulate evidence-bounded scientific questions, candidate hypotheses, rival explanations, causal or associational claims, discriminating predictions, measurements, and preregistration-ready analysis plans. Use when turning observations or preliminary findings into transparent, testable research plans without treating…

K-Dense-AI/scientific-agent-skills · 58 tokens