Causal Reasoning
Category: reasoning
Skill Level: advanced
Stability: stable
Added: 2025-03
Last Updated: 2026-04
Description
Identify and reason about cause-and-effect relationships in text, data, or system descriptions. Distinguishes correlation from causation, builds causal chains, evaluates counterfactuals ("what if X hadn't happened?"), and identifies confounders. Applies to root-cause analysis, policy evaluation, experiment design, and business impact attribution.
Inputs
| Input |
Type |
Required |
Description |
scenario |
string |
✅ |
Description of the situation or event to analyze |
question |
string |
❌ |
Specific causal question (default: general causal analysis) |
mode |
string |
❌ |
forward (effects of cause) or backward (causes of effect) |
Outputs
| Output |
Type |
Description |
causal_chain |
list |
[{step, cause, effect, mechanism}] |
confounders |
list |
Factors that complicate attribution |
counterfactual |
string |
What would have happened without the root cause |
confidence |
string |
high / medium / low |
Example
import anthropic
import json
client = anthropic.Anthropic()
def causal_analysis(scenario: str, question: str = "") -> dict:
"""
Analyze causal relationships in a scenario.
"""
q_hint = f"\nSpecific question: {question}" if question else ""
response = client.messages.create(
model="claude-opus-4-5",
max_tokens=2048,
messages=[{
"role": "user",
"content": (
f"Scenario:\n{scenario}{q_hint}\n\n"
"Perform causal analysis and return JSON with:\n"
"- causal_chain: [{step, cause, effect, mechanism}]\n"
"- root_cause: string\n"
"- confounders: list of complicating factors\n"
"- counterfactual: what would have happened without the root cause\n"
"- confidence: high | medium | low\n"
"- prevention_recommendations: list of actions to prevent recurrence\n"
"Return ONLY valid JSON."
)
}]
)
return json.loads(response.content[0].text)
result = causal_analysis(
scenario=(
"A web app's checkout conversion rate dropped 18% on Tuesday afternoon. "
"A UI library was upgraded that morning. Load times on the checkout page "
"increased by 1.2s. No backend errors were logged."
),
question="What caused the conversion drop?"
)
print(json.dumps(result, indent=2))
Frameworks & Models
| Framework / Model |
Implementation |
Since |
| Claude claude-opus-4-5 |
Extended thinking for deep causal chains |
2025-01 |
| GPT-4o |
Chain-of-thought prompt |
2024-05 |
| LangGraph |
Multi-step causal graph node |
v0.1 |
Notes
- Enable extended thinking for complex multi-variable chains
- Provide a timeline or sequence of events when available
- Always request confounders — models tend to over-attribute causation without explicit prompting
Failure Modes
- Correlation as causation: treating co-occurrence or temporal order as a causal link without an intervening mechanism or controlled comparison.
- Confounded causes: attributing an effect to one factor when a third variable drives both; list candidate confounders explicitly.
- Unfalsifiable causal chains: building narratives that can absorb any observation; require each causal link to state evidence that could refute it.
- Single-cause reduction: forcing a multi-cause outcome into one root cause, hiding contributing factors that each need mitigation.
Related Skills
- Abductive Reasoning — hypothesis inference from incomplete observations
- Analogical Reasoning — cross-domain solution transfer
- Commonsense Reasoning — everyday causal knowledge
Changelog
| Date |
Change |
2026-04 |
Expanded from stub: full description, I/O table, conversion-drop case study |
2025-03 |
Initial stub entry |
Evidence
The canonical skill file is the authoritative repository implementation. Repository schema, validation workflows, and the Agent Skills projection contract define structural conformance. Implementation guidance must remain traceable to supplied or independently verified authoritative sources; no benchmark claim is made without reproducible evidence.