data-preparation

A set of guidelines for building the dataset used by an analysis in Python, R, or Julia. It covers importing, cleaning, combining, deduplicating, and reconciling data while recording important decisions.

In plain words
What is it for?
Use it to clean messy files, merge several sources, build a panel dataset—a table tracking entities over time—remove duplicates, handle missing values, and reconcile totals.
Why use it?
Data cleaning can silently change which records are included or how values are combined, producing a wrong result even when the code runs successfully. These guidelines make those choices visible and checkable.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/lancegui/causal-powers/data-preparation
Any agent
npx skills add lancegui/causal-powers --skill data-preparation
Clone the repo
git clone --depth 1 https://github.com/lancegui/causal-powers

Made for: Claude Code, Codex.

Per session 201 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,309 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00201 $0.03309
Opus 5 $0.00101 $0.01655
Sonnet 5 $0.00040 $0.00662
Haiku 4.5 $0.00020 $0.00331

Measured 2d ago against content hash 9a317c9c04e4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

data-preparation 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 2d 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.

skills/data-preparation/SKILL.md · 138 lines

How it starts

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

Data Preparation

Overview

By the time you report a number, the riskiest decisions are already behind you — they were made while cleaning the data, and nobody wrote down why. A dropped duplicate, a collapsed category, a join that quietly fanned out, a missing-value rule chosen in a hurry: each one moves the eventual estimate, and none of them throws an error. The dangerous bug here is not the run that crashes. It's the clean run, on a cleaned dataset, that hands you a confident wrong answer because the sample was silently reshaped three steps before you ever fit a model.

This skill owns the data-ingest-and-cleaning phase — the heaviest, most decision-dense stretch of an analysis — reached from executing-analysis-plans' spine step 1 (build / clean / join the dataset), which delegates here. When the clean, validated dataset is built, control returns to executing-analysis-plans for variable construction → primary spec → robustness → verification.

Core principle: Cleaning is analysis, not pre-analysis. Plan it, checkbox it, and record why for every consequential choice — because the decisions that reshape the sample are made here, and a sample you reshaped without a written reason is a result you can't defend.

Doer/planner, not checker — the boundary with data-contracts

These two skills are complementary and must never compete:

  • data-contracts is the CHECKER. It asserts invariants — join cardinality, row counts, ranges, totals that reconcile — and freezes validated baselines. It fires on "I'm about to trust a number / do a join."
  • data-preparation is the DOER and PLANNER for the cleaning phase. It decomposes ingest → clean → join → dedup → recode → reconcile into a phased, checkboxed, resumable plan with a decisions log. It fires on "clean / build / assemble the dataset."

The doer uses the checker: this skill decides what cleaning steps happen, in what order, and why, then calls data-contracts to validate every step — cardinality asserted before each join and reconciled after, every recode range/category-checked, every aggregation reconciled to the known whole. You do not hand-roll validation here; you sequence the work and let data-contracts decide whether each step is trustworthy. Neither does the other's job.

Read the full file on GitHub · 138 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 2d ago First seen · 138 lines · 201 tokens per session scan A 9a317c9c04e4

Subscribe to this mod's changes

data-preparation is a skill published in the GitHub repository lancegui/causal-powers (2 stars, last pushed 8d ago), licensed MIT. It adds 201 tokens to every session and 3,309 once invoked, about $0.0010 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-31.

Related

Other skills, from other repositories

audit-reproducibility

Enforce the replication-protocol.md rule by cross-checking numeric claims in a manuscript against the actual R / Stata / Python outputs. Report PASS/FAIL per claim against tolerance thresholds. Use before submission and before releasing a replication package.

pedrohcgs/claude-code-my-workflow · 54 tokens

diagnose

Root-cause a failing or wrong empirical result with a disciplined reproduce → minimise → hypothesise → instrument → fix loop, instead of guessing-and-poking. Use when the user says "why is my regression wrong", "this number changed", "my script errors out", "the result won't reproduce", "debug this", "this estimate…

pedrohcgs/claude-code-my-workflow · 145 tokens

capture-environment

Snapshot the computational environment for a replication package — detects the analysis stack (R / Stata / Python) and emits the right lockfiles (renv.lock + sessionInfo.txt, requirements.txt / environment.yml / uv.lock, Stata version + ado package list), records seeds and RNG kind, optionally writes a pinning…

pedrohcgs/claude-code-my-workflow · 139 tokens

checkpoint

Save a structured state snapshot before stopping or handing off. Captures the active plan, recent decisions, file pointers (with line numbers), open questions, and the next 1–3 actions into a checkpoint file under qualityreports/checkpoints/. Optionally proposes [LEARN] entries to add to MEMORY.md. Use when user says…

pedrohcgs/claude-code-my-workflow · 124 tokens

coauthor-brief

Generate a co-author / collaborator handoff brief for a multi-author, multi-machine project — summarizing what changed since the last brief (git delta), the current state of each artifact (manuscript, analysis, slides), open questions, how to reproduce locally, and any restricted-data access steps. Use when user says…

pedrohcgs/claude-code-my-workflow · 146 tokens

data-management-plan

Draft a funder-compliant Data Management Plan (NSF DMP, NIH DMS Policy 2023, ERC, Horizon Europe) by composing the confidential-data and environment-capture primitives. Sections cover data description, formats/metadata, storage/backup, access/sharing, preservation/archiving, and roles. Use when user says "data…

pedrohcgs/claude-code-my-workflow · 143 tokens