Causal Exercises 标志

Causal Exercises

社区
RobsonTigre
causal-exercises

使用模拟数据和已知真实值,为所有因果推断方法生成练习题。用户提到“练习”“习题”“模拟”“学习因果推断”或“测试我的技能”时使用。不适用于真实数据分析。

概览

发布者RobsonTigre
代码仓库everyday-causal-skills
技能名称causal-exercises
星标数
83
复刻数
10
附带文件
仅含指令
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 RobsonTigre 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Causal Exercises AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/RobsonTigre/everyday-causal-skills/tree/main/skills/causal-exercises
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/RobsonTigre/everyday-causal-skills.git /tmp/everyday-causal-skills
mkdir -p .claude/skills
cp -r /tmp/everyday-causal-skills/skills/causal-exercises .claude/skills/causal-exercises
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Causal Exercises,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Causal Exercises。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Causal Exercises 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Causal Exercises

Generate realistic causal inference exercises with simulated data. The true effect is known, so practitioners can verify their work.

Before You Begin

  1. Read references/lessons.md — known mistakes. Do not repeat them.
  2. Read references/dgp-library.md — available data-generating processes.
  3. Read references/method-registry.md — method details.
  • Explain the why: When walking through assumptions, recommending methods, or flagging concerns, always explain why it matters — not just what to do. Help the user build intuition, not just follow instructions.

Quality Standards

  • Complete every stage. Do not skip assumption checks or robustness tests.
  • Quality over speed. A thorough analysis with caveats beats a fast one without.
  • When uncertain, say so. Flag limitations rather than presenting weak evidence as strong.
  • Realism over simplicity: Every scenario must read like a real business problem, not a textbook exercise. Use company names, job titles, and domain-specific language.
  • Always include at least one complication: Even "Basic" exercises should have one realistic wrinkle (e.g., slightly noisy data, an obvious but important assumption to check). Pure textbook setups teach nothing about real practice.
  • Data first: Generate and provide the dataset immediately — don't make the student wait. They should be able to start exploring within seconds.
  • Clear deliverable: Always tell the student exactly what they should produce — "estimate the treatment effect and explain your assumptions" is better than "analyze the data."
  • Canonical runnable block: When showing a DGP or solution program, put the exact line # EVAL_EXECUTABLE as the first nonblank program line inside exactly one correct-language code fence. Do not indent it or add other text on that line. That fence contains the complete runnable program; preflight snippets and illustrative alternatives stay unmarked.

Exercise Flow

Step 1: Choose Parameters

Ask: "What difficulty level? (Basic / Intermediate / Advanced)" Ask: "Any particular method to practice, or should I choose?"

Methods available: experiments, DiD, IV, RDD, synthetic control, matching, time series, DAG reasoning (variable selection, adjustment sets, bad control detection). Ask: "R or Python?"

If difficulty, method, and language are already supplied and the user requests the complete exercise now, treat Step 1 as complete. Do not repeat the parameter intake: provide the scenario and precise student deliverable in the same response. A complete-exercise request alone is not a request to see the generator: keep dgp.[R|py], the solution, and the true effect hidden until the debrief. Create dataset artifacts only when execution and file-writing tools are available and the run succeeds. Otherwise, explain that dataset creation requires executing the hidden DGP; do not claim that a dataset was created or saved, and do not cite a dataset path. When the user explicitly requests the runnable generator, this direct-output rule is the narrow exception to the normal instruction to conceal dgp.[R|py] until the debrief: emit the complete runnable generator inline, but do not separately annotate the true-effect parameter, explain the structural solution, or provide the answer. If Bash or Write is unavailable, explicitly say that the generator was not executed, the dataset was not saved, and no dataset path exists. Tell the student that inspecting generator internals can spoil the exercise and that they can run the block without reading it if they want a blind attempt.

Precedence over Step 3: The complete-exercise and explicit-generator branches above supersede Step 3's execution, save, and path-announcement instructions whenever the required execution or file-writing tools are unavailable. In those branches, follow Step 3 only after a DGP actually runs and its files are actually written; never repeat Step 3's generated-dataset or saved-path claim as a promise or hypothetical.

  • Basic: Clean setup, one method clearly correct, no complications.
  • Intermediate: Realistic noise, 1-2 complications (staggered rollout, weak instrument, imperfect overlap).
  • Advanced: Multiple complications, assumption violations baked in that the user must detect and handle.

IV exercise contract: An IV exercise must teach relevance/strength and validity as separate questions. A strong first stage only shows that the instrument moves treatment; it does not establish independence or the exclusion restriction. Design the scenario and DGP so the student must reason about both:

  • vary instrument strength across a labeled scenario, parameter, or comparison and require a first-stage coefficient, robust F statistic, and weak-instrument diagnosis;
  • include a scenario-specific validity challenge, such as a plausible direct path from the encouragement to the outcome, and ask the student to defend independence, exclusion, and monotonicity rather than declaring the instrument valid from its F statistic;
  • define the compliers in the scenario and teach LATE as the average treatment effect for those compliers. For example, an encouragement design identifies the effect among people who take treatment when encouraged but not otherwise, not the ATE for everyone; and
  • make the requested deliverable trace a path from data to first-stage diagnostics, reduced form and 2SLS, assumption assessment, and a scenario-specific LATE interpretation.

Keep the challenge discoverable from the narrative and observed variables. Do not resolve the validity question for the student or reveal the true effect before the debrief.

Step 2: Generate Scenario

Select a DGP from references/dgp-library.md matching the difficulty and method. Present a realistic business narrative. Do NOT reveal the method, the DGP, or the true effect, except for the narrow user-requested direct-generator case above. If the user already selected the method, do not pretend that method is hidden.

"Scenario: You work as a data analyst at [company]. [Business context narrative]. Your manager wants to know: [causal question]. You have access to the attached dataset."

Step 3: Create and Save Data

Run the DGP code (using Bash tool) to generate the dataset. If it needs a package the user may not have, follow references/preflight.md: report what's missing and offer to install it for them — never install silently. Save files:

  • docs/causal-exercises/YYYY-MM-DD-<exercise>/data.csv — the dataset
  • docs/causal-exercises/YYYY-MM-DD-<exercise>/dgp.[R|py] — the DGP code (do not show until debrief unless the direct-generator exception applies)
  • docs/causal-exercises/YYYY-MM-DD-<exercise>/solution.md — true effect and method (DO NOT show yet)

Tell the user: "I've generated the dataset at [path]. Take a look and tell me: What causal method would you use and why?"

Step 4: Progressive Hints (On Request)

If the user asks for help, provide hints in order:

  1. "Think about how the treatment was assigned."
  2. "What data structure do you have? Cross-sectional or panel?"
  3. "The key identification strategy here involves [hint at mechanism]."
  4. "The method I had in mind is [method]."
  5. "The key assumption to check is [specific assumption]."

Step 5: Review and Debrief

After the user presents their analysis (or asks for the answer):

  1. Reveal the true DGP and true effect.
  2. Compare: "Your estimate of [X] vs the true effect of [Y]."
  3. Explain the gap — connect the error to a specific cause:
    • If method was correct but estimate is off: "The gap of [Z] is [sampling variability / a finite-sample artifact]. With more data, this would shrink. Your approach was sound."
    • If method was correct but assumption was violated: "Your estimate missed because [assumption] was violated in this data. Here's how: [specific mechanism from the DGP]. The diagnostic that would have caught it is [test/plot] — it would have shown [what to look for]."
    • If method was wrong: "This scenario called for [correct method] because [reason]. The method you chose assumes [assumption], which doesn't hold here because [explanation from DGP]."
  4. Connect to practice: "In real data, you wouldn't know the true effect. The way to protect yourself is [specific diagnostic or robustness check that would have flagged the issue]."
  5. Score: "Your estimate of [X] vs truth of [Y] — [assessment]."

Save debrief to docs/causal-exercises/YYYY-MM-DD-<exercise>/debrief.md.

Common Issues

  • Revealing the DGP too early: The exercise is ruined if the user sees the true data-generating process before attempting the analysis. Never show DGP code or true effects until the debrief stage unless the user explicitly requested the runnable generator under the narrow direct-output exception; even then, withhold the separate solution and true-effect annotation.
  • Mismatch between simulated data and method difficulty: If the exercise is too easy (obvious treatment effect, no violations), it doesn't teach anything. Ensure exercises include realistic complications.
  • Conflating a strong instrument with a valid one: A large first-stage F statistic supports relevance, not independence or exclusion. Grade these as separate parts of an IV exercise.

Integration

Before this skill:

  • /causal-planner -- Optional; user may come directly to practice

After this skill:

  • /causal-[method] -- Apply the practiced method to real data
  • /causal-dag -- Practice drawing DAGs, identifying adjustment sets, and detecting bad controls

Self-Correction

If the user identifies a problem with the exercise (e.g., DGP doesn't match the narrative, unrealistic parameters), record the lesson in references/lessons.md.

常见问题

Causal Exercises AI 技能有什么作用?

使用模拟数据和已知真实值,为所有因果推断方法生成练习题。用户提到“练习”“习题”“模拟”“学习因果推断”或“测试我的技能”时使用。不适用于真实数据分析。

为什么在 TypingMind 中使用 Causal Exercises?

因为您只需安装一次,就能搭配任何模型使用。Causal Exercises 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Causal Exercises?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/RobsonTigre/everyday-causal-skills/tree/main/skills/causal-exercises。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Causal Exercises?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Causal Exercises 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Causal Exercises 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Causal Exercises AI 技能免费吗?

是的。RobsonTigre 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇