AnnData Data Structure Skill
Teaches Claude the correct, up-to-date patterns for creating, reading, writing, concatenating and subsetting AnnData (.h5ad/zarr) objects in single-cell workflows.
Data & AnalyticsIntermediate★ 46,134⑂ 4,181AI score 8/10Last updated: Sep 21, 2026
What it does
- Guides creation, reading and writing of AnnData objects across
.h5ad,.zarr, CSV, MTX and Loom using current APIs (anndata.io). - Explains the object layout (X, obs, var, layers, obsm/varm, obsp/varp, uns, raw) and the view-vs-copy trap.
- Provides concrete patterns for
ad.concatbatch merging (inner/outer joins, label/keys), backed mode and chunked processing for huge files, and memory optimization via sparse matrices and categoricals. - Steers away from deprecated APIs (
ad.read,AnnData.concatenate(),__version__) and flagsanndata.experimentalas unstable. - Includes scverse ecosystem integration snippets for scanpy, muon and PyTorch (AnnLoader).
Who it's for
- Bioinformaticians and grad students analyzing single-cell RNA-seq data in Python.
- Anyone building scanpy/scvi-tools pipelines who keeps hitting data-format friction.
- Users handling tens-to-hundreds of GB h5ad files under memory constraints.
Example uses
- "Merge batch1–batch3.h5ad with batch labels, keeping only shared genes" → generates
ad.concat(..., label='batch', keys=[...], join='inner'). - "Extract cells with quality_score > 0.8 from a 100GB h5ad" → backed-mode read, filter,
to_memory(), thenwrite_h5ad(compression='gzip'). - "I keep running out of memory" → checklist of csr_matrix conversion,
strings_to_categoricals(), and when to snapshotraw.
· · · Install guide · · ·
Try it now, no install
Paste this into Claude to use the skill without installing anything.
Read the instructions in this file and follow them to help me: https://raw.githubusercontent.com/K-Dense-AI/scientific-agent-skills/HEAD/skills/anndata/SKILL.md What I want: (describe your task here)
If Claude can't open the link, open it yourself and paste the contents instead.
↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on Claude Skill Mart. Copy the skills/anndata folder from the GitHub repo K-Dense-AI/scientific-agent-skills into my ~/.claude/skills/anndata/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/K-Dense-AI/scientific-agent-skills.git /tmp/sas && mkdir -p ~/.claude/skills && cp -r /tmp/sas/skills/anndata ~/.claude/skills/⚠ This is a third-party skill. Check the source repository before installing.
- Open a terminal and clone the repo:
git clone https://github.com/K-Dense-AI/scientific-agent-skills.git - Create the skills directory:
mkdir -p ~/.claude/skills - Copy just this skill:
cp -r scientific-agent-skills/skills/anndata ~/.claude/skills/ - Verify the bundled
references/markdown files came along:ls ~/.claude/skills/anndata - Prepare a Python 3.11+ environment:
uv pip install "anndata==0.12.16"(addscanpyif you need 10x readers). - Restart Claude Code and try a prompt like "concatenate these h5ad files by batch" to confirm the skill triggers.
View source on GitHub ↗License: MIT