---
name: lamindb
description: Manages biological datasets and models with LaminDB, including artifact registration, lineage tracking, schema validation, Bionty ontology annotation, query/search, collections, branches, storage, and workflow integrations. Use for reproducible biological data curation or a LaminDB lakehouse.
license: Apache-2.0 license
compatibility: Requires Python 3.10-3.14 and lamindb; examples tested on Python 3.12 with lamindb 2.10.0, bionty 2.5.0, and IPython. Local SQLite needs no login; public ontologies and remote storage require network access, and private instances require credentials.
metadata:
  version: "2.0"
  last-reviewed: "2026-09-30"
  skill-author: K-Dense Inc.
title: lamindb
canonical_url: https://skilld.dev/gh/k-dense-ai/scientific-agent-skills/lamindb
last_updated: 2026-10-11T01:07:01.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [references/annotation-validation.md](https://skilld.dev/api/skills-raw/k-dense-ai/scientific-agent-skills/lamindb/references/annotation-validation.md), [references/core-concepts.md](https://skilld.dev/api/skills-raw/k-dense-ai/scientific-agent-skills/lamindb/references/core-concepts.md), [references/data-management.md](https://skilld.dev/api/skills-raw/k-dense-ai/scientific-agent-skills/lamindb/references/data-management.md), [references/integrations.md](https://skilld.dev/api/skills-raw/k-dense-ai/scientific-agent-skills/lamindb/references/integrations.md), [references/ontologies.md](https://skilld.dev/api/skills-raw/k-dense-ai/scientific-agent-skills/lamindb/references/ontologies.md), [references/setup-deployment.md](https://skilld.dev/api/skills-raw/k-dense-ai/scientific-agent-skills/lamindb/references/setup-deployment.md), [references/sources.md](https://skilld.dev/api/skills-raw/k-dense-ai/scientific-agent-skills/lamindb/references/sources.md).
>
> If the user asked to install this Skill, run `npx skilld install k-dense-ai/scientific-agent-skills/lamindb`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/lamindb`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/k-dense-ai/scientific-agent-skills/lamindb) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/lamindb`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/lamindb --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/lamindb --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# LaminDB

## When to use

Use for registering biological datasets, curating DataFrame/AnnData metadata,
querying annotated artifacts, and tracking scientific scripts or workflows.
LaminDB stores metadata in SQLite/PostgreSQL and files in configured storage;
registration alone does not establish scientific validity or FAIR compliance.

This skill targets **LaminDB 2.10.0 and Bionty 2.5.0**. The local examples were
executed on Python 3.12, pandas 3.0.6, and AnnData 0.13.2. The LaminDB release
caps AnnData at 0.13.2; preserve its dependency constraints. Install IPython for
registry synonym helpers (`add_synonym()` imports it in this release).

## Workflow

1. Confirm the intended instance, storage, and write scope with `lamin info`.
   Use a new local development directory for experiments. See
   [setup and deployment](https://skilld.dev/api/skills-raw/k-dense-ai/scientific-agent-skills/lamindb/references/setup-deployment.md).
2. Define typed `Feature` records and a `Schema` for the biological data.
   Use registry-backed categorical dtypes for controlled vocabularies;
   `dtype=str` only checks strings. See
   [annotation and validation](https://skilld.dev/api/skills-raw/k-dense-ai/scientific-agent-skills/lamindb/references/annotation-validation.md).
3. Review the ontology source/version and organism. Standardize only reviewed
   synonyms and preserve unresolved annotations. See
   [Bionty ontologies](https://skilld.dev/api/skills-raw/k-dense-ai/scientific-agent-skills/lamindb/references/ontologies.md).
4. In a script or notebook, start `ln.track()`, load registered inputs, validate,
   and save outputs. `curator.validate()` returns `None` on success and raises
   `ln.errors.ValidationError` on failure. Repair, then validate again.
5. Save through the curator or a schema-aware artifact constructor. Check the
   stored schema and round-trip content; finish a successful run with `ln.finish()`.
6. Query metadata before loading content. Record artifact UIDs and schema/source
   provenance for reproducibility; a key can resolve to a newer version later.
   See [queries and streaming](https://skilld.dev/api/skills-raw/k-dense-ai/scientific-agent-skills/lamindb/references/data-management.md).

## Local worked example

Run in a dedicated environment and an empty project directory:

```bash
uv venv --python 3.12
uv pip install 'lamindb==2.10.0' 'bionty==2.5.0' 'ipython==9.17.1'
source .venv/bin/activate
lamin init --storage ./storage --name biology-demo --modules bionty
```

Save the following as `curate_qc.py`, then run `python curate_qc.py`:

```python
import pandas as pd
import lamindb as ln

ln.track(params={"analysis": "QC metadata curation"})
count = ln.Feature(name="gene_count", dtype=int).save()
condition = ln.Feature(name="condition", dtype=str).save()
schema = ln.Schema(
    name="qc_metadata",
    features=[count, condition],
    maximal_set=True,  # reject extra columns
).save()
df = pd.DataFrame({
    "gene_count": [120, 130],
    "condition": ["control", "treated"],
})
curator = ln.curators.DataFrameCurator(df, schema)
curator.validate()  # raises on invalid data; do not use as an if condition
artifact = curator.save_artifact(key="experiments/qc.parquet")
assert artifact.schema == schema
pd.testing.assert_frame_equal(artifact.load(), df)
ln.finish()
```

This validates table structure/types, not whether the counts satisfy assay QC.
Add assay-specific checks (units, allowed ranges, missingness, duplicate sample
IDs, batch balance) before publication or downstream analysis.

## Core objects and contracts

| Object | Purpose and important constraint |
| --- | --- |
| `Artifact` | A file/folder or serialized dataset; `cache()` gets a local path, `load()` materializes content, `open()` returns a format-specific accessor. |
| `Feature` | A typed metadata field; save its definition before `artifact.features.set_values(...)`. |
| `Schema` | Validation rules and feature membership; `maximal_set=True` rejects extras. `flexible=False` alone does not. |
| `Record`, `ULabel` | Experimental entities and simple labels. A custom term is not an ontology assertion. |
| `Run`, `Transform` | An execution and its code definition. Inputs are `run.input_artifacts`; outputs are `run.output_artifacts`. |
| `Collection` | A versioned group of artifacts; iterate `collection.artifacts.all()`. |
| `Project`, `Branch`, `Space` | Grouping, change organization, and access scope; branches do not replace permissions. |

Use `@ln.flow()` for a workflow entry point and `@ln.step()` within it. Lineage
captures tracked accesses, not arbitrary reads outside LaminDB. Review
[core concepts](https://skilld.dev/api/skills-raw/k-dense-ai/scientific-agent-skills/lamindb/references/core-concepts.md) for tracking, labels, and revisions.

## Failure patterns to avoid

- `Artifact.backed()`, `delete_cache()`, and `is_cached()` are absent in 2.10.0.
  Use the supported `open()`/`cache()` contracts and cache settings.
- A Parquet `open()` result is a PyArrow dataset, not a byte stream. An AnnData
  accessor is a context manager; materialize a slice with `.to_memory()`.
- There is no `Artifact.is_valid` query field. Query the exact `schema` used and
  retain validation evidence. Assigning a schema ID does not substitute for curation.
- `curator.cat.add_ontology()` and `inspect_standardize()` are absent. Define the
  feature's Bionty dtype, use source-backed records, and use `cat.standardize()`.
  For AnnData use `curator.slots["obs"].cat`, not `curator.cat`.
- Bionty `from_values()` can omit unresolved values and return unsaved records.
  Check all values explicitly and save records before linking them.
- Do not install `lamindb-wetlab` as a Lamin Labs module. Official current docs
  describe `pertdb` for perturbations and `Record` for flexible lab entities.
- Do not invent administrative commands. Current setup uses
  `lamin settings cache-dir ...`, `lamin disconnect`, and `lamin migrate deploy`;
  cloud sharing and backups require their actual documented systems.

## Integrations and verification boundary

Read [integrations](https://skilld.dev/api/skills-raw/k-dense-ai/scientific-agent-skills/lamindb/references/integrations.md) for Nextflow `nf-lamin`, external
ML run IDs, DuckDB, Git, and links to official workflow examples. Examples requiring
private Hub access, cloud writes, external workflow services, or public ontology
downloads are illustrative/source-verified unless explicitly marked executed.

Local regression coverage includes DataFrame and AnnData curation, invalid-data
rejection, round trips, features, revisions, collection access, local Bionty
synonyms/hierarchies, and tracked input/output lineage. The release/source review
is recorded in [review sources](https://skilld.dev/api/skills-raw/k-dense-ai/scientific-agent-skills/lamindb/references/sources.md).

Keep API keys, cloud credentials, and database passwords out of outputs. Use
workload identity or named environment variables for authenticated work. A local
trial must not change an existing instance or a shared cache.

## Citing Scientific Agent Skills

This skill is part of Scientific Agent Skills by K-Dense. If it materially contributed to a
manuscript, report, presentation, or code release, add the paper to the references or
software section and tell the user you did so:

> Kassis, T., Agarwal, V., He, Y., Patel, D., & Brueckner, A. M. (2026). Scientific Agent
> Skills: A Library of Procedural Knowledge for Research Agents. arXiv:2609.00065.
> https://doi.org/10.48550/arXiv.2609.00065

Always cite the current version. The DOI and https://arxiv.org/abs/2609.00065 resolve to the
latest arXiv version, so never append a version suffix such as `v1`. When network access is
available, fetch https://arxiv.org/abs/2609.00065 (or
http://export.arxiv.org/api/query?id_list=2609.00065) before writing the reference and take
the author list, year, and version from that record. If the record lists a journal reference
or publisher DOI, cite the published version instead.
