exp-lens-causal-assumptions
Skill1 starsChanged 8 months agoMITView on GitHub
Create Causal Assumptions experimental design diagram showing confounders, mediators, colliders, and identification strategy. Causal-structural lens answering "What causal assumptions support this design?
In this repository59 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- arch-lens-c4-containerSkill
- arch-lens-concurrencySkill
- arch-lens-data-lineageSkill
- arch-lens-deploymentSkill
- arch-lens-developmentSkill
- arch-lens-error-resilienceSkill
- arch-lens-module-dependencySkill
- arch-lens-operationalSkill
- arch-lens-process-flowSkill
- arch-lens-repository-accessSkill
- arch-lens-scenariosSkill
- arch-lens-securitySkill
- arch-lens-state-lifecycleSkill
- audit-archSkill
- audit-bugsSkill
- audit-cohesionSkill
- audit-defense-standardsSkill
- audit-frictionSkill
- audit-implSkill
- audit-testsSkill
- design-guardsSkill
- dry-walkthroughSkill
- elaborate-phaseSkill
- exp-lens-benchmark-representativenessSkill
- exp-lens-comparator-constructionSkill
- exp-lens-error-budgetSkill
- exp-lens-estimand-claritySkill
- exp-lens-exploratory-confirmatorySkill
- exp-lens-fair-comparisonSkill
- exp-lens-governance-riskSkill
- exp-lens-iterative-learningSkill
- exp-lens-measurement-validitySkill
- exp-lens-pipeline-integritySkill
- exp-lens-randomization-blockingSkill
- exp-lens-reproducibility-artifactsSkill
- exp-lens-sensitivity-robustnessSkill
- exp-lens-severity-testingSkill
- exp-lens-unit-interferenceSkill
- exp-lens-validity-threatsSkill
- exp-lens-variance-stabilitySkill
- id-slopSkill
- implement-worktreeSkill
- investigateSkill
- make-arch-diagSkill
- make-experiment-diagSkill
- make-groupsSkill
- make-planSkill
- make-reqSkill
- make-scenariosSkill
- mermaidSkill
- plan-arcSkill
- rectifySkill
- review-approachSkill
- update-architectureSkill
- update-reqsSkill
- update-specsSkill
- verify-diagSkill
- verify-proposed-diagSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 10 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 30
Do not litter the codebase with useless comments, TODO markers, or explanatory annotations — the skill output and diagram speak for …
- Distinctive: line 36
Document the identification strategy with testable assumptions
- Very specific: line 37
BEFORE creating any diagram, LOAD the /mermaid skill using the Skill tool - this is MANDATORY
- Distinctive: line 49
Look for: treatment, control, outcome, response, endpoint, metric
- Distinctive: line 53
Look for: shared, common, config, environment, seed, global
- Distinctive: line 57
Look for: transform, preprocess, feature, intermediate, pipeline
- Distinctive: line 61
Look for: filter, subset, exclude, condition, threshold, select
- Distinctive: line 65
Look for: random, assign, allocate, split, stratify, block
- Distinctive: line 79
Document each assumption as either testable or untestable, and record the evidence (or lack of evidence) from the codebase.
- Very specific: line 107
Write the diagram to: temp/exp-lens-causal-assumptions/exp_diag_causal_assumptions_{YYYY-MM-DD_HHMMSS}.md
- Distinctive: line 148
TREAT["Treatment<br/>━━━━━━━━━━<br/>Assignment mechanism<br/>Randomized?"] INSTR["Instrument<br/>━━━━━━━━━━<br/>Exclusion restriction"] end
- Distinctive: line 210
Before creating the diagram, verify:
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Causal Assumptions Experimental Design Lens
Philosophical Mode: Causal-Structural Primary Question: "What causal assumptions support this design?" Focus: Confounders, Mediators, Colliders, Adjustment Sets, Identification Strategy
When to Use
- Experiment claims causal effects
- Pipeline has shared components that might confound
- Need to verify identification strategy
- User invokes
/exp-lens-causal-assumptionsor/make-experiment-diag causal
Critical Constraints
NEVER:
- Modify any source code files
- Do not litter the codebase with useless comments, TODO markers, or explanatory annotations — the skill output and diagram speak for themselves
ALWAYS:
- Classify every variable as Treatment, Outcome, Confounder, Mediator, Collider, Instrument, or Selection variable
- Map every directed edge to a concrete code-level data flow
- Flag all unblocked backdoor paths explicitly
- Document the identification strategy with testable assumptions
- BEFORE creating any diagram, LOAD the
/mermaidskill using the Skill tool - this is MANDATORY
Analysis Workflow
Step 1: Launch Parallel Exploration Subagents
Spawn Explore subagents to investigate:
Treatment & Outcome Definition
- Find experiment config, treatment assignment code, outcome measurement
- Look for: treatment, control, outcome, response, endpoint, metric
Confounding Pathways
- Find shared data sources, preprocessing, environment variables
- Look for: shared, common, config, environment, seed, global
Mediator & Mechanism Variables
- Find intermediate processing steps between treatment and outcome
- Look for: transform, preprocess, feature, intermediate, pipeline
Collider & Selection Variables
- Find filtering, subsetting, or conditional logic applied post-treatment
- Look for: filter, subset, exclude, condition, threshold, select
Randomization & Assignment
- Find how experimental units are assigned to conditions
- Look for: random, assign, allocate, split, stratify, block
Step 2: Build the Causal Graph Structure
For each variable identified, classify as: Treatment, Outcome, Confounder, Mediator, Collider, Instrument, or Selection variable. Map directed edges based on code-level data flow. Flag any unblocked backdoor paths.
Step 3: Identify Causal Assumptions
CRITICAL — Analyze Claim Direction: For every edge in the causal graph, determine:
- Does code implement a causal mechanism (A produces B) or merely a statistical association?
- Is the direction grounded in temporal ordering or domain knowledge?
- Are there feedback loops?
Document each assumption as either testable or untestable, and record the evidence (or lack of evidence) from the codebase.
Step 4: Create the Diagram
Use flowchart with:
Direction: TB (causes flow downward to effects)
Subgraphs:
- TREATMENT ASSIGNMENT
- MEDIATING MECHANISMS
- OUTCOME MEASUREMENT
- CONFOUNDERS
- SELECTION/COLLIDERS
Node Styling:
cliclass: Treatment variablesoutputclass: Outcome variableshandlerclass: MediatorsstateNodeclass: Confoundersdetectorclass: Colliders and selection variablesgapclass: Unblocked backdoor pathsnewComponentclass: Instruments
Edge Labels: causal, confounds, selects, mediates, blocks
Step 5: Write Output
Write the diagram to: temp/exp-lens-causal-assumptions/exp_diag_causal_assumptions_{YYYY-MM-DD_HHMMSS}.md
Output Template
# Causal Assumptions Diagram: {Experiment Name}
**Lens:** Causal Assumptions (Causal-Structural)
**Question:** What causal assumptions support this design?
**Date:** {YYYY-MM-DD}
**Scope:** {What was analyzed}
## Causal Variables
| Variable | Type | Measured? | Controlled? |
|----------|------|-----------|-------------|
| {name} | {Treatment/Outcome/Confounder/Mediator/Collider/Instrument/Selection} | {Yes/No} | {Yes/No} |
## Causal DAG
```mermaid
%%{init: {'flowchart': {'nodeSpacing': 50, 'rankSpacing': 60, 'curve': 'basis'}}}%%
flowchart TB
%% CLASS DEFINITIONS %%
classDef cli fill:#1a237e,stroke:#7986cb,stroke-width:2px,color:#fff;
classDef stateNode fill:#004d40,stroke:#4db6ac,stroke-width:2px,color:#fff;
classDef handler fill:#e65100,stroke:#ffb74d,stroke-width:2px,color:#fff;
classDef phase fill:#6a1b9a,stroke:#ba68c8,stroke-width:2px,color:#fff;
classDef newComponent fill:#2e7d32,stroke:#81c784,stroke-width:2px,color:#fff;
classDef output fill:#00695c,stroke:#4db6ac,stroke-width:2px,color:#fff;
classDef detector fill:#b71c1c,stroke:#ef5350,stroke-width:2px,color:#fff;
classDef gap fill:#ff6f00,stroke:#ffa726,stroke-width:2px,color:#000;
classDef integration fill:#c62828,stroke:#ef9a9a,stroke-width:2px,color:#fff;
subgraph Confounders ["CONFOUNDERS"]
CONF["Confounder Variable<br/>━━━━━━━━━━<br/>Shared source<br/>Controlled?"]
end
subgraph Treatment ["TREATMENT ASSIGNMENT"]
TREAT["Treatment<br/>━━━━━━━━━━<br/>Assignment mechanism<br/>Randomized?"]
INSTR["Instrument<br/>━━━━━━━━━━<br/>Exclusion restriction"]
end
subgraph Mediators ["MEDIATING MECHANISMS"]
MED["Mediator<br/>━━━━━━━━━━<br/>Intermediate step"]
end
subgraph Outcome ["OUTCOME MEASUREMENT"]
OUT["Outcome<br/>━━━━━━━━━━<br/>Metric / endpoint"]
end
subgraph Selection ["SELECTION/COLLIDERS"]
COLL["Collider<br/>━━━━━━━━━━<br/>Post-treatment filter"]
end
%% CAUSAL EDGES %%
CONF -->|"confounds"| TREAT
CONF -->|"confounds"| OUT
INSTR -->|"causal"| TREAT
TREAT -->|"causal"| MED
MED -->|"mediates"| OUT
TREAT -->|"selects"| COLL
OUT -->|"selects"| COLL
%% CLASS ASSIGNMENTS %%
class TREAT cli;
class OUT output;
class MED handler;
class CONF stateNode;
class COLL detector;
class INSTR newComponent;Color Legend:
| Color | Category | Description |
| Dark Blue | Treatment | Treatment assignment variables |
| Dark Teal | Outcome | Outcome measurement variables |
| Orange | Mediator | Intermediate mechanism variables |
| Teal | Confounder | Shared causes of treatment and outcome |
| Red | Collider/Selection | Post-treatment filters (conditioning risk) |
| Green | Instrument | Variables affecting only treatment |
| Amber | Backdoor Path | Unblocked confounding path |
Identification Strategy
| Assumption | Testable? | Evidence |
| {assumption} | {Yes/No} | {evidence from codebase} |
Unblocked Backdoor Paths
| Path | Variables | Severity | Mitigation |
| {path} | {A -> ... -> B} | {High/Medium/Low} | {adjustment/unavailable} |
---
## Pre-Diagram Checklist
Before creating the diagram, verify:
- [ ] LOADED `/mermaid` skill using the Skill tool
- [ ] Using ONLY classDef styles from the mermaid skill (no invented colors)
- [ ] Diagram will include a color legend table
---
## Related Skills
- `/make-experiment-diag` - Parent skill for lens selection
- `/mermaid` - MUST BE LOADED before creating diagram
- `/exp-lens-estimand-clarity` - For clarifying the target estimand
- `/exp-lens-validity-threats` - For broader validity threat inventoryDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

