Causal Rdd logo

Causal Rdd

Community
RobsonTigre
causal-rdd

Implements sharp and fuzzy regression discontinuity designs in R or Python with bandwidth selection, manipulation testing, and sensitivity analysis. Use when user mentions RDD, cutoff, threshold, running variable, or discontinuity. Not for arbitrary subgroup comparisons.

Overview

PublisherRobsonTigre
Repositoryeveryday-causal-skills
Skill namecausal-rdd
Stars
83
Forks
10
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by RobsonTigre on GitHub. Read the source before you install it.

Installation

Install the Causal Rdd AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/RobsonTigre/everyday-causal-skills/tree/main/skills/causal-rdd
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

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-rdd .claude/skills/causal-rdd
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Causal Rdd in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Causal Rdd on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Causal Rdd is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Causal RDD

You guide users through a complete regression discontinuity design analysis following a 5-stage pattern.

Before You Begin

  1. Read references/lessons.md — known mistakes. Do not repeat them.
  2. Read references/assumptions/rdd.md — the assumption checklist for RDD.
  3. Read references/method-registry.md → "Regression Discontinuity Design (RDD)" section.
  4. Check if a plan exists at docs/causal-plans/*/plan.md. If it does, read it for context.
  • 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.

Stage 1: Setup

If a plan document from /causal-planner is provided: Extract the study design (treatment, population, outcome, data structure, language) directly from the plan. Do not re-ask questions the planner already answered. Acknowledge the plan and build on it.

If plan exists: Read it. Extract business objective, running variable, cutoff, outcome, language, data structure. Confirm: "I've read your analysis plan. You're using a regression discontinuity with [running variable] at cutoff [value] to estimate the effect on [outcome]. Does that sound right?"

If no plan: Ask:

  1. "What's the running variable (the continuous score that determines treatment)?"
  2. "What's the cutoff value?"
  3. "Is this a sharp RDD (treatment is deterministic at the cutoff — everyone above/below gets treated) or a fuzzy RDD (treatment probability jumps at the cutoff but isn't 100%)?"
  4. "What's the outcome?"
  5. "Approximately how many observations do you have, and how many are near the cutoff?"
  6. "Are there any other known discontinuities at the same cutoff (e.g., other policies that kick in at the same threshold)?"
  7. "R or Python?"

When running variable, cutoff, treatment rule, outcome, and language are already supplied: Confirm the design briefly, then explain that RDD compares units just across the cutoff because they should be similar except for treatment. State that the estimand is local to units near the cutoff, not a population-wide ATE. In the same response, provide the immediate density/covariate-continuity diagnostic and local-estimation action rather than deferring all code behind repeated questions.

If bunching is observed, explain in plain language that units just above and below the cutoff may then differ because they sorted into position, destroying the local like-for-like comparison. Issue the severity verdict and offer the density test and credible alternatives. If diagnostics establish smooth density and covariates, describe the design as passing those observed checks while retaining the usual bandwidth, functional-form, and local-validity caveats.

Fully specified direct mode: When the user also requests the full response now and no unresolved fatal diagnostic is reported, do not stop for intake. Direct mode overrides only interactive pauses; it does not override diagnostic stop rules. A known fatal violation takes precedence over direct mode: issue the verdict and do not provide an effect estimate. The suspected-manipulation first-response branch below also takes precedence whenever manipulation is reported or suspected but its diagnostic outcome is not supplied.

Within direct mode, the guarded runnable block replaces the later instruction to wait for the user to report an unresolved testable diagnostic: the guard itself prevents the effect stage from running on failure. That later wait rule still applies outside direct mode and whenever a fatal violation is already known. It also remains in force for the suspected-manipulation branch until that diagnostic is resolved.

This is a narrow precedence rule. In direct mode it supersedes the Stage 2 wait clause and the Stage 3 prohibition on restructuring only where needed to put the guarded density and covariate diagnostics before effect estimation. Permit only that minimal reordering and guard wrapper; retain the template's tested package APIs, arguments, preprocessing, and outputs. It does not authorize a claim that any code or diagnostic was executed. The suspected-manipulation branch remains the higher-priority exception.

Otherwise, give the complete guarded response, including the RD plot, rddensity, data-driven rdrobust bandwidth selection, code that outputs the robust local estimate, covariate-continuity checks, bandwidth sensitivity, and interpretation instructions. Put rddensity and predetermined-covariate continuity checks before the main rdrobust effect calculation in the runnable code. Only if those checks pass may the code calculate the main effect and bandwidth sensitivity. If density or covariate diagnostics fail, emit the applicable verdict, stop before effect estimation, and explain whether the design must be abandoned or the localized manipulation branch should be assessed. Compound treatments and continuity of potential outcomes remain substantive, untestable requirements; passing observed checks does not establish them.

Put the bandwidth explanation next to the estimation code: a narrower window compares more similar units and usually reduces bias but uses fewer observations and raises variance; a wider window improves precision but can add bias from units farther from the cutoff. Report the selected bandwidth and sensitivity estimates rather than treating the default as self-justifying. Supplying the whole guarded program now does not mean it ran. Do not claim that the code ran, diagnostics passed, files were saved, or results exist, and do not state a numerical effect, unless execution or user-supplied output establishes that.

Suspected manipulation — first response: Surface the donut-RD option immediately after the density diagnostic, not only in a later robustness stage. A donut excludes the narrow score band where retakes, heaping, or grading discretion could produce localized sorting, then re-estimates the same local effect. It is defensible only if the manipulation mechanism is credibly confined to that omitted band and units just outside it remain comparable. It cannot rescue RDD when sorting is broader, another policy changes at the cutoff, covariates also jump, or the remaining sample no longer supports a local comparison. In those cases report that the design is not salvageable by a donut and recommend another identification strategy. When manipulation is only suspected and diagnostics are not supplied, give density-test code first and a conditional path: proceed to the full RDD if observed checks pass; otherwise assess localization before treating a donut estimate as credible. In that first response, include both the density-test code and conditional donut-hole sensitivity code, with the main RDD estimate held until the diagnostic decision is resolved. This branch wins even when the user asks for the complete response now; do not let direct mode bypass the unresolved manipulation gate.

Canonical runnable block: When emitting executable code, 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 must contain the complete program to run. Keep preflight snippets and illustrative alternatives outside it; do not mark more than one block.

Determine variant:

  • Treatment is deterministic at cutoff → Sharp RDD
  • Treatment probability jumps but isn't 100% → Fuzzy RDD (IV with cutoff as instrument)
  • Multiple cutoffs → Multi-cutoff RDD (normalize running variables)
  • Geographic boundary → Geographic RDD (discuss spatial considerations)

Stage 2: Assumptions

Read references/assumptions/rdd.md. Walk through each assumption interactively:

For each assumption:

  1. Explain in plain language what it means for their specific context.
  2. Ask if it's plausible.
  3. If testable, offer diagnostic code.
  4. Note the concern level.

Key assumptions to walk through:

  1. No manipulation of the running variable: "Can units precisely control their score to sort around the cutoff? If so, units just above and below differ systematically."

    • Testable: Cattaneo, Jansson, and Ma (2020) density test (rddensity) — check for a jump in the density of the running variable at the cutoff.
    • Offer density test code.
  2. Continuity of potential outcomes: "Would the outcome have been smooth through the cutoff in the absence of treatment? No other jump at the cutoff."

    • Partially testable: check if pre-determined covariates are smooth through the cutoff.
    • Offer covariate discontinuity test code.
  3. No compound treatments: "Is there only ONE treatment that changes at this cutoff, or do multiple things change simultaneously?"

    • Ask: "Are there other programs, rules, or policies that use this same cutoff?"
  4. Functional form near cutoff: "The estimate depends on the local polynomial fit. Misspecification far from the cutoff won't matter (we use local methods), but we need enough data near the cutoff."

    • rdrobust handles this with data-driven bandwidth selection.

After all assumptions, summarize with status indicators per assumption.

If fatal violations exist (especially manipulation or compound treatment), warn clearly and suggest alternatives. If you cannot yet confirm the violation (because the user hasn't run diagnostic code), use the CONDITIONAL FATAL verdict format from Red Flags. Do not generate full analysis code before a fatal-level diagnostic has been resolved — require the user to report the diagnostic result first.

Stage 3: Implementation

Generate complete analysis code. Read the appropriate template from templates/r/rdd.md or templates/python/rdd.md for code patterns.

Missing-package preflight: The template's Prerequisites block detects (never installs) missing packages. Follow references/preflight.md: report what's missing, then ask the user whether they want you to install it for them or do it themselves — install only on an explicit yes.

IMPORTANT — Template adherence: Copy the code pattern from the appropriate template (templates/r/rdd.md or templates/python/rdd.md) exactly, then adapt only variable names to match the user's data. Do not restructure the code, use alternative function APIs, or improvise accessor patterns. The templates have been tested; deviations introduce bugs.

Always include:

  • RD plot (visual inspection of the discontinuity)
  • Density test for manipulation (Cattaneo, Jansson, and Ma 2020)
  • Main RD estimate with robust confidence interval
  • Bandwidth selection details
  • Covariate smoothness checks

Sharp RDD (R):

r
library(rdrobust)
library(rddensity)

# RD plot — visual inspection
rdplot(Y, X, c = cutoff,
       title = "RD Plot",
       x.label = "Running Variable",
       y.label = "Outcome")

# Density test for manipulation (Cattaneo, Jansson, and Ma 2020)
density_test <- rddensity(X, c = cutoff)
summary(density_test)

# Main RD estimate with robust bias-corrected inference
rd_est <- rdrobust(Y, X, c = cutoff)
summary(rd_est)

# With covariates for precision
rd_cov <- rdrobust(Y, X, c = cutoff, covs = cbind(Z1, Z2))
summary(rd_cov)

Fuzzy RDD (R):

r
library(rdrobust)

# Fuzzy RDD — treatment is endogenous, cutoff is instrument
rd_fuzzy <- rdrobust(Y, X, c = cutoff, fuzzy = treatment)
summary(rd_fuzzy)

Sharp RDD (Python):

python
from rdrobust import rdrobust, rdplot, rdbwselect
from rddensity import rddensity

# RD plot
rdplot(Y, X, c=cutoff,
       title="RD Plot",
       x_label="Running Variable",
       y_label="Outcome")

# Density test for manipulation (Cattaneo, Jansson, and Ma 2020)
density_test = rddensity(X, c=cutoff)
print(density_test)

# Main RD estimate
rd_est = rdrobust(Y, X, c=cutoff)
print(rd_est)

Fuzzy RDD (Python):

python
from rdrobust import rdrobust

# Fuzzy RDD
rd_fuzzy = rdrobust(Y, X, c=cutoff, fuzzy=treatment)
print(rd_fuzzy)

Adapt code to the user's variable names and data structure.

Stage 4: Falsification / Robustness

Propose at least one check. Generate the code.

Options (offer the most relevant):

  1. Bandwidth sensitivity: Re-estimate at 50%, 75%, 125%, and 150% of the optimal bandwidth. Results should be qualitatively stable.
  2. Donut hole test: Exclude units within a small window right at the cutoff (e.g., +/- 1 unit of the running variable). If manipulation is mild, the effect should survive.
  3. Placebo cutoffs: Run the RD analysis at cutoff values where there is NO treatment. Finding an "effect" at a placebo cutoff suggests model misspecification.
  4. Covariate discontinuity tests: Run rdrobust on pre-determined covariates as outcomes. They should NOT show a discontinuity at the cutoff.
  5. Polynomial order sensitivity: Try local linear (p=1) and local quadratic (p=2). Results should be consistent.

Verification Gate

Before proceeding to interpretation, confirm ALL of the following from actual code output:

  • Main estimation ran without errors
  • You can quote the point estimate from the output
  • You can quote the standard error and 95% CI from the output
  • At least one robustness/falsification check ran and you can compare its result to the main estimate
  • Assumption diagnostics produced output (not just discussed)

If any box is unchecked: Flag it to the user — explain which evidence is missing and why it matters. Offer to run the missing step before interpreting. If the user chooses to continue anyway, carry the gap forward as a caveat in the interpretation.

Watch for premature conclusions — phrases like "The results suggest..." or "Based on the analysis..." before the gate passes. These imply conclusions without evidence. Quote actual output instead.

Severity verdicts must appear BEFORE this gate. If a Fatal or Serious issue was identified during Stage 2 (Assumptions) or Stage 3 (Implementation), the severity verdict block must already be visible in the output above. Do not defer severity communication to after the user runs the code if the data or context already reveals the violation.

Red Flags

Data Diagnostic Signals

SignalSeverityAction
Density test rejects (rddensity)🚨 FatalRunning variable is manipulated. RDD is likely invalid. Warn user before continuing.
Covariates are discontinuous at cutoff🚨 FatalCompound treatment or sorting. Warn user before continuing.
Effect flips sign with different bandwidth⚠️ SeriousResult is fragile. Report sensitivity plot.
Very few observations near cutoff⚠️ SeriousEstimates imprecise. Report effective sample size and CI width.

🚨 Fatal = Emit this verdict block immediately after the diagnostic that reveals the violation:

FATAL: [violation name] [One sentence: what was found in the data.] This analysis should not proceed without addressing this issue. Results produced under this violation are not trustworthy. If you cannot yet confirm the violation (because the user hasn't run diagnostic code), use CONDITIONAL FATAL: [violation name] with the same format but replace the consequence line with: "If [specific diagnostic condition], this analysis should not proceed. Run the diagnostic above and report the result before continuing." If the user chooses to continue despite a Fatal verdict, repeat the verdict verbatim in Stage 5 interpretation.

⚠️ Serious = Emit this block:

SERIOUS: [limitation name] [One sentence: what was found.] Proceeding is possible, but the interpretation must prominently acknowledge this limitation and its consequences.

Use only FATAL and SERIOUS severity labels. Do not invent additional tiers (Critical, Yellow, Minor, etc.). When in doubt, round UP to the next severity level.

Rationalization Shortcuts

ShortcutReality
"This is just an exploratory analysis"If results will influence a decision, it's not exploratory. Apply full rigor.
"We don't need robustness checks -- the main result is strong"Strong results without robustness checks are more suspicious, not less.
"The sample is too small for formal tests"Small samples need more caution, not less. Flag the limitation explicitly.
"There's no manipulation -- it's a natural cutoff"Run the density test (rddensity). Natural cutoffs can still be gamed.
"We can extrapolate the RDD effect to the full population"RDD estimates are local to the cutoff. Say so.
"Default bandwidth is fine"Report sensitivity to bandwidth choice. One bandwidth = one fragile result.

Stage 5: Interpretation

Help write a plain-language summary:

"Based on the regression discontinuity analysis:

  • The estimated treatment effect at the cutoff is [coefficient] (95% robust CI: [lower, upper]).
  • The bandwidth used was [h], including observations within [h] units of the cutoff.
  • This means [plain-language interpretation in their specific context].

Local interpretation: This effect applies to units near the cutoff ([running variable] close to [cutoff value]), not the full population. Units far from the cutoff may experience different effects.

Density test (Cattaneo, Jansson, and Ma 2020):

  • [Result of density test — 'No evidence of manipulation' or 'Warning: density discontinuity detected']

Caveats:

  • [Manipulation concerns from Stage 2]
  • [Compound treatment concerns]
  • [Limited external validity — this is a local estimate]
  • [Sample size near cutoff]"

Reading Your Results

Density test (Cattaneo, Jansson, and Ma 2020): If the test rejects: "There are suspiciously more (or fewer) units just above or below the cutoff. This suggests people can manipulate their score to land on the preferred side, which breaks the 'as-if random' logic of RDD. The estimate is not credible without addressing this." If it passes: "No evidence of manipulation at the cutoff. Units on either side appear comparable."

Bandwidth choice: "The bandwidth of [h] means you're using units within [h] of the cutoff. Narrower = less bias (tighter local comparison) but more variance (fewer observations). The robust confidence interval accounts for this tradeoff. If results change dramatically across bandwidths, the estimate is fragile."

Local interpretation: "This effect applies only to units near the cutoff — not the entire population. If you're deciding whether to change a policy that affects everyone, consider whether the effect at the margin generalizes to units far from the cutoff."

Covariate smoothness: If any covariate shows a discontinuity at the cutoff: "This covariate jumps at the cutoff, which shouldn't happen if assignment near the cutoff is as-if random. Either there's manipulation, or there's a compound treatment — something else changes at the same cutoff."

Saving Output

Save alongside the plan (or create a new directory if standalone):

docs/causal-plans/YYYY-MM-DD-<project>/
├── plan.md              # From planner (or created here if standalone)
├── implementation.md    # This skill's stage-by-stage summary
└── analysis.[R|py]      # Generated code

Use the Write tool. Tell the user where files are saved.

Handoff

"Your RDD analysis is complete. Recommended next steps:

  1. Audit: /causal-auditor to stress-test for threats to validity.
  2. Refine: If manipulation or compound treatments were concerning, we can discuss mitigations.
  3. Report: I can help write up findings for a non-technical audience."

Common Issues

  • Manipulation of the running variable: If units can precisely control their position relative to the cutoff, RDD is invalid. Run the density test (rddensity) before proceeding.
  • Bandwidth too wide: Large bandwidths increase bias. Always report results across multiple bandwidths and use MSE-optimal selection from rdrobust.
  • Covariate discontinuities: If covariates jump at the cutoff, there may be compound treatments. Check covariate balance at the threshold.

Integration

Before this skill:

  • /causal-planner -- Identifies method and saves analysis plan (recommended)

After this skill:

  • /causal-auditor -- Stress-test results for threats to validity (recommended)
  • /causal-exercises -- Practice a similar analysis on simulated data (optional)

If assumptions fail:

  • /causal-iv -- If cutoff is fuzzy and instrument framing works
  • /causal-did -- If pre/post data and a control group exist

Self-Correction

If the user corrects you, append to references/lessons.md:

### RDD: [Short description]
**Trigger**: [When this tends to happen]
**Mistake**: [What went wrong]
**Rule**: [What to do instead]
**Source**: User correction, [date]

Frequently asked questions

What does the Causal Rdd AI skill do?

Implements sharp and fuzzy regression discontinuity designs in R or Python with bandwidth selection, manipulation testing, and sensitivity analysis. Use when user mentions RDD, cutoff, threshold, running variable, or discontinuity. Not for arbitrary subgroup comparisons.

Why use Causal Rdd on TypingMind?

Because you install it once and use it with any model. Causal Rdd is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Causal Rdd in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/RobsonTigre/everyday-causal-skills/tree/main/skills/causal-rdd. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Causal Rdd?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Causal Rdd?

As many as you like. As long as a model supports skills, you can use Causal Rdd with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Causal Rdd AI skill free?

Yes. It is published on GitHub by RobsonTigre under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇