/workflows:ds the dataset, analysis, or data pipeline to buildfrom workflows
Orchestrates empirical data tasks (analysis, merging, regression, profiling, cleaning, ETL) through a structured clarify/plan/dispatch/human-review lifecycle with automated data-quality verification.
Ships in workflows. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
work with a computed data-quality gateWhat this skill carries — grep references/ for any subject the names below miss:
!d=${CLAUDE_SKILL_DIR}; command -v skill-toc >/dev/null 2>&1 && exec skill-toc "$d"; s=$HOME/.claude/skills/plugin-utils/bin/skill-toc; [ -x "$s" ] && exec "$s" "$d"; echo "(skill-toc unavailable: references and scripts are NOT listed here — install the plugin-utils plugin, or start a new session so its bin/ reaches PATH)"
DS constraints in force — every rule scoped to this workflow, discovered from the corpus so a new one needs no edit here; read the ones your task touches:
!c=${CLAUDE_PLUGIN_ROOT}/scripts/load-constraints; [ -x "$c" ] && exec "$c" ds; echo "(constraint index unavailable: NO DS rule is listed here — the four aggregates under skills/ds/rules/ are not the whole set)"
The lifecycle is work. Read it and follow it.
This file is a delta: it supplies the domain — the CLARIFY axes, the plan grammar, the lens,
the mechanical checks, the refs, the authority text. It ships no workflow.js and restates none of
work's mechanics.
What makes a run ds rather than plain work is one thing: every declared data output is verified
by a computed runner, not by the agent that produced it. checks/ds/constraints/ds-dq.py reads the approved
plan's ## Data Outputs table and opens each artifact itself; work's JS reads its exit code.
Main chat clarifies, plans and dispatches. It does not do the analysis, and it never writes a .py,
.ipynb, .R, .sas, .sql or .qmd file — not by Write/Edit, and not by Bash (python3 -c,
pixi run python, inline pandas/numpy). Analysis runs in a dispatched agent. work's dispatch is
already structural and its judges are pinned to Explore, so this line is a rule on you, not a hook;
reach for the workflow first rather than after a refusal.
work's Phase 1, on these axes.
Loading a dataset or proposing a method before the user has stated the outcome anchors the work to whatever data happens to be nearby. Skipping a necessary profile replaces evidence with a convenient guess. Neither shortcut is helpful: it creates an analysis that is fast to start and expensive to correct.
| Axis | Establish with the user |
|---|---|
| Outcome | Question, audience, decision the analysis informs, and deliverables |
| Universe | Unit of observation, entity inclusion rule, sample period, and authoritative source when sources disagree |
| Sources | Available data, access/location, expected refresh/vintage, and known restrictions |
| Constraints | Replication target, required methods, deadline, compute/cost limits, and reproducibility needs |
| Evidence | What makes each planned output credible: a check, an inspectable exhibit, a source comparison, or user judgment |
Ask in one AskUserQuestion call when answers are independent. Ask cascading questions separately:
a source choice that determines available variables must be answered before variable questions.
Three facts decide these axes, and each prevents a defect that is expensive to find later:
TBD (<phase>) convention is
legitimate only when profiling is the scheduled evidence-producing phase; never invent coverage.work's remaining axes are taken as work states them, with two domain bindings: work axis 4
(observable success criteria) is answered with the DQ runner over the plan's ## Data Outputs plus
the target project's own test and lint commands, and those strings become the --test-cmd / --lint-cmd arguments of the single ds mechanical entry (Phase 4); work axis 5 (review surface) is answered by the plan's
## Review Surfaces section. The ds-dq entry is never conditional. CLARIFY records, for each of test and lint, either the
project's command or an explicit "none" — an unanswered one is a refusal (check.sh exits 2), never
a leg that ran nothing. A "none" becomes --no-test-cmd / --no-lint-cmd; work's probe runs a
cmd verbatim, so never leave a placeholder in it.
Then gather planning evidence — a read-only profile, never implementation. For each source that materially affects the plan, collect or dispatch a profile covering: location/access, approximate shape, columns/types, date coverage, and likely row grain/key; nulls, duplicates, type drift, category/distribution anomalies, and likely join risks; raw size and whether source-side filtering, caching, partitioning, or server-side computation is needed; and a small representative sample only when access and project policy permit it. Use direct read-only inspection for one small local source; for independent sources, dispatch read-only profilers in parallel and consolidate. Do not make a profiling agent implement a pipeline, mutate project files, or spawn further agents. Do not pull a full source merely to estimate it. If an answer depends on implementation, state it as a planned evidence task rather than pretending the profile established it.
Four discovery rules run in this same planning step, each governed by its own constraint file:
${CLAUDE_PLUGIN_ROOT}/rules/ds-pull-sizing-decision.md and follow it. The
profile must compare filtered raw and candidate aggregate/server-side paths before planning commits
to one. Do not pull a full source merely to estimate it.${CLAUDE_PLUGIN_ROOT}/rules/ds-external-skill-decision.md and follow it.
Record the resulting ADOPT, PATCH, or GREENFIELD decision in the plan itself.${CLAUDE_PLUGIN_ROOT}/rules/ds-master-datasets.md. Plan the minimal
canonical analysis dataset(s), their grain and keys, and which planned outputs consume each one.${CLAUDE_PLUGIN_ROOT}/rules/ds-parameter-transparency.md; name one
configuration location, rationale, and treatment of convenience choices in the plan.work's Phase 2. The plan opens with frontmatter workflow: ds — required, so a context clear at
approval resumes here and not in work.
Five domain requirements on the plan:
The source/access strategy and the profile-derived risks. The plan states how each source is reached, and the data-quality and scale risks the read-only profile actually surfaced. A risk found at CLARIFY that reaches no plan section is a risk nothing acts on.
Reproducibility decisions, appropriate to the work: source vintages, seeds, environments and
config. R1 (fresh re-run reproducibility) is computed when the project has a replay command: put a
line Replay command: <cmd> in the plan (or ship manifest/inputs.csv with a replay.sh/replay.py
beside it) and check.sh's ds-replay leg runs it and reads the exit code. With none, the leg reports
R1 FINDING: no replay command and the lens judges R1 against what the plan recorded.
A ## Data Outputs table, in exactly this grammar, because checks/ds/constraints/ds-dq.py parses it and an
output absent from it is one nothing will check:
## Data Outputs
| Path | Grain | Key Columns | Required Window |
|---|---|---|---|
| data/processed/panel.parquet | one row per firm-fiscal-year | pk: gvkey, fyear; event: gvkey, datadate | datadate: 2005-01-01..2025-12-31 |
| data/processed/industry_xwalk.csv | one row per SIC code | sic | n/a |
.parquet, .csv, or .tsv;
one row per artifact the plan promises to produce.DQ3 verifies rather than
assumes.DQ3a tests for uniqueness. Write a, b for a bare
primary key, or pk: a, b; event: c, d to also declare the coarser business/event key DQ3c
needs to catch amendments and restatements. Without an event: clause DQ3c reports N/A, and
the runner says why. Add constant: c (one repeated non-null value, e.g. paper in a per-paper
file) to exempt that column from DQ1; an all-null column still fails.COV checks, as [column: ]YYYY-MM-DD..YYYY-MM-DD.
Write n/a for an unwindowed output; COV then reports N/A with that as its reason. Naming
the column is optional only when exactly one date column exists; an ambiguous window is a FAIL,
not a pass.A ## Review Surfaces section naming the concrete tables, figures, notebook exports,
diagnostics, or decisions the user will inspect during human review.
refs on every task row and on the lens — required, may be empty. work's spine does not validate it;
wc-probe P7 refuses an absent key in THIS file, so a live run assembled from an approved plan is
unchecked. Write refs: [] to state "no domain rules" rather than omitting the key.
Batch extraction strategy. A task whose work is per-document LLM coding or extraction is a task that LAUNCHES a batch job on pre-cut excerpts, provider picked by batch-router (with a 1-request synchronous test first). It is never an agent reading the documents. Dual-class share status of a 10-K is already built: ${CLAUDE_PLUGIN_ROOT}/skills/wrds/scripts/dual_class/ (extractor + gated classifier; ${CLAUDE_PLUGIN_ROOT}/skills/wrds/references/dual-class.md).
work's Phase 3 unchanged.
The args go in the plan's <!-- work:dispatch --> arming block, and the dispatch is work's own
work-dispatch.sh — never a hand-written runner line. That script owns the TIER 1 plan-lint
gate, which refuses to dispatch on a major/critical plan finding and fails CLOSED on a verdict it
cannot count; hand-rolling the invocation silently drops it. work owns the wait, the result handling
and the return shape too, and work-result.sh reads the verdict. This run's projectDir is the
session repo, so work's own run directory is already inside it and no --run-dir override applies.
There is no built-in Workflow call — the guard at
~/.claude/hooks/main-thread-guard.sh denies that tool outright.
bash ${CLAUDE_PLUGIN_ROOT}/skills/work/scripts/work-dispatch.sh # armed plan; or pass one
bash ${CLAUDE_PLUGIN_ROOT}/skills/work/scripts/work-dispatch.sh --provider codex # "run this through codex"
Forward the provider. A provider named in this skill's $ARGUMENTS, however it is spelled —
--provider codex, --dispatch codex, "run this on gpt" — is --provider codex on the line
above. --provider is the only spelling the scripts take, and both reject the others by name.
Omitting it silently runs the user's codex request on claude.
const goal = /* one sentence */
const planPath = /* the approved plan's path */
// shq single-quotes a command so quotes and $ reach check.sh intact.
const shq = s => `'${s.replaceAll("'", `'\\''`)}'`
const testCmd = /* the project's test command, or null when CLARIFY recorded "none" */
const lintCmd = /* the project's lint command, or null when CLARIFY recorded "none" */
const args = {
projectDir,
goal,
// The plan's table verbatim. Every task carries refs, empty or not. The four constraint
// aggregates are UNCONDITIONAL — every implementation task carries all four, alongside
// whichever vendored references that task's own work needs.
tasks: [
{ id: "T1",
name: "<data pull or pipeline task>",
work: "<what to build>",
writablePaths: ["<narrow>"],
acceptance: "<the criterion the verifier checks>",
refs: ["${CLAUDE_PLUGIN_ROOT}/skills/ds/rules/ds-common-constraints.md",
"${CLAUDE_PLUGIN_ROOT}/skills/ds/rules/ds-common-conventions.md",
"${CLAUDE_PLUGIN_ROOT}/skills/ds/rules/ds-analysis-constraints.md",
"${CLAUDE_PLUGIN_ROOT}/skills/ds/rules/ds-engineering-constraints.md",
"${CLAUDE_PLUGIN_ROOT}/skills/ds/references/etl-enforcement.md",
"${CLAUDE_PLUGIN_ROOT}/skills/ds/references/sql-patterns.md"] },
{ id: "T2",
name: "<task whose acceptance is evidentiary>",
work: "<what to build>",
writablePaths: ["<narrow>"],
acceptance: "<the criterion the verifier checks>",
refs: ["${CLAUDE_PLUGIN_ROOT}/skills/ds/rules/ds-common-constraints.md",
"${CLAUDE_PLUGIN_ROOT}/skills/ds/rules/ds-common-conventions.md",
"${CLAUDE_PLUGIN_ROOT}/skills/ds/rules/ds-analysis-constraints.md",
"${CLAUDE_PLUGIN_ROOT}/skills/ds/rules/ds-engineering-constraints.md",
"${CLAUDE_PLUGIN_ROOT}/skills/ds/references/verification-patterns.md"] },
],
// The DS gate: the runner reads the approved plan's ## Data Outputs and opens each artifact
// itself. ds-dq is never conditional. tests and lint are the TARGET project's own commands,
// collected at CLARIFY: a command, or an explicit "none" that becomes --no-test-cmd / --no-lint-cmd.
// ONE entry point: a list of N independent commands loses one silently. The project's own test and
// lint commands are ARGUMENTS because this skill cannot know them — omit both a command and its
// opt-out and check.sh exits 2.
mechanicalChecks: [
{ name: "ds",
cmd: `bash ${CLAUDE_PLUGIN_ROOT}/skills/ds/scripts/check.sh --plan ${planPath} --project-dir ${projectDir}${testCmd ? ` --test-cmd ${shq(testCmd)}` : ' --no-test-cmd'}${lintCmd ? ` --lint-cmd ${shq(lintCmd)}` : ' --no-lint-cmd'}` },
],
// check.sh runs every checks/ds/constraints/ script through `workflow-check ds --constraints-only`. work-checks.sh runs ruleChecks as a command (no agent); the ds-replay leg runs the project's replay command for R1 (exit code decides; none = a finding for the lens); Jev scores the rules under checks/ds/rules/ (A1, A4, DEN, DQ4, DQ6, E7, M1, R1, UNI; DQ1 waits in checks/ds/rules/uncalibrated/ and ds-dq.py decides it); a rule with p >= 0.85 lands in rulesThatFailed and blocks, lower ones reach the lens as a ranked checklist.
ruleChecks: { name: "jev-rules", cmd: `bun ${CLAUDE_PLUGIN_ROOT}/skills/work/scripts/rule-check.ts --workflow ds --project-dir ${projectDir} --plan ${planPath}` },
// One lens after verification and mechanical checks; its checklist covers all five dimensions.
//
// It does NOT pin Explore. Explore is a built-in agent with a PREDEFINED prompt that no preloaded
// skill reaches, and it skips the CLAUDE.md hierarchy — so a constraint-indexed judgement
// dispatched there is graded from memory of constraint ids it was never given. ds-reviewer's body
// is a file this repo controls, and it is read-only by tools allowlist AND by
// tests/agent-contract.test.mjs — the same structural property Explore is pinned for, in an agent
// whose prompt can be told what it is grading. The four aggregates are index tables in skills/ds/rules/ that point at the
// canonical bodies under ${CLAUDE_PLUGIN_ROOT}/rules/ and are not copies of them. They reach the lens as refs,
// with the rule bodies its checklist grades; ds-reviewer has no Skill tool, so refs are its only guaranteed route.
// Both texts live in ${CLAUDE_PLUGIN_ROOT}/skills/ds/presets.json, expanded at dispatch; an `extra` string on either carries plan-specific additions. The lens `refs` repeat the preset's so wc-probe P7 can resolve them; tests/agent-contract.test.mjs holds the two equal.
lens: { preset: "ds",
refs: ["${CLAUDE_PLUGIN_ROOT}/skills/ds/references/ds-checks.md",
"${CLAUDE_PLUGIN_ROOT}/skills/ds/references/verification-patterns.md",
"${CLAUDE_PLUGIN_ROOT}/skills/ds/rules/ds-common-constraints.md",
"${CLAUDE_PLUGIN_ROOT}/skills/ds/rules/ds-common-conventions.md",
"${CLAUDE_PLUGIN_ROOT}/skills/ds/rules/ds-analysis-constraints.md",
"${CLAUDE_PLUGIN_ROOT}/skills/ds/rules/ds-engineering-constraints.md",
"${CLAUDE_PLUGIN_ROOT}/rules/ds-se-matching.md",
"${CLAUDE_PLUGIN_ROOT}/rules/ds-join-diagnostics.md",
"${CLAUDE_PLUGIN_ROOT}/rules/ds-p-hacking-prevention.md",
"${CLAUDE_PLUGIN_ROOT}/rules/ds-sample-selection.md",
"${CLAUDE_PLUGIN_ROOT}/rules/ds-assumption-over-evidence.md",
"${CLAUDE_PLUGIN_ROOT}/rules/ds-failure-loudness.md",
"${CLAUDE_PLUGIN_ROOT}/rules/ds-nondeterminism-sources.md",
"${CLAUDE_PLUGIN_ROOT}/rules/ds-rerun-equivalence.md",
"${CLAUDE_PLUGIN_ROOT}/rules/ds-misleading-charts.md",
"${CLAUDE_PLUGIN_ROOT}/rules/ds-companion-figures.md",
"${CLAUDE_PLUGIN_ROOT}/rules/ds-sample-coverage.md",
"${CLAUDE_PLUGIN_ROOT}/rules/ds-pull-sizing-decision.md"] },
authorityExtra: { preset: "ds" },
implementerAgentType: "ds", // the doer's own prompt replaces Claude Code's software-engineering one, which frames a dataset as a codebase
verifierAgentType: "Explore",
}
implementerAgentType names ds because the default agent carries Claude Code's
software-engineering system prompt, and the deliverable here is a dataset, a table and a figure a
human reads — not a codebase. An agent is justified only by a custom prompt, hooks or preloaded
skills; ds earns it on the first alone — the constraint aggregates reach it as task refs, not as
a preloaded skill.
verifierAgentType pins Explore because it has no Edit and no Write: a judge that structurally
cannot modify the tree beats a prompt asking it not to. The lens buys the same property a different
way — ds-reviewer is read-only by tools allowlist — because Explore's prompt is predefined and no
preloaded skill or CLAUDE.md reaches it; the lens carries the four aggregates (the index) in its own refs and the rule bodies its checklist grades in the same refs. The lens returns schema-validated JSON through StructuredOutput, and the runner writes lens.json. The lens has no Bash, so it cannot re-run anything: a claim that needs a run is reported as unverified, never graded from the code.
Add ${CLAUDE_PLUGIN_ROOT}/skills/ds/references/competing-hypothesis.md to a task's refs when
that task is a diagnosis rather than a build. authorityExtra names it; refs is what makes an
implementer read it in full.
The runner's own contract suite, ${CLAUDE_PLUGIN_ROOT}/skills/ds/scripts/ds_dq_test.py, is the
ds-dq-tests leg of the one mechanicalChecks entry.
work's Phase 5 unchanged, over the plan's ## Review Surfaces. A clean technical verification is
evidence for that conversation, not human acceptance.
| Situation | Wrong move | Right move |
|---|---|---|
| Sizing a source | pull the whole thing to see how big it is | the transfer is the failure you are meant to prevent — profile filtered counts and aggregate candidates read-only |
| Profiling a source | treat a head sample as the profile | nulls, grain failures and type drift live outside the head — profile shape, tail/coverage, keys and quality signals |
| Naming a produced artifact | name it in prose | a runner given prose cannot open it, key it, or window it — add its row to ## Data Outputs before approval |
| The DQ result | let the implementer report it | the doer cannot see the assumption it made in both places — the runner is a mechanicalCheck and the JS reads its exit code |
M1/UNI/DEN/DEL/R1 | report them as PASS | that presents a judgement as a computation — Jev's verdicts decide M1, UNI, DEN and R1; DEL is MODEL-EVALUATED with the evidence read |
DQ4/DQ6 reported N/A | read the N/A as the runner having checked them | an N/A on a present output is not a third kind of pass (an absent one is FAIL) — the runner computes neither and an N/A never sets its non-zero exit; Jev's DQ4 and DQ6 verdicts decide them |
| Per-document LLM coding or extraction | fan out agents to read each document | launch a batch-router-picked batch job on pre-cut excerpts (with a 1-request synchronous test first) |
| A judgement that depends on the constraint index | dispatch a built-in agent (Explore, Plan, general-purpose) | their prompts are predefined, no preloaded skill reaches them and they skip the CLAUDE.md hierarchy, so the constraints are graded from memory — dispatch a custom agent whose body you control, like ds-reviewer |
| Handing a doer the constraint aggregates | name the four paths in the task prompt's prose, or copy the aggregates into a skill | prose is discretionary and a copy is a second source of truth tests/constraints-no-duplication.test.ts fails on — put the four canonical paths in the task's refs, which work defines as reads the doer owes in full |
| Project state | write a SPEC.md, STATE.md or LEARNINGS.md | competing state makes progress ambiguous — the approved plan is the authority and work hashes it |
Something work does not obviously do | write a ds/workflow.js | ask which work parameter is missing — mechanicalChecks is what makes the DQ runner the gate |
presets.json (opens in a new tab)references/competing-hypothesis.md (opens in a new tab)references/ds-checks.md (opens in a new tab)references/etl-enforcement.md (opens in a new tab)references/sql-patterns.md (opens in a new tab)references/verification-patterns.md (opens in a new tab)rules/ds-analysis-constraints.md (opens in a new tab)rules/ds-common-constraints.md (opens in a new tab)rules/ds-common-conventions.md (opens in a new tab)rules/ds-engineering-constraints.md (opens in a new tab)scripts/check.sh (opens in a new tab)scripts/ds_dq_test.py (opens in a new tab)scripts/ds_replay.py (opens in a new tab)scripts/ds_replay_test.py (opens in a new tab)scripts/ds_schema.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Claude Code refuses to install this plugin
As a github or url source: Failed to clone repository: fatal: clone of '[email protected]:edwinhu/bmll-skill.git' into submodule path 'skills/bmll' failed
Checked against Claude Code 2.1.332's install rules. The listing below is what the repository ships; Claude Code cannot install it as published.
86 skills in this plugin
/afkUse when the user says '/afk', 'afk', 'going to bed', 'I'm going to sleep', 'work autonomously', 'work on this overnight', 'don't ask me questions', 'while I'm away', or 'do whatever you think is best'. NOT for questions about overnight returns, rates or anything financial; NOT for asking how the mode works./ai-anti-patternsALWAYS load before finalizing ANY written prose, and whenever text is suspected of being machine-written - "does this sound like AI", "make this sound human", "clean up the AI-isms", "did a bot write this", "check this draft before I send it", "review this for AI tells", "this reads like ChatGPT", "review this for mannered prose", "is this too writerly", "is this student paper AI-generated", or before handing back any draft, memo, email, or article you wrote. Use proactively even if the user never mentions AI writing./batch-routerUse when the user says 'bulk LLM job', 'batch job', 'submit a batch job', 'run this prompt over all the documents', 'process thousands of PDFs', 'extract fields from every filing', 'code each filing', 'label / annotate these documents', 'hand-code these', 'have agents read each document', 'which batch provider', 'cheapest way to run this over N rows', 'spend my API credits', 'Claude or OpenAI or Gemini for this batch', or needs any per-row LLM extraction, classification or enrichment over many inputs./bib-manageALWAYS use when a manuscript's BIBLIOGRAPHY is the thing being fixed, or when a cite's PDF turns out to be wrong — 'link my bib entries to the PDFs', 'which sources am I missing a PDF for', 'audit my sources.bib', 'my bib entry has no file field', 'fetch the Federal Register PDFs', 'why can't pincite find this source'. WRONG FILE: 'is this PDF the published version or the preprint', 'this PDF is a book review, not the book', 'the file field points at the wrong paper', 'the PDF doesn't match the citation'. METADATA: 'reconcile my bib against Paperpile', 'these entries were extracted by a model, check them', 'fix the metadata in sources.bib', 'my bib has no DOIs and the fields look wrong', 'pull the real author/journal/volume from my library', 'where did this bib entry's metadata come from'. PAGE RANGES: 'does my bib have page ranges', 'my bib only has start pages', 'backfill the page ranges', 'pull the pages from the DOI', 'add DOIs to my bibliography'. Use proactively before any pincite run — pincite resolves footnotes through `file = {...}` and silently skips entries that lack one. NEGATIVE ROUTING: the page number inside a footnote is pincite, but whether that footnote's PDF is the version of record or the wrong document is THIS skill, mid-pincite-run included; whether a cited source says what the footnote claims is source-verify; Bluebook FORM is bluebook or bluebook-audit; finding or downloading a paper is fetch-paper or paperpile./blaw-edgar-searchUse when the user wants to search SEC filings or exhibits on Bloomberg Law — 'search EDGAR on Bloomberg Law', 'BLAW EDGAR search', 'find exhibits with this clause', 'which 8-Ks attach a consulting agreement', 'pull the Bloomberg Law results list', 'capture the BLAW results' — or needs exhibit-level phrase search with proximity operators that the SEC and WRDS full-text routes handle badly./bluebookALWAYS use for ANY legal citation question, even if the user never says 'Bluebook' - 'cite this case', 'how do I cite a statute', 'is this footnote formatted right', 'id. or supra here', 'cite a law review article', 'what signal goes here', 'format these footnotes', 'short form for this cite', 'block quote this', 'where does the ellipsis go', 'is this quote altered right', or writing or checking any citation or quotation in a legal manuscript. NOT for auditing a whole manuscript's footnotes (use bluebook-audit) and NOT for rendering these rules in Typst (use docx-typst).Other plugins' skills for the same job