counterfactual-reasoning

counterfactual-reasoning is a skill for Claude Code, Codex from yipng05-max/-skills. It costs 167 tokens per session (2,416 once invoked), scanned A, original, MIT.

A method for stress-testing a research conclusion by looking for competing explanations, possible bias, and limits on what the evidence can support. It helps researchers examine whether an argument is stronger than its data justify.

In plain words
What is it for?
Use it to challenge conclusions, examine qualitative or quantitative evidence, anticipate reviewer objections, and identify confounding factors, selection bias, and overextended interpretations.
Why use it?
It exposes weaknesses before reviewers or readers find them. Testing alternative explanations can show where a conclusion needs more evidence, narrower wording, or a revised claim.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to challenge conclusions, examine qualitative or quantitative evidence, anticipate reviewer objections, and identify confounding factors, selection bias, and overextended interpretations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/yipng05-max/-skills/counterfactual-reasoning
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 yipng05-max/-skills --skill counterfactual-reasoning
Clone the repo
git clone --depth 1 https://github.com/yipng05-max/-skills

Made for: Claude Code, Codex.

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 counterfactual-reasoning

README.md
[![agentmods](https://agentmods.dev/badge/skills/yipng05-max/-skills/counterfactual-reasoning/github.svg)](https://agentmods.dev/skills/yipng05-max/-skills/counterfactual-reasoning)
Your own site
<a href="https://agentmods.dev/skills/yipng05-max/-skills/counterfactual-reasoning"><img src="https://agentmods.dev/badge/skills/yipng05-max/-skills/counterfactual-reasoning/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 counterfactual-reasoning

Your own site · 80×15
<a href="https://agentmods.dev/skills/yipng05-max/-skills/counterfactual-reasoning"><img src="https://agentmods.dev/badge/skills/yipng05-max/-skills/counterfactual-reasoning.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 167 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,416 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.00167 $0.02416
Opus 5 $0.00084 $0.01208
Sonnet 5 $0.00033 $0.00483
Haiku 4.5 $0.00017 $0.00242

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

Security

Grade A, and why

counterfactual-reasoning 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 11d 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.

counterfactual-reasoning/SKILL.md · 233 lines

How it starts

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

反事实思维工具(Counterfactual Reasoning)

本 skill 基于 King、Keohane & Verba(1994)的因果推断逻辑、 Campbell & Stanley(1963)的威胁效度框架,以及社会学实证研究的评审标准, 对研究结论进行系统性压力测试,帮助研究者在提交前识别和处理论证弱点。

核心立场:一个经得住检验的结论,是被竭力反驳之后仍然成立的结论,而不是没有被反驳过的结论。 主动寻找竞争性解释并处理它们,比等待审稿人指出要有价值得多。


启动:获取必要信息

触发后,收集以下信息:

必填 1:核心结论或论点

用户希望进行压力测试的结论,尽量具体,例如:

"平台工人通过'时间自由叙事'内化了平台对劳动时间管理责任的转移, 这是一种主体性的屈从(subjectivation),而非单纯的意识形态灌输。"

必填 2:支撑结论的主要证据

简要说明结论建立在什么数据/材料基础上:

  • 定性研究:受访者人数、类型、核心资料来源
  • 定量研究:样本量、变量操作化、核心统计结果

选填 3:研究设计概述

  • 研究方法类型
  • 案例选择策略
  • 数据收集方式

选填 4:用户已意识到的弱点

研究者自己已经注意到的潜在问题(优先处理)。

选填 5:目标期刊

不同期刊的审稿文化不同,可以影响压力测试的侧重点。


执行流程

收到信息后,自动连续执行以下四个阶段,无需每步等待用户确认。


第一阶段:结论解剖

在压力测试之前,先精确解析结论的逻辑结构:

  1. 核心主张:结论声称 A 导致(或解释了)B,其中 A 和 B 分别是什么?
  2. 因果方向:是单向因果?双向?还是条件性关系?
  3. 适用范围:结论明示或暗示适用于哪类情境、人群、时间段?
  4. 机制描述:结论背后声称发生了什么机制?(不只是"A→B",而是"A 通过 X 过程导致 B")
  5. 证据-结论的跨度:现有证据直接支撑到哪里?从证据到结论做了多大的推论跳跃?

输出格式

【结论解剖】
核心主张:A = [  ],B = [  ]
因果/解释方向:
适用范围(显性):
适用范围(隐性预设):
声称的机制:
证据实际覆盖到:[具体到哪里]
推论跨度评估:小 / 中 / 大

第二阶段:竞争性解释枚举

系统枚举所有可能与当前结论竞争的替代解释。按以下五类来源逐一检索:

来源 1:混淆变量(Confounding Variables)

有没有第三个变量同时影响了原因变量和结果变量,使得观察到的关系是虚假的?

针对研究的具体情境,提出 2-4 个最可能的混淆变量候选,并说明:

  • 该变量如何同时影响两端?
  • 研究设计是否控制了这个变量?
  • 如果没有控制,结论的稳健性受到多大威胁?
来源 2:反向因果(Reverse Causation)

B 有没有可能是 A 的原因,而非结果? 或者两者互为因果?

说明反向因果的可能路径,并评估:

  • 时间顺序是否足够清晰?
  • 有没有工具变量或其他因果识别策略?
来源 3:选择性偏差(Selection Bias)

研究的样本/案例是否系统性地倾向某种特征,导致结论不具代表性?

检查:

  • 样本如何被选入研究?选入过程有没有内生性?
  • "沉默的多数"——那些没有进入样本的对象,会和样本有什么系统性差异?
  • 访谈研究中:接受访谈的人与拒绝访谈的人,有没有系统性差异?
来源 4:观察者效应(Observer Effects)

研究者的存在或研究过程本身,是否改变了被研究现象?

在定性研究中尤其重要:

  • 受访者是否在研究者面前呈现了与日常不同的行为或叙述?
  • 受访者是否猜测了研究者的期望并迎合它?
  • 反思性:研究者的身份、立场如何影响了数据收集和解读?
来源 5:替代机制(Alternative Mechanisms)

即使 A→B 的关系成立,有没有与当前解释不同的机制也能产生同样的结果?

这是最具挑战性的一类:机制的竞争。 列出 2-3 个替代机制,每个替代机制说明:

  • 这个替代机制的逻辑是什么?
  • 它会产生和当前结论相同的可观测模式吗?
  • 什么样的证据能够区分这两个机制?

输出格式(每类竞争性解释):

[竞争性解释类型:混淆变量/反向因果/选择偏差/观察者效应/替代机制]
具体威胁描述:
威胁的严重程度:高 / 中 / 低
当前研究的处理情况:已处理 / 部分处理 / 未处理
如果未处理,对结论可信度的影响:
可能的回应策略:

Read the full file on GitHub · 233 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. 11d ago First seen · 233 lines · 167 tokens per session scan A 34f67a1e9e3c

Subscribe to this mod's changes

counterfactual-reasoning is a skill published in the GitHub repository yipng05-max/-skills (285 stars, last pushed 4mo ago), licensed MIT. It adds 167 tokens to every session and 2,416 once invoked, about $0.0008 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-30.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

insight-error-page

Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…

vercel/next.js · 83 tokens

next-cache-components-optimizer

Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…

vercel/next.js · 170 tokens

next-partial-prefetching-adoption

Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…

vercel/next.js · 103 tokens