/cairn:designing-tdd-ingestfrom cairn
Use when a Cairn user wants to load data they need to *trust* — a recurring or pipeline-fed import where correctness must be checked, not assumed. Phrasings like "make sure the import is right / the totals should match / verify these loaded correctly / this runs every week / import from my pipeline and check it / did anything get dropped". Adds an assertion-first discipline — state the expected counts, coverage, categories, and shape *before* loading, then dry-run, verify, land, and re-verify — on top of a plain import. For a one-off paste-and-go load with no correctness to prove, use `ingest` instead.
Ships in cairn. 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.
None: SKILL.md is the whole skill.
State what a good load looks like before you touch the data, then let the tools prove it. The win is trust in a repeatable load, not speed: a pipeline breaks in slow, quiet ways — a column gets renamed upstream, a code list is truncated, coordinates flip lat/long, row counts drift, a re-run double-inserts. The remedy is TDD's: write the test first, then make it green.
This skill owns assert → dry-run → verify → land → re-verify. It does not own getting the rows (that's your own pipeline/tool stack) or the mechanics of shaping rows to the schema (that's the ingest skill — lean on it, don't re-teach it).
case_id."classification is only ever none / some / severe" (no new or misspelled categories).ingest skill's job. get_data_schema, exact field names, a select value is its const, omit x-calculation, resolve x-references by lookup, rows are { id, data }. The one addition here: set a deterministic id per row, derived from the row's natural key (e.g. a hash of case_id) so the load is idempotent and a re-run is detectable.dry_run_create_records writes nothing and returns counts plus per-row validation_error / duplicate. Check row-count, per-row validity, and dry-run duplicates against your assertions now. On a failed assertion or an ambiguous value (e.g. a moderate where the schema allows only none/some/severe), stop and surface it — propose a fix or escalate. Never coerce or drop a row to make an assertion pass.bulk_create_records with the same rows and ids you dry-ran. There is no separate "batch" tool: a moderated collection routes new rows to its review queue automatically via create_when — that is the moderation path.explore surface):
aggregate_records (group-by + counts). Render a category breakdown as horizontal bars, largest-first — not a pie.query_records projecting the point field with explicit fields; check the bounds.query_records the business key (e.g. case_id) and look for collisions.query_records / aggregate_records until approved — reads return only official rows. Don't read an empty result as a failed load: re-verify after review, or check list_pending_reviews.
Report each assertion green/red with its number. A red assertion after landing is a finding, not a formatting choice — say so plainly.A "run" is one batch you can re-execute safely; the idempotency assertion is that a second run lands zero net-new rows. The trap that breaks it:
dry_run_create_records's duplicate status keys on the row id, not on any x-unique business key. So a stable, deterministic id per row (step 2) is what makes a re-run report priors as duplicate instead of double-inserting.case_id but a fresh id reads as ok in the dry-run and collides only at insert — so when re-loading against existing data, query_records the business key first.create_batch / lineage / register_ingest_source tool — none is exposed; land with bulk_create_records, moderate with create_when.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub platyplus/cairn-plugin --plugin cairn7 skills in this plugin
/designUse when a Cairn user wants to start tracking something — one thing or a whole project. Phrasings like "I want to track / collect / register / make a form for X", or "set up my project / we need to track several things / here's our paper system". Covers a single new collection, a multi-collection setup with links and permissions, and adding collections to an existing project. Not for loading data (ingest), answering data questions (explore), or restructuring existing collections./evolveUse when a Cairn user wants to change or remove something that already exists — phrasings like "add a field / rename a column / change the type / make it required or unique / change who can see or edit records / add skip-logic to the form / delete this record / delete the collection". For creating new collections, use design instead./exploreUse when a Cairn user asks a question about the data already in a collection — phrasings like "how many / which / show me / top N / trend over time / breakdown by ..." — answered as a table or an aggregation (counts, group-by, time trend)./getting-startedUse the first time a Cairn user arrives — phrasings like "hi / how do I start / get started / show me how Cairn works / what can this do", or any opening message when the user's workspace has no collections yet and they haven't named something specific to do. Welcomes a newcomer and walks them through a two-minute example end to end./ingestUse when a Cairn user wants to load a batch of existing records into a collection that already exists — phrasings like "import these / load this data / add these rows / bulk upload" (rows pasted, generated, or from a file)./reviewUse when a Cairn user wants to handle work awaiting approval — phrasings like "what's waiting for me / anything to review / approve these / check the pending entries". Working through a moderated collection's pending queue — approving or rejecting records and edits.