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
Arguments
/autoskillit:exp-lens-causal-assumptions [context_path] [experiment_plan_path]
- context_path (optional positional arg 1) — Absolute path to a lens context file
containing IV/DV tables, H0/H1 hypotheses, controlled variables, and success criteria.
If provided, read this file before beginning analysis to obtain structured context.
If omitted, discover context by exploring the CWD.
- experiment_plan_path (optional positional arg 2) — Absolute path to the full
experiment plan. If provided, read for complete experimental methodology and design.
If omitted, locate the experiment plan by exploring the CWD.
When to Use
- Experiment claims causal effects
- Pipeline has shared components that might confound
- Need to verify identification strategy
- User invokes
/autoskillit:exp-lens-causal-assumptions or /autoskillit: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
- Create files outside
{{AUTOSKILLIT_TEMP}}/exp-lens-causal-assumptions/
- Run subagents in the background (
run_in_background: true is prohibited)
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 /autoskillit:mermaid skill using the Skill tool - this is MANDATORY
If the Skill tool cannot be used (disable-model-invocation) or refuses this invocation, do NOT proceed with diagram creation. Abort this step and omit the diagram from output.
Write output to {{AUTOSKILLIT_TEMP}}/exp-lens-causal-assumptions/exp_diag_causal_assumptions_{YYYY-MM-DD_HHMMSS}.md
After writing the file, emit the structured output token as literal plain text with no
markdown formatting on the token name (the adjudicator performs a regex match):
diagram_path = /absolute/path/to/{{AUTOSKILLIT_TEMP}}/exp-lens-causal-assumptions/exp_diag_causal_assumptions_{...}.md
Analysis Workflow
Step 0: Parse optional arguments
If positional arg 1 (context_path) is provided and the file exists, read it to obtain
IV/DV tables, H0/H1 hypotheses, controlled variables, and success criteria. If positional
arg 2 (experiment_plan_path) is provided and exists, read the experiment plan for full
methodology. Use this structured context as the foundation for Steps 1-5; skip the CWD
exploration for these fields if the context file supplies them.
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:
cli class: Treatment variables
output class: Outcome variables
handler class: Mediators
stateNode class: Confounders
detector class: Colliders and selection variables
gap class: Unblocked backdoor paths
newComponent class: Instruments
Edge Labels: causal, confounds, selects, mediates, blocks
Step 5: Write Output
Write the diagram to: {{AUTOSKILLIT_TEMP}}/exp-lens-causal-assumptions/exp_diag_causal_assumptions_{YYYY-MM-DD_HHMMSS}.md (relative to the current working directory)
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 `/autoskillit: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
- `/autoskillit:make-experiment-diag` - Parent skill for lens selection
- `/autoskillit:mermaid` - MUST BE LOADED before creating diagram
- `/autoskillit:exp-lens-estimand-clarity` - For clarifying the target estimand
- `/autoskillit:exp-lens-validity-threats` - For broader validity threat inventory
1---2name: exp-lens-causal-assumptions3description: Create Causal Assumptions experimental design diagram showing confounders, mediators, colliders, and identification strategy. Causal-structural lens answering "What causal assumptions support this design?"4---56# Causal Assumptions Experimental Design Lens78**Philosophical Mode:** Causal-Structural9**Primary Question:** "What causal assumptions support this design?"10**Focus:** Confounders, Mediators, Colliders, Adjustment Sets, Identification Strategy1112## Arguments1314`/autoskillit:exp-lens-causal-assumptions [context_path] [experiment_plan_path]`1516- **context_path** (optional positional arg 1) — Absolute path to a lens context file17 containing IV/DV tables, H0/H1 hypotheses, controlled variables, and success criteria.18 If provided, read this file before beginning analysis to obtain structured context.19 If omitted, discover context by exploring the CWD.20- **experiment_plan_path** (optional positional arg 2) — Absolute path to the full21 experiment plan. If provided, read for complete experimental methodology and design.22 If omitted, locate the experiment plan by exploring the CWD.2324## When to Use2526- Experiment claims causal effects27- Pipeline has shared components that might confound28- Need to verify identification strategy29- User invokes `/autoskillit:exp-lens-causal-assumptions` or `/autoskillit:make-experiment-diag causal`3031## Critical Constraints3233**NEVER:**34- Modify any source code files35- Do not litter the codebase with useless comments, TODO markers, or explanatory annotations — the skill output and diagram speak for themselves36- Create files outside `{{AUTOSKILLIT_TEMP}}/exp-lens-causal-assumptions/`37- Run subagents in the background (`run_in_background: true` is prohibited)3839**ALWAYS:**40- Classify every variable as Treatment, Outcome, Confounder, Mediator, Collider, Instrument, or Selection variable41- Map every directed edge to a concrete code-level data flow42- Flag all unblocked backdoor paths explicitly43- Document the identification strategy with testable assumptions44- BEFORE creating any diagram, LOAD the `/autoskillit:mermaid` skill using the Skill tool - this is MANDATORY45- If the Skill tool cannot be used (disable-model-invocation) or refuses this invocation, do NOT proceed with diagram creation. Abort this step and omit the diagram from output.46- Write output to `{{AUTOSKILLIT_TEMP}}/exp-lens-causal-assumptions/exp_diag_causal_assumptions_{YYYY-MM-DD_HHMMSS}.md`47- After writing the file, emit the structured output token as **literal plain text** with no48 markdown formatting on the token name (the adjudicator performs a regex match):4950 ```51 diagram_path = /absolute/path/to/{{AUTOSKILLIT_TEMP}}/exp-lens-causal-assumptions/exp_diag_causal_assumptions_{...}.md52 ```5354---5556## Analysis Workflow5758### Step 0: Parse optional arguments5960If positional arg 1 (context_path) is provided and the file exists, read it to obtain61IV/DV tables, H0/H1 hypotheses, controlled variables, and success criteria. If positional62arg 2 (experiment_plan_path) is provided and exists, read the experiment plan for full63methodology. Use this structured context as the foundation for Steps 1-5; skip the CWD64exploration for these fields if the context file supplies them.6566### Step 1: Launch Parallel Exploration Subagents6768Spawn Explore subagents to investigate:6970**Treatment & Outcome Definition**71- Find experiment config, treatment assignment code, outcome measurement72- Look for: treatment, control, outcome, response, endpoint, metric7374**Confounding Pathways**75- Find shared data sources, preprocessing, environment variables76- Look for: shared, common, config, environment, seed, global7778**Mediator & Mechanism Variables**79- Find intermediate processing steps between treatment and outcome80- Look for: transform, preprocess, feature, intermediate, pipeline8182**Collider & Selection Variables**83- Find filtering, subsetting, or conditional logic applied post-treatment84- Look for: filter, subset, exclude, condition, threshold, select8586**Randomization & Assignment**87- Find how experimental units are assigned to conditions88- Look for: random, assign, allocate, split, stratify, block8990### Step 2: Build the Causal Graph Structure9192For 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.9394### Step 3: Identify Causal Assumptions9596**CRITICAL — Analyze Claim Direction:**97For every edge in the causal graph, determine:98- Does code implement a causal mechanism (A produces B) or merely a statistical association?99- Is the direction grounded in temporal ordering or domain knowledge?100- Are there feedback loops?101102Document each assumption as either testable or untestable, and record the evidence (or lack of evidence) from the codebase.103104### Step 4: Create the Diagram105106Use flowchart with:107108**Direction:** `TB` (causes flow downward to effects)109110**Subgraphs:**111- TREATMENT ASSIGNMENT112- MEDIATING MECHANISMS113- OUTCOME MEASUREMENT114- CONFOUNDERS115- SELECTION/COLLIDERS116117**Node Styling:**118- `cli` class: Treatment variables119- `output` class: Outcome variables120- `handler` class: Mediators121- `stateNode` class: Confounders122- `detector` class: Colliders and selection variables123- `gap` class: Unblocked backdoor paths124- `newComponent` class: Instruments125126**Edge Labels:** causal, confounds, selects, mediates, blocks127128### Step 5: Write Output129130Write the diagram to: `{{AUTOSKILLIT_TEMP}}/exp-lens-causal-assumptions/exp_diag_causal_assumptions_{YYYY-MM-DD_HHMMSS}.md` (relative to the current working directory)131132---133134## Output Template135136```markdown137# Causal Assumptions Diagram: {Experiment Name}138139**Lens:** Causal Assumptions (Causal-Structural)140**Question:** What causal assumptions support this design?141**Date:** {YYYY-MM-DD}142**Scope:** {What was analyzed}143144## Causal Variables145146| Variable | Type | Measured? | Controlled? |147|----------|------|-----------|-------------|148| {name} | {Treatment/Outcome/Confounder/Mediator/Collider/Instrument/Selection} | {Yes/No} | {Yes/No} |149150## Causal DAG151152```mermaid153%%{init: {'flowchart': {'nodeSpacing': 50, 'rankSpacing': 60, 'curve': 'basis'}}}%%154flowchart TB155 %% CLASS DEFINITIONS %%156 classDef cli fill:#1a237e,stroke:#7986cb,stroke-width:2px,color:#fff;157 classDef stateNode fill:#004d40,stroke:#4db6ac,stroke-width:2px,color:#fff;158 classDef handler fill:#e65100,stroke:#ffb74d,stroke-width:2px,color:#fff;159 classDef phase fill:#6a1b9a,stroke:#ba68c8,stroke-width:2px,color:#fff;160 classDef newComponent fill:#2e7d32,stroke:#81c784,stroke-width:2px,color:#fff;161 classDef output fill:#00695c,stroke:#4db6ac,stroke-width:2px,color:#fff;162 classDef detector fill:#b71c1c,stroke:#ef5350,stroke-width:2px,color:#fff;163 classDef gap fill:#ff6f00,stroke:#ffa726,stroke-width:2px,color:#000;164 classDef integration fill:#c62828,stroke:#ef9a9a,stroke-width:2px,color:#fff;165166 subgraph Confounders ["CONFOUNDERS"]167 CONF["Confounder Variable<br/>━━━━━━━━━━<br/>Shared source<br/>Controlled?"]168 end169170 subgraph Treatment ["TREATMENT ASSIGNMENT"]171 TREAT["Treatment<br/>━━━━━━━━━━<br/>Assignment mechanism<br/>Randomized?"]172 INSTR["Instrument<br/>━━━━━━━━━━<br/>Exclusion restriction"]173 end174175 subgraph Mediators ["MEDIATING MECHANISMS"]176 MED["Mediator<br/>━━━━━━━━━━<br/>Intermediate step"]177 end178179 subgraph Outcome ["OUTCOME MEASUREMENT"]180 OUT["Outcome<br/>━━━━━━━━━━<br/>Metric / endpoint"]181 end182183 subgraph Selection ["SELECTION/COLLIDERS"]184 COLL["Collider<br/>━━━━━━━━━━<br/>Post-treatment filter"]185 end186187 %% CAUSAL EDGES %%188 CONF -->|"confounds"| TREAT189 CONF -->|"confounds"| OUT190 INSTR -->|"causal"| TREAT191 TREAT -->|"causal"| MED192 MED -->|"mediates"| OUT193 TREAT -->|"selects"| COLL194 OUT -->|"selects"| COLL195196 %% CLASS ASSIGNMENTS %%197 class TREAT cli;198 class OUT output;199 class MED handler;200 class CONF stateNode;201 class COLL detector;202 class INSTR newComponent;203```204205**Color Legend:**206| Color | Category | Description |207|-------|----------|-------------|208| Dark Blue | Treatment | Treatment assignment variables |209| Dark Teal | Outcome | Outcome measurement variables |210| Orange | Mediator | Intermediate mechanism variables |211| Teal | Confounder | Shared causes of treatment and outcome |212| Red | Collider/Selection | Post-treatment filters (conditioning risk) |213| Green | Instrument | Variables affecting only treatment |214| Amber | Backdoor Path | Unblocked confounding path |215216## Identification Strategy217218| Assumption | Testable? | Evidence |219|------------|-----------|----------|220| {assumption} | {Yes/No} | {evidence from codebase} |221222## Unblocked Backdoor Paths223224| Path | Variables | Severity | Mitigation |225|------|-----------|----------|------------|226| {path} | {A -> ... -> B} | {High/Medium/Low} | {adjustment/unavailable} |227```228229---230231## Pre-Diagram Checklist232233Before creating the diagram, verify:234235- [ ] LOADED `/autoskillit:mermaid` skill using the Skill tool236- [ ] Using ONLY classDef styles from the mermaid skill (no invented colors)237- [ ] Diagram will include a color legend table238239---240241## Related Skills242243- `/autoskillit:make-experiment-diag` - Parent skill for lens selection244- `/autoskillit:mermaid` - MUST BE LOADED before creating diagram245- `/autoskillit:exp-lens-estimand-clarity` - For clarifying the target estimand246- `/autoskillit:exp-lens-validity-threats` - For broader validity threat inventory