/lucid-coder:cccfrom lucid-coder
Ligand-receptor cell-cell communication between cell types from a log-normalised single-cell h5ad with LIANA+ rank_aggregate (CellPhoneDB, Connectome, log2FC, NATMI, SingleCellSignalR, or a subset), a bundled or exported ligand-receptor resource TSV, a fixed pass rule on magnitude and specificity ranks, a source x target count heatmap, an LR dot plot, a report and a reproducibility bundle. Optional per-sample runs. Fire on "cell-cell communication", "ligand-receptor analysis", "which cell types talk to which", "LIANA", "CellPhoneDB", "rank_aggregate", "CCC between clusters". Do NOT fire for spatial CCC (bivariate, MISTy), for factorising CCC across many samples (Tensor-Cell2cell, MOFAtalk), for DE-driven CCC between conditions, for non-human data without a translated resource, or for raw counts.
Ships in lucid-coder. 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.
Read when SKILL.md points to them; scripts run unread.
You are the dispatcher for ccc. The script does the analysis; you collect its arguments, run it, and explain its outputs.
Run scripts/ccc.py. Never re-implement the analysis, change a threshold, or
pick a value the user has not given. If a required argument is unknown, ask the
user (these are grill questions), or run --demo only when the user asks for a
demo.
Then read result.json and relay chat_summary_lines and preferred_artifacts.
If the script prints ERROR: ... and exits 2, tell the user the message and the
argument it names. Do not work around it.
Environment: pixi feature liana (pixi install -e liana, from templates/pixi.toml).
| Input | Format | Required content | Example |
|---|---|---|---|
--adata | .h5ad | log-normalised values (normalize_total + log1p) in X; not raw counts, not scaled; var_names are gene symbols, --gene-id-col names the Ensembl id column | sc-annotate's data/annotated.h5ad run on sc-embed's output (X stays log-normalised); examples/demo.h5ad |
--groupby | obs column | at least 2 cell-type labels | cell_type; demo cell_type |
--sample (optional) | obs column | sample or donor ID; one LIANA run per sample | demo sample (not used by --demo) |
--resource | TSV | columns ligand, receptor; complex subunits joined by _; same identifiers as var_names | consensus_resource.tsv; examples/demo_resource.tsv |
The script refuses a matrix with negative values (scaled), only integers (raw
counts), or a maximum above 20 (log1p of counts scaled to a fixed total cannot
reach it; CPM or linear data do), and a resource with no pair fully present in var_names (wrong species
or identifiers). .raw is never read (use_raw=False). A categorical
--groupby keeps its category order; any other column is cast to strings and
sorted. Gene names and cell ids must be unique (skillkit.check_unique).
The resource is a file so the run never downloads and never depends on the
liana version's bundled copy. liana ships its consensus resource offline
(liana/resource/omni_resource.csv); export it once and pass the file:
import liana as li
li.rs.select_resource("consensus").to_csv(
"consensus_resource.tsv", sep="\t", index=False
) # human symbols, 4620 pairs in liana 1.10.0; "mouseconsensus" for mouse
Ask these through the analysis contract: ${CLAUDE_PLUGIN_ROOT}/skills/lucid-coder/references/contracts.md.
Each row is a grill question. Ask the user; never fill one in.
| Argument | Meaning | Grill question | Demo-only value |
|---|---|---|---|
--adata | input h5ad | Which h5ad holds the log-normalised cells? | examples/demo.h5ad |
--context | species, tissue or cell type, condition, dataset | Species, tissue or cell type, condition and dataset? | synthetic demo: 3 cell types x 40 cells, 2 samples, planted LIG1-REC1 and LIG2-REC2, no real tissue |
--gene-id-col | var column of Ensembl gene ids, or none | Which var column holds the Ensembl gene ids? (none if the source has symbols only; gene_id is then NA, never guessed.) | gene_ids |
--resource | ligand-receptor TSV | Which resource file (consensus export, or a curated one)? | examples/demo_resource.tsv |
--groupby | obs column of cell types | Which obs column holds the cell-type labels? | cell_type |
--sample (optional) | obs column of samples | Run once per sample? If so, which column? Absent means one pooled run. | absent |
--methods | rank_aggregate (all 5) or a comma list of cellphonedb, connectome, logfc, natmi, singlecellsignalr | Which methods go into the rank aggregate? | rank_aggregate |
--expr-prop | min fraction of a group expressing each subunit | In what fraction of a cell type must the ligand and receptor be detected? | 0.1 |
--min-cells | min cells per group | Below how many cells is a cell type dropped? | 5 |
--n-perms | label permutations | How many permutations for the specificity p-values? | 100 |
--magnitude-max | magnitude rank cutoff | Which magnitude rank (0-1, lower is stronger) calls an interaction? | 0.002 |
--specificity-max | specificity rank cutoff | Which specificity rank (0-1, lower is more specific) calls an interaction? | 0.01 |
--sources | sender labels, comma list or all | Which cell types send? | all |
--targets | receiver labels, comma list or all | Which cell types receive? | all |
--n-top | interactions in the dot plot | How many top passing interactions go in the dot plot? | 10 |
--reference | genome build and annotation release of the gene names | Which genome build and annotation were the genes counted against (e.g. GRCh38, GENCODE 44)? | synthetic demo genes, no genome build |
--seed | permutation seed | Which seed? | 0 |
--outdir | new output directory | Which new directory gets the outputs? It must not exist. | ccc_demo |
The last column is demo-only, not defaults. --demo alone pins all of them.
With --demo, only --outdir may also be given; any other argument is an error.
python scripts/ccc.py \
--adata results/2026-10-27_annotate/data/annotated.h5ad \
--resource resources/consensus_resource.tsv --groupby cell_type \
--methods rank_aggregate --expr-prop 0.1 --min-cells 5 --n-perms 1000 \
--magnitude-max 0.05 --specificity-max 0.05 --sources all --targets all \
--n-top 20 --reference "GRCh38, GENCODE 44" --seed 0 \
--outdir results/2026-10-27_ccc
# Demo (only when the user asks for one)
python scripts/ccc.py --demo --outdir demo_out
X. sc-annotate writes X unchanged from its
input, so sc-embed -> sc-annotate (--counts-layer counts) -> ccc works.
Layers, including counts, are not read; .raw is ignored.X and layers are untouched on disk.Not asked, recorded here. liana 1.x: AggregateClass(aggregate_meta) over the
chosen methods (the five of rank_aggregate by default), use_raw=False,
n_jobs=1, inplace=False, groupby_pairs only when --sources or
--targets restrict the pairs. Each method keeps its liana defaults.
--methods and input; bad input gives
ERROR: <message>, exit 2. The method set needs at least one magnitude score
(all but logfc) and one specificity score (all but singlecellsignalr).X is log-normalised, the
resource overlaps var_names, and every --sources/--targets label exists.
result.json reports n_matched distinct ligand and receptor genes
(complex subunits split on _) in var_names out of n_in_resource
(demo: 40 of 40).AggregateClass(aggregate_meta, methods=...), the object
behind li.mt.rank_aggregate: resource= the TSV, expr_prop, min_cells,
n_perms, seed, n_jobs=1, use_raw=False, under one BLAS thread.
Sources or targets other than all go in as groupby_pairs, which shrinks
the set the ranks are computed over. --sample runs .by_sample.passes when magnitude_rank <= --magnitude-max and
specificity_rank <= --specificity-max. Zero passing stops the run (no_pass).--sample); every pair of labels gets a row, zeros kept.--n-top passing rows.interactions.tsv holds every tested interaction, sorted by sample (if any),
then magnitude_rank, specificity_rank, source, target, ligand, receptor.
Then one row per resource pair with no tested interaction, with NA source,
target and ranks: status is not_measured when a subunit is missing from
var_names, not_tested when every subunit is measured but no source-target
row passed --expr-prop / --min-cells. Tested rows have status tested;
status_counts in result.json counts rows. ligand_gene_id and
receptor_gene_id map each subunit through --gene-id-col (subunits joined by
_; NA when a subunit has no id). Figures use tested rows only.
ligand and receptor are liana's ligand_complex and receptor_complex.
pair_counts.tsv is sorted by sample (if any), source, target in --groupby
order.
outdir/
├── report.md # params, summary, figures with captions
├── result.json # n_cells, n_groups, n_resource_pairs, n_matched, n_in_resource, n_interactions, n_pass, status_counts, gene_id_col, top_interactions, methods, seed, params, context, reference, chat_summary_lines (first: "Context: ..."), preferred_artifacts
├── tables/
│ ├── interactions.tsv # [sample], source, target, ligand, receptor, ligand_gene_id, receptor_gene_id, magnitude_rank, specificity_rank, passes, status
│ └── pair_counts.tsv # [sample], source, target, n_pass
├── figures/
│ ├── pair_counts_heatmap.pdf
│ ├── pair_counts_heatmap.png
│ ├── pair_counts_heatmap.csv
│ ├── lr_dotplot.pdf
│ ├── lr_dotplot.png
│ └── lr_dotplot.csv
└── reproducibility/
├── commands.sh # argv as run, and the resolved command with every argument
├── environment.txt # Python and package versions
└── checksums.sha256 # tables and figure PDFs; sha256sum -c from outdir
li.mt.rank_aggregate(resource_name="consensus")
and let liana pick the resource. Do not. Pass the exported TSV, so the resource
is a recorded input and not a property of the installed liana version.--magnitude-max or --specificity-max
after a run with few or no passing interactions. Do not. Report what passed;
the cutoffs are the user's answers, fixed before the run.var_names "not
communicating". Do not. Non-detection is not absence: the pair was not
tested; its status in interactions.tsv is not_measured, and
n_matched says how many resource genes were.claims.strength).var_names to get past no resource pair has its ligand and receptor in var_names. Do not. Ask for the right species' resource.--sources/--targets to "just filter" the
plot. They change which interactions are ranked. Filter interactions.tsv
afterwards when the user only wants a view.expr_prop=0.1, n_perms=1000, min_cells=5). Do not. Ask, or run
--demo only when the user asked for one.Corpus sources, ClawBio mechanisms, tests, citations and the plot spec are in references/maintainer.md. The agent running the script does not need them.
examples/demo.h5ad (opens in a new tab)examples/demo_resource.tsv (opens in a new tab)examples/make_demo.py (opens in a new tab)references/maintainer.md (opens in a new tab)scripts/ccc.py (opens in a new tab)scripts/palettes.py (opens in a new tab)scripts/plots.py (opens in a new tab)scripts/skillkit.py (opens in a new tab)scripts/theme.py (opens in a new tab)tests/test_ccc.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
27 skills in this plugin
/alignInstall the lucid-coder house-style configs into this repository, one file at a time, after showing each diff and asking. Use when the user says "align this repo", "install the house style configs", "set up air/ruff/lintr", or "add the palette file"./compositionCell-type composition and differential abundance with crumblr: counts cells per sample and label (from a cell-level h5ad or a counts TSV), drops rare labels, runs crumblr's precision-weighted CLR and variancePartition dream (fixed and random effects, e.g. (1|donor)), and writes tables, a stacked composition bar, per-label proportion boxes, an effect forest, a report and a reproducibility bundle. Fire on "cell-type composition", "differential abundance of cell types", "do cell-type proportions change", "crumblr", "CLR of cell frequencies", "which populations expand after stimulation". Do NOT fire for neighbourhood-level DA on a KNN graph (Milo), gene expression DE (pseudobulk or cell-level), scCODA / Bayesian composition models, or a plain Wilcoxon on frequencies (group-tests)./enrichmentGene-set enrichment on one or more DE tables (contrasts or cell types): preranked fgsea in R, or over-representation (one-sided Fisher / hypergeometric) of the significant genes against a stated universe, BH within each contrast, with an NES dot plot, an NES heatmap, running enrichment-score curves, a report and a reproducibility bundle. Fire on "GSEA on the DE results", "fgsea Hallmark per cell type", "pathway enrichment of the DE genes", "over-representation analysis", "ORA with a background", "which pathways are up in stim", "NES dotplot". Do NOT fire for scoring a gene set per cell or sample (signature scoring), for TF or pathway activity inference (decoupler ULM/MLM, PROGENy), for enrichment that needs the dreamlet fit object (zenith), or when there is no DE table yet (run pseudobulk-de first)./figure-styleHouse figure style for scientific plots in R (ggplot2, ComplexHeatmap) and Python (plotnine, plotnine-extra): use it for ANY figure drawn from experimental, omics or single-cell data, including plot types not listed here (box, violin, slopegraph, forest, volcano, heatmap, dot plot, UMAP, PCA, composition bars, QC, survival curves, enrichment, spatial maps). Takes precedence over generic charting or dashboard skills for these figures. Do NOT fire for web dashboards, slide graphics or UI charts./gene-programsGene-program discovery by consensus NMF (cNMF-style) on raw single-cell counts: HVG selection, repeated seeded sklearn NMF, a local-density filter and k-means consensus of the replicate components, per-cell program usage, gene scores, top genes, mean usage, fraction of active cells and one-vs-rest AUC per group, a stability table, four fixed figures, a report and a reproducibility bundle. Fire on "gene programs", "cNMF", "consensus NMF", "gene expression programs", "GEP usage", "NMF programs per cell type", "which programs mark each cluster", "structure plot of program usage". Do NOT fire for scoring a known gene set (score_genes, UCell), for projecting onto a fixed reference (starCAT, NMFproj), for choosing k by a sweep, for marker genes per cluster (use sc-markers), or for log-normalised input./group-testsGroup-comparison and association tests on sample-level values (cell-type frequencies or CLR values, signature scores, Olink NPX): one Wilcoxon rank-sum, paired Wilcoxon signed-rank, Spearman or Pearson test per feature, BH or Bonferroni across features, an effect size for every test, a table, box or scatter figures for the top features, a report and a reproducibility bundle. Fire on "Wilcoxon per cell type", "compare frequencies between groups", "paired test pre vs post per donor", "Olink NPX healthy vs disease", "correlate scores with age", "Spearman per feature with FDR". Do NOT fire for gene-level differential expression from counts (pseudobulk DE), cell-level tests (marker genes, rank_genes_groups), compositional models (scCODA, crumblr, propeller), regression with covariates, or combining p-values across cohorts.npx claudepluginhub mdmanurung/lucid-coder --plugin lucid-coder