/cairn:designfrom cairn
Use 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.
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.
Take "I want to track …" — one thing, or everything a project needs — to built, checked collections: previewed at every step, built only on an explicit yes. Draft fast and let the user react to visible things; never interrogate. Reserve questions for what you genuinely cannot infer: who sees what, whether entries need approval.
Size the ask first. One kind of thing → the short path: draft → preview → agree → build & check, four beats, no itinerary, no map, no breadcrumbs. Several kinds of things (or attachments implying them) → the project path. If intake changes the size, switch paths and say so. Ceremony is earned by scale, never applied by default.
Nothing that writes (`create_collection`, `commit_xlsform_import`, `set_permissions`, `update_data_schema`) is called until the plan has been shown in this conversation and the user explicitly said yes — for the project path, the complete re-rendered plan and one explicit go. Permission changes each need their own yes, at every size. No example record is ever saved — checks go through `dry_run_create_records` only.name (lowercase, ≤ 63 chars) + human title. Never add an id field; the uuid primary key is automatic.render_collection_form with { dataSchema, uiSchema } — an unsaved draft, nothing is created. Iterate on the preview; offer extras as questions the user accepts or declines ("want a photo field? should the date be required?") — never bake them in unasked.create_collection with the agreed { name, title, dataSchema, uiSchema }. Creating requires project-admin; a permission error is reported plainly.ingest) · open it in the Cairn app.Open by showing the itinerary; keep a one-line breadcrumb on every message (e.g. "Setup 3/5 — the case form"). Every message ends with the step's refreshed visual and exactly one question. Off-path requests go to a visible after-setup list — acknowledge, park, return; hand them off at the end (ingest for imports, explore for questions, the Cairn app for the rest).
list_collections, and get_data_schema for anything the plan may link to.create_collection with kind: 'member_profile', at most one per project); its fields then power permissions via _profile.Who may see/create/edit/delete records — and whether new entries need review — is six CEL predicates on the collection (get_guide('permissions') explains the model). Authoring is admin-only and gated:
get_permissions first — never propose a change blind; new collections already default update_when/delete_when to created_by == _user (authors touch only their own records), so say that instead of re-setting it.validate_cel_expression (target permission; target read-floor for read_when/approval_granted_when) before it appears in any plan.set_permissions only on its own explicit yes. Flag plainly when a change widens access (clearing update_when/delete_when lets any member touch any record) and that changing read_when/approval_granted_when makes affected members fully resync the collection.For each created collection, synthesize a few realistic rows from the use case and run dry_run_create_records — including rows that must be REJECTED: a missing required field, an out-of-list value, a constraint violation. Green means "accepts what it should, refuses what it shouldn't, zero rows written." Show a failure as a failure; fix the schema or ask — never shrug it off. Checks across collections can run in parallel.
"If X, also ask Y" (e.g. if seen in a nest → habitat fields) is authored directly in the uiSchema — add a rule to each dependent Control. No separate tool, no editor-mode switch needed at creation:
{ "type": "Control", "scope": "#/properties/habitat_type",
"rule": { "effect": "HIDE", "condition": { "expression": "in_nest != true" } } }
render_collection_form validates the rule. Rules are equally editable later in the app's Schema and Form editor — there is one collection editor, with no mode to switch into.
A triage or classification flow — eligibility screening, intake triage, risk tiering — is authored as a Conditional element in the uiSchema: an if / elif / else block whose branches are groups of controls, driven by Cairn-extended CEL. It is a step up from skip-logic above — a rule hides one field, a Conditional routes the form down a whole branch — and it drives toward an outcome. Recommend one when the user describes a branching triage, screening, or classification protocol.
classification field to the dataSchema — a oneOf/select of the possible results (eligible / needs review / not eligible). v1 convention: the tree leads the user to this field (shown in the terminal branch, or pre-set with x-default); there is no dedicated outcome tool yet.Conditionals to build the tree; each branch has a CEL when plus its own elements, and the final else branch omits when. compareWith lets every branch switch on one field — a classic classification switch.{ "type": "Conditional", "branches": [
{ "when": "has_dependents.value == 'yes' && monthly_income < 200",
"elements": [ { "type": "Control", "scope": "#/properties/support_tier" } ] },
{ "elements": [ { "type": "Control", "scope": "#/properties/classification" } ] } ] }
render_collection_form validates the structure (validate_ui_schema blesses the branch semantics). Then point the user to the Decision tree view in the Cairn app — the form editor's Decision tree button opens the branching as a flow chart — so they can confirm it routes where they expect; the graph is the fastest way to spot a wrong branch. That view is read-only: author and refine the tree here (or in the app's builder), and use the graph to check it.Keep the CEL honest: branch whens are Cairn-extended CEL over the record's fields (compare a select with .value); pre-flight anything non-trivial with validate_cel_expression. Deep trees are fine — but if the user starts iterating heavily on the flow itself, hand off to the in-app Decision tree view rather than re-emitting the whole uiSchema each round.
When the respondent must put a fixed list of options into order (rank barriers by priority; preferences most→least), author a full-permutation array in the dataSchema and pick the reorder widget in the uiSchema — there is no x-rank marker, the ui-format is the signal:
// dataSchema property
{ "type": "array",
"items": { "type": "string", "oneOf": [
{ "const": "cost", "title": "Cost" },
{ "const": "distance", "title": "Distance" } ] },
"uniqueItems": true, "minItems": 2, "maxItems": 2 }
// uiSchema Control — options.format:'rank' picks the drag-to-reorder widget
{ "type": "Control", "scope": "#/properties/priorities", "options": { "format": "rank" } }
minItems/maxItems equal the option count (the answer is a complete ordering). Without options.format: 'rank' the same data renders as a multi-select.
An uploaded XLSForm is a collection draft — never retype it by hand.
import_xlsform (with the uploaded file's id) returns { dataSchema, uiSchema, summary }, skip-logic already translated to CEL rules. status: "blocked" lists constructs Cairn doesn't support yet (with tracking issues) and yields no partial schema; status: "invalid" is a malformed workbook — report either plainly, don't paper over it.render_collection_form on the draft, then the gate as usual. A cascading select (choice_filter) also returns a plan of hierarchy-tree collections — say that the import will create those alongside the form.plan → commit_xlsform_import, passing the draft's dataSchema, uiSchema, and plan back verbatim (it builds the tree collection(s) + the form's leveled reference). No plan → plain create_collection. Then run the checks.Rule conditions and x-constraints use Cairn-extended CEL: reference field names directly; select/oneOf fields resolve to { value, name }, so compare .value (e.g. status.value == 'draft'); geo/temporal helpers exist (point.inside(), point.distanceTo(point)). Before committing any non-trivial expression, read the collection's celContext and check it with validate_cel_expression — don't guess signatures. There is more on offer than equality checks — date windows, geo fences, tree relations, profile-gated rules, device-location capture (a Point field can default to the current position with x-default: _location), line geometry (a LineString field captures a drawn route or boundary; line.length() reads its length) — get_guide('cel') lists the full catalog with worked idioms; mention the fitting ones when the use case calls for them.
Every statement about the project's current state comes from a fresh read at that moment — on entry, before the gate, before executing, on resume. The conversation holds the plan; only tools know the project. Resuming (days later, or after a partial failure) means: re-read, reprint the itinerary with done/remaining, continue from what actually exists. There is no rollback — a partial build is reported as exactly that, with the resume point.
Reads, validations, previews, and dry-run checks: fan out in parallel freely. Writes: strictly one at a time, in link order. If it can change data, it waits its turn.
| Thought | Reality |
|---|---|
| "They're in a hurry — I'll skip the preview this round." | The preview is the product. Never skip it. |
| "It's just one collection — the checks don't apply." | The green bar applies at every size. |
| "This register photo clearly implies six collections." | Propose the minimum; the rest goes on the after-setup list. |
| "They said 'looks good' about the map — that covers building." | The go gate is its own explicit question, always. |
| "One rejection check failed, but it's probably fine." | Red is red. Show it, then fix or ask. |
| "I remember what this project contains." | Memory holds the plan; list_collections holds the project. |
| "They asked about imports — I'll just do that quickly." | Park it on the after-setup list and return to the step. |
evolve's job; observations about existing collections go to the after-setup list.ingest's job), answering data questions (explore's job), approving pending entries (review's job).id field.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
/designing-tdd-ingestUse 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./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.