Router for the Nucleus pattern: a spec-anchored, approximately verifiable data-modeling monorepo where Lean 4 is the structural source of truth. Use when standing up or operating a Nucleus instance, wiring module/check layout, or applying Lean/LinkML/Arrow boundaries.
Ships in formal-specification-and-refinement. 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.
Nucleus is a spec-anchored, approximately-verifiable data-modeling and computational-science monorepo pattern. Lean 4 holds the structural source of truth outright, and the platform's central operation instantiates that spec into a polyglot stack, reconstructs the spec from those realizations, and validates that the round trip is an approximate identity. This skill is a thin router: it names the Nucleus instance of each general pattern and the handful of Nucleus-only rules, then delegates the how to the owning sibling skill by bare name. It restates nothing those siblings teach.
In one breath: Lean is the structural source of truth; the domain algebra goes Lean-direct to Expression unions and Rust enums; table schemas may stay a LinkML skeleton with an orthogonal semantic overlay; Arrow is the single physical oracle; the directory layout is the operator ◯ = R ∘ L written out, and modules/checks/*.nix is the approximate R that measures structural holonomy.
This skill fires for Nucleus-specific decisions. Standing up a new instance; orienting in an existing one (which directory holds what, the build order); placing a component in a maturity tier and reading its promotion trigger; the ODPS scope rule; authoring or maintaining the Lean-to-LinkML skeleton projection; wiring the module layout; the Arrow single-oracle invariant; and the deliberate frozen-stack exclusions all belong here.
It does not fire for the general technique behind any of those steps; delegate the how to the bare-named sibling that owns it:
This skill must not fire as a generic build-a-data-platform skill, nor as agent or subagent orchestration.
The central operation is ◯ = R ∘ L. L (the forward instantiation leg, named Descent) lowers the spec into a polyglot data-engineering, modeling, and web-application stack. R reconstructs the spec from those realizations and validates approximate identity. An artifact is verified exactly when it is a fixed point of ◯, that is, when the unit η_S : S → R(L(S)) is an equivalence to tolerance. The residual failure of η_S to be an equivalence is the holonomy, the structural drift the platform measures and drives down; progress is the monotone decrease of that residual, each step carrying an interpretable certificate. The name is mathematical, not biological: ◯ is a Lawvere-Tierney nucleus, an idempotent, inflationary, meet-preserving modality whose fixed points are sheaves, and Descent, the forward leg L, is Grothendieck descent, the gluing the conformance gates enforce. The closure-operator and no-leak framing behind this lives in preferences-compositional-continuous-verification.
Every component carries one of four maturity tags: [realized] for off-the-shelf or near-term, [build] for bespoke work owed, [deferred] for optional or future work parked with an explicit trigger, and [concept] for an interpretive framing not enforced by any compiler. The verbatim tier table with examples and promotion triggers is in references/maturity-tiers.md.
Nucleus runs two bridges off the Lean spec that mechanize on different timelines, and the skill must keep them separate.
The realization bridge takes Lean to realizers: realizers inhabit the typed propositions of the spec, synthesized and then witnessed by test or proof. This is gated approximately today by CI and proved strictly later where the language permits. Its strict form, strict-R, is the [deferred] Lean-to-Rust round trip over a non-concurrent Rust subset via Charon and Aeneas; that round trip is owned entirely by refinement-driven-development.
The translation bridge takes the Lean data model to a LinkML skeleton: it is [build], LLM-maintained, and curation joins it, so it is never a witnessed deterministic functor. Below LinkML, by contrast, the LinkML-schema-to-bindings leg (pydantic, dataclasses, and more) is mechanical and drift-checkable via LinkML tooling.
Nucleus has two orthogonal axes that meet only at the artifacts, never inside one type system: Lean carries the structural and refinement axis, and LinkML carries the semantic-binding and external-provenance axis. Lean owns the structural source of truth outright; nothing co-claims it. Never describe LinkML as the logical or structural source of truth.
The demotion that this axis correction encodes is precise: domain algebra is Lean-direct, while table schemas may stay LinkML. This domain-vs-data split is the Nucleus instance of the lowering-path bifurcation owned by preferences-data-modeling: the domain-direct path is the sum-rich domain algebra, and the schema-factored path is the product-oriented table schemas. The domain model is sum-rich, an exhaustiveness-checked in-memory algebra that the transforms pattern-match on, so it goes Lean-direct to Expression tagged unions and Rust enums with no intermediate schema language. The data model is the columnar Lance and Arrow table schemas, product-oriented regardless of the domain's sums, so at the table level the expressiveness gap closes and the schema may remain a LinkML skeleton plus ontology overlay, curator-editable. This is a demotion of LinkML from the domain spine, not its removal from the structural path entirely.
Semantic identity is data that no type system carries.
Whether a slot's range is CL:0000540, which CURIE an enum value binds, how a local term maps to an external vocabulary: none of this is a projection of anything in Lean, so it is curated and joined in at the LinkML layer.
The semantic and provenance overlay is one framework, LinkML, at full strength: ontology binding via class_uri, slot_uri, and CURIE-bound enums; OWL, SHACL, and RDF emission; and a curator- and biologist-editable surface.
LinkML's broader ontology and semantic facilities, including cross-ontology mapping provenance, are realized per-schema rather than as separate tools, grounded in the linkml and linkml-biolink-model reference repos in the local omicslake-workspace repository.
The join of the axes is projection-plus-overlay: the [build] projection emits a LinkML skeleton from the Lean data model, and curator-authored ontology bindings are merged onto it as a mixin. A property-based conformance test closes the join: the published LinkML schema must accept exactly the serializations the algebraic model emits and round-trip them. No single artifact masquerades as serving both axes. Crucially, the round trip ◯ = R ∘ L is purely structural and acts only on the Lean axis; the semantic overlay is orthogonal and is not part of the round trip. Holonomy therefore measures structural drift only and never validates semantic bindings, which get the separate property-based conformance test (modules/checks/conformance.nix).
The LinkML data-model path is proportionate here and detailed in references/linkml-data-model.md. In short: within the Python realizer package, a hand-authored schema/ LinkML schema is the local source, and a generated datamodel/ holds pydantic and dataclass bindings regenerated from it and never hand-edited; Nucleus adds one promotion step of its own, pydantic to LanceModel/TypedTable, from which TypedTable.to_arrow_schema() yields the single physical Arrow oracle. Factoring the data model through LinkML buys LinkML's mature generator suite (pydantic, dataclasses, and roughly a dozen more bindings on demand), which is the justification for the modest Lean-to-YAML projection. The alternative, a net-new Lean-direct generator to {TypedTable, Pydantic, TypeScript, Arrow}, is the documented other branch of an open sum-fidelity-versus-codegen trade; settle it against the first real domain instance, and do not scaffold the Lean-direct generator now. The Arrow interchange and data-contract techniques are owned by preferences-data-modeling; the boundary theory for ODCS and ODPS is owned by preferences-bounded-context-design.
The stack is frozen. The compact map below routes each layer to its Nucleus instance and the sibling that owns the technique; the verbatim layer-tool-role table and the key flake inputs are in references/frozen-stack.md.
| Layer | Nucleus instance | Owning skill |
|---|---|---|
| Structural source of truth (spec) | Lean 4 | preferences-theoretical-foundations |
| Domain model (Lean-direct) | Expression tagged unions, Rust enums | preferences-domain-modeling, preferences-algebraic-data-types |
| Data / table model | TypedTable → Arrow oracle | preferences-data-modeling |
| Semantic / provenance overlay | LinkML | preferences-data-modeling |
| Contracts (ports, products) | ODCS v3.1.0, ODPS v1.0.0 | preferences-bounded-context-design |
| Compute and data plane | Dagster, DataFusion, Lance on R2, Modal | preferences-workflow-orchestration-algebra |
| Serving | lakescope (Axum, DataFusion/Ballista, WASM/wgpu, Lit, Datastar) | apps realizer |
| Reconstruction (R) | modules/checks/*.nix | preferences-nix-checks-architecture |
| Build and CI | uv2nix, crate2nix, niks3-on-R2 | preferences-nix-development, preferences-nix-ci-cd-integration |
The deliberate exclusions are load-bearing and must not be silently reintroduced: crate2nix with rust-overlay rather than crane or crane-maturin; elan from nixpkgs rather than a lean4 flake input; clan-core, buildbot-nix, and nixidy are infrastructure and are not flake inputs; CUE is held in reserve, the answer only if a polyglot structural-contract need ever appears, redundant today given Arrow downstream and Lean upstream.
The project template is deferred until a first instance is witnessed, so today step one is by-hand; once an instance exists, extract a template from it. The invocation flow runs down the L leg and back up the R leg, delegating each step:
Carry the contract, not a worked Lean metaprogram skeleton: the default deliverable is the Lean-to-LinkML skeleton for table schemas, width-pin carrying, the ontology overlay as a mixin, the property-based conformance test, and the promotion to TypedTable then Arrow.
The directory layout is the operator written out, so the build order is the tree order, down the L leg and back up the R leg; the verbatim tree is in references/directory-tree.md; the operator drawn out as a diagram is in references/nucleus-workflow.md. Down L: spec/ (the object S) → contracts/ (Lean-direct structural bindings plus the orthogonal LinkML overlay joined as a mixin, with the Arrow oracle derived once) → pipeline/ (compute and data realizers) → apps/ (serving realizers). Back up R: modules/checks/*.nix reconstruct and validate S, computing the structural holonomy; the realized gates are the components of η that are equivalences to tolerance.
Three operating disciplines are Nucleus-specific. The spec is gated by a #print axioms check so no realized obligation rests on an unintended axiom. I/O appears in the spec only as an abstract effect signature (Spec/Effects), with handlers living in the pipeline and apps realizers, never as a concrete effect in the spec. Keep the no-leak discipline: structural and semantic concerns stay on their own axes, and no artifact serves both; the framing is owned by preferences-compositional-continuous-verification.
When placing or promoting a component, read references/maturity-tiers.md and apply the Nucleus triggers. The realized conformance gates collectively compute the currently-approximate structural holonomy. The Lean-direct multi-target generator's sum-fidelity-versus-codegen-cost is an open [build] decision settled against the first real domain instance, not in the abstract. Substrait becomes real only if plans are pinned or the system goes multi-engine; strict-R via Charon and Aeneas switches on selectively where the language permits and is proved later; CUE becomes the answer only if a polyglot structural-contract need appears. The [concept] tier (the QMADTT roles) is an interpretive reading with no promotion mechanism.
| Reference | Open it for |
|---|---|
| references/directory-tree.md | The verbatim Nucleus directory tree, the operator written out as build order. |
| references/frozen-stack.md | The verbatim layer-tool-role frozen-stack table, key flake inputs, and exclusions. |
| references/maturity-tiers.md | The four-tier table with examples and the Nucleus promotion triggers. |
| references/nucleus-workflow.md | The operator diagram (the round trip drawn out) and how to read it; links to the mermaid source. |
| references/linkml-data-model.md | The schema/-to-datamodel/ flow, the TypedTable promotion, the open codegen trade, and the omicslake reference repos. |
preferences-theoretical-foundations, refinement-driven-development, preferences-workflow-orchestration-algebra, preferences-compositional-continuous-verification, preferences-nix-checks-architecture, preferences-nix-development, preferences-data-modeling, preferences-architectural-patterns, preferences-computational-system-taxonomy, preferences-validation-assurance, preferences-bounded-context-design, preferences-nix-ci-cd-integration.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
nucleus-pattern, lean4, linkml, arrow, monorepo, spec-driven-development
/formal-specification-and-refinement:nucleus-platformfrom formal-specification-and-refinement
npx claudepluginhub cameronraysmith/vanixiets --plugin formal-specification-and-refinement4 skills in this plugin
/preferences-requirements-engineeringMeta-requirements discipline for requirements-like documents and the bridge from them to a formal spec, grounded in the WRSPM reference model of Gunter, Gunter, Jackson and Zave. Load when authoring or reviewing a requirements document, deciding whether a statement belongs in the world, the requirements, or the specification stratum, grounding a term in a designation table, separating indicative assumptions from optative goals, restricting a specification to shared phenomena, running obstacle analysis to find where a satisfaction argument fails, specialising to a physical world via Parnas' four-variable model, or reconciling an AMDiRE-shaped document tree against the world/machine boundary. Owns the satisfaction argument as a maintained artifact. Defers the program-refines-spec leg to refinement-driven-development, the audit procedure to satisfaction-argument-audit, contract and institution algebra to preferences-theoretical-foundations, and confidence calibration to preferences-validation-assurance.
/refinement-driven-developmentApproximately-verifiable, refinement-driven development for type-driven domain-driven design. Use when modeling a domain as a dependently-typed Lean 4 specification, refining/lowering it to a Rust implementation, lifting the implementation back via Charon and Aeneas to check spec<->implementation correspondence (translation validation) — mechanically when tractable, otherwise via differential testing or LLM comparison — or when generating and diffing type-system diagrams of the model and implementation to track their evolution. Mechanical on-the-nose proof is the precise ideal, not a requirement; its absence is not a failure of the method.
/satisfaction-argument-auditMilestone audit of the satisfaction argument that a program meets a specification meets stated intent, generalized across proof institutions (Lean, Rust via Charon/Aeneas, Dafny, Verus). Use before a release or a milestone; before writing an external claim about what is verified, in a README, a design document's promise section, or a customer conversation; when inventorying a trust surface of sorry, axiom, unsafe, or assume declarations, or any opt-in verification mode that silently skips unmarked units; or when checking a formal specification against its stated intent by blind informalization. Runs in fresh context, after the proof gate is green, and produces a report that never gates on an exit code and never changes code. Points up to preferences-requirements-engineering for the WRSPM ontology this audit's gates discharge.
Other plugins' skills for the same job