analytics-diagnostic-m…
The spine of analytics investigation. Use whenever interpreting analytics numbers, answering "why did X change", reading funnels, comparing cohorts, or…
Build a refinable causal DAG before answering "did X cause Y" on observational data. Emits a Mermaid diagram of assumed causes, applies the back-door criterion to decide what to condition on, and forces confounders, mediators, and colliders to be named explicitly instead of
$ npx -y skills add clamp-sh/analytics-skills --skill causal-dag-builder --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/causal-dag-builderContext preview
The summary Claude sees to decide when to auto-load this skill.
Build a refinable causal DAG before answering "did X cause Y" on observational data. Emits a Mermaid diagram of assumed causes, applies the back-door criterion to decide what to condition on, and forces confounders, mediators, and colliders to be named explicitly instead of
name: causal-dag-builder description: Build a refinable causal DAG before answering "did X cause Y" on observational data. Emits a Mermaid diagram of assumed causes, applies the back-door criterion to decide what to condition on, and forces confounders, mediators, and colliders to be named explicitly instead of "controlling for everything". The DAG is an artifact downstream skills read to pick the right adjustment set. Use whenever interpreting cohort comparisons, funnel drop-offs, or any analytics result where the user is reasoning causally without an experiment. Pairs with analytics-diagnostic-method as the causal-structure layer underneath the diagnostic tree. Triggers when Clamp MCP cohorts_compare or funnels_create is called with no experimental holdback, when a Clamp MCP result prompts a causal claim from observational data, or when via Clamp the user asks "why did this segment convert higher". when_to_use: When the user makes a causal claim from observational data — "users who do X convert higher", "feature A drove the lift", "this channel is better" — and there is no random assignment behind the comparison. Also when a cohort comparison, funnel, or retention curve is about to be interpreted and the causal structure has not been laid out yet.
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.
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.
Every triple of nodes in a DAG is one of three shapes. Conditioning rules differ for each.
| Pattern | Shape | Role of middle node | Condition on it? | |---|---|---|---| | Chain | X → M → Y | Mediator | **No** (over-adjustment: blocks the effect you're trying to measure) | | Fork | X ← C → Y | Confounder | **Yes** (blocks a back-door path that would otherwise bias the estimate) | | Collider | X → C ← Y | Collider | **No** (opens a spurious path that wasn't there) |
The asymmetry is the whole game. "Control for everything available" is wrong because it silently conditions on mediators and colliders. The DAG is the bookkeeping that prevents that.
To estimate the causal effect of X on Y from observational data, find a set of variables Z such that:
1. Z **blocks every back-door path** from X to Y. A back-door path is any path from X to Y that starts with an arrow pointing **into** X (i.e. goes through a common cause of X and Y). 2. Z **contains no descendants of X**. (Conditioning on a descendant of X often opens a collider path or blocks a mediator.) 3. Z does **not open any collider path** that was previously blocked.
If such a Z exists, conditioning on Z is sufficient to recover the causal effect. If no such Z exists from observed variables, the effect is **not identifiable** from this data — and no amount of regression will fix that. Saying so is a real answer.
Before drawing anything, state the question in the form **"does X cause Y, and by how much?"** with X and Y written as observable variables. If the user said "users who visit /pricing convert higher", X = visited_pricing_page (binary), Y = converted (binary). If the user said "feature A drove the lift", X = used_feature_A, Y = the conversion metric they care about.
If X and Y can't be written down concretely, the question isn't ready for a DAG. Push back and ask the user to nail the variables before the structure.
Brainstorm the variables the modeller believes might matter. For each, label which of these it is:
The same variable can appear in multiple buckets; that's where structure comes from. Don't censor at this stage; capture the modeller's beliefs, even ones that contradict each other. The DAG arbitrates next.
Emit the DAG as Mermaid so it lives in the chat as a refinable artifact. Concrete syntax:
graph LR intent[user_intent_to_
Analytics skills for Claude, Cursor, and other AI agents. Read web analytics like a senior analyst: diagnose traffic changes, judge channel quality, read funnels, declare typed events, and read A/B tests without the usual rookie mistakes.
Repo: clamp-sh/analytics-skills
The spine of analytics investigation. Use whenever interpreting analytics numbers, answering "why did X change", reading funnels, comparing cohorts, or…
One-time interview that captures the business context (industry, model, primary conversion, traffic range, ICP, data stack) into a local analytics-profile.md…
Formal time-series methods that augment the hand-coded fingerprint library in traffic-change-diagnosis. Use this skill when traffic-change-diagnosis…
Bayesian counterpart to experiment-result-reader. Computes posterior P(variant beats control), credible intervals, and expected loss from per-variant exposure…
Bradford Hill's 9 viewpoints (1965) reframed as a checklist for product analytics. Use this skill before recommending a decision based on observational…
Pearl's three-rung causal hierarchy as a query classifier. Tags every analytics question as rung-1 (association, P(Y|X)), rung-2 (intervention, P(Y|do(X))), or…