spatial-preprocessing

A preprocessing skill for spatial transcriptomics, a method that measures gene activity together with locations in a tissue sample. It loads several common data formats, filters low-quality data, normalizes measurements, selects informative genes, and creates standard analysis views and clusters.

In plain words
What is it for?
Use it to prepare Visium, Xenium, MERFISH, Slide-seq, seqFISH, or h5ad data for analysis, including quality control, PCA, UMAP, and Leiden clustering.
Why use it?
It replaces repeated setup code and inconsistent choices before downstream tissue analysis.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/shangbiolab/spatialclaw/spatial-preprocessing
Any agent
npx skills add ShangBioLab/SpatialClaw --skill spatial-preprocessing
Clone the repo
git clone --depth 1 https://github.com/ShangBioLab/SpatialClaw

Made for: Claude Code, Codex.

Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,487 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00049 $0.02487
Opus 5 $0.00024 $0.01243
Sonnet 5 $0.00010 $0.00497
Haiku 4.5 $0.00005 $0.00249

Measured 2d ago against content hash 1fc652e18d86, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

spatial-preprocessing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

The scan reads SKILL.md. This mod also ships 3 executable files (spatial_preprocessing.py, tests/__init__.py, tests/test_spatial_preprocessing.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/spatial/spatial-preprocessing/SKILL.md · 226 lines

How it starts

The opening of the file, as written. The whole thing — 226 lines — stays where its author put it; the contents beside it link to each section on GitHub.

🔬 Spatial Preprocess

You are Spatial Preprocess, the foundation skill of SPATIALCLAW spatial analysis. Your role is to load multi-platform spatial transcriptomics data and produce a clean, normalised, clustered AnnData ready for all downstream analysis skills.

Why This Exists

  • Without it: Users manually write 40+ lines of Scanpy preprocessing code with inconsistent defaults
  • With it: One command loads any spatial platform, runs QC, normalises, clusters, and produces a ready-to-analyse h5ad
  • Why SPATIALCLAW: Standardised preprocessing ensures reproducibility across all downstream skills

Workflow

  1. Calculate: Prepare raw counts and assess QC metrics.
  2. Execute: Run filtering, normalization, and feature selection.
  3. Assess: Perform PCA and variance evaluation.
  4. Generate: Save normalized matrices and compute default UMAP.
  5. Report: Synthesize report with processing metadata and summaries.

Core Capabilities

  1. Multi-platform loading: Visium (directory/H5/H5AD), Xenium (Zarr/H5), MERFISH, Slide-seq, seqFISH, generic H5AD
  2. QC filtering: Mitochondrial %, min/max genes thresholds, tissue-specific presets
  3. Normalization: Library-size normalization + log1p, raw counts preserved in layers['counts']
  4. HVG selection: highly variable gene detection on raw counts
  5. Embedding: PCA with data-driven component suggestion, neighbor graph, UMAP
  6. Clustering: Leiden community detection with optional multi-resolution exploration
  7. Tissue presets: Pre-configured QC thresholds for 10 tissue types

Tissue-Specific QC Presets

When --tissue is specified, QC thresholds are automatically applied. Explicit parameters override preset values.

Tissue max_mt_pct min_genes max_genes Notes
pbmc 5% 200 2500 Low MT in blood cells
brain 10% 200 6000 Neurons have many genes
heart 50% 200 5000 Cardiomyocytes are MT-rich
tumor 20% 200 5000 Heterogeneous tissue
liver 15% 200 4000 Hepatocytes are large
kidney 15% 200 4000 Tubular cells are MT-active
lung 15% 200 5000 Mixed cell types
gut 20% 200 5000 Epithelial turnover
skin 10% 200 4000 Keratinocyte-rich
muscle 30% 200 5000 High mitochondrial content

Read the full file on GitHub · 226 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 226 lines · 49 tokens per session scan A 1fc652e18d86

Subscribe to this mod's changes

spatial-preprocessing is a skill published in the GitHub repository ShangBioLab/SpatialClaw (11 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 49 tokens to every session and 2,487 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

spatial-transcriptomics-spatial-data-io

Load spatial transcriptomics data from Visium, Xenium, MERFISH, Slide-seq, and other platforms using Squidpy and SpatialData. Use this skill when: (1) Loading Visium spatial transcriptomics data from Space Ranger output, (2) Loading Xenium single-cell resolution spatial data, (3) Loading MERFISH, CosMx, or other…

PharMolix/OpenBioMed · 103 tokens

scanpy

Standard single-cell RNA-seq analysis pipeline. Use for QC, normalization, dimensionality reduction (PCA/UMAP/t-SNE), clustering, differential expression, and visualization. Best for exploratory scRNA-seq analysis with established workflows. For deep learning models use scvi-tools; for data format questions use…

synthetic-sciences/openscience · 68 tokens

Gene Panel Selection Workflow

End-to-end workflow for gene panel design in scRNA-seq and spatial transcriptomics, that should be STRICTLY followed: dataset understanding + smart downsampling + train/test splits, algorithmic selection (HVG/DE/RF/scGeneFit/SpaPROS), optimal sub-panel discovery (ARI vs size), biological completion with a stability…

aristoteleo/PantheonOS · 110 tokens

Developmental Gene Panel Design Workflow

Panel design for DEVELOPING / dynamic systems (embryonic organs, differentiation, regeneration). The target experiment is usually a LATE / terminal stage, but the biology is a trajectory: terminal cell types are end-products of earlier lineage programs. A panel built from the target stage alone resolves terminal…

aristoteleo/PantheonOS · 129 tokens

single-cell-scrna-seq-analysis-scanpy

Complete single-cell RNA-seq analysis workflow built on Scanpy and AnnData. Use this skill when: (1) Loading diverse single-cell data formats (10X, h5ad, CSV), (2) Performing quality control and filtering, (3) Normalization, dimensionality reduction, and clustering, (4) Marker gene identification and cell type…

PharMolix/OpenBioMed · 85 tokens

AR/VR Application Testing

Testing augmented and virtual reality applications including spatial tracking, gesture recognition, performance on headsets, and motion sickness testing.

PramodDutta/qaskills · 29 tokens