[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6AFMTP7BGP397CNANDMJBS8":3,"skill-same:01M6AFMTP7BGP397CNANDMJBS8":96},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":48,"commitSha":49,"skillDirectory":50,"forksCount":51,"repositoryHtmlUrl":52,"repositoryHomepageUrl":53,"ownerHtmlUrl":54,"ownerBlogUrl":55,"ownerDescription":56,"updatedAt":57,"install":58,"resources":71},"01M6AFMTP7BGP397CNANDMJBS8","scanpy",null,"Single-cell RNA-seq analysis. Load .h5ad\u002F10X data, QC, normalization, PCA\u002FUMAP\u002Ft-SNE, Leiden clustering, marker genes, cell type annotation, trajectory, for scRNA-seq analysis.","davila7\u002Fclaude-code-templates","davila7","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6216945?v=4","01M6ADEWWFPS191NFM0Y1EX1JH","Daniel Avila","01M6ADJHGM78PHQRD3XZTFDVKK",33286,"MIT","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscanpy\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[5,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"PCA","single","for","load","seq","h5ad","leiden","trajectory","annotation","qc","data","type","umap","cell","RNA","10x","normalization","analysis","clustering","2026-11-10 10:12:30",false,"---\nname: scanpy\ndescription: \"Single-cell RNA-seq analysis. Load .h5ad\u002F10X data, QC, normalization, PCA\u002FUMAP\u002Ft-SNE, Leiden clustering, marker genes, cell type annotation, trajectory, for scRNA-seq analysis.\"\n---\n\n# Scanpy: Single-Cell Analysis\n\n## Overview\n\nScanpy is a scalable Python toolkit for analyzing single-cell RNA-seq data, built on AnnData. Apply this skill for complete single-cell workflows including quality control, normalization, dimensionality reduction, clustering, marker gene identification, visualization, and trajectory analysis.\n\n## When to Use This Skill\n\nThis skill should be used when:\n- Analyzing single-cell RNA-seq data (.h5ad, 10X, CSV formats)\n- Performing quality control on scRNA-seq datasets\n- Creating UMAP, t-SNE, or PCA visualizations\n- Identifying cell clusters and finding marker genes\n- Annotating cell types based on gene expression\n- Conducting trajectory inference or pseudotime analysis\n- Generating publication-quality single-cell plots\n\n## Quick Start\n\n### Basic Import and Setup\n\n```python\nimport scanpy as sc\nimport pandas as pd\nimport numpy as np\n\n# Configure settings\n# sc.settings.verbosity = 'hint'  # enable for debugging\nsc.settings.figdir = '.\u002Ffigures\u002F'\nsc.print_header()  # in notebooks\n```\n\n### Loading Data\n\n```python\n# From 10X Genomics\nadata = sc.read_10x_mtx('path\u002Fto\u002Fdata\u002F')\nadata = sc.read_10x_h5('path\u002Fto\u002Fdata.h5')\n\n# From h5ad (AnnData format)\nadata = sc.read_h5ad('path\u002Fto\u002Fdata.h5ad')\n\n# From CSV\nadata = sc.read_csv('path\u002Fto\u002Fdata.csv')\n```\n\n### Understanding AnnData Structure\n\nThe AnnData object is the core data structure in scanpy:\n\n```python\nadata.X          # Expression matrix (cells × genes)\nadata.obs        # Cell metadata (DataFrame)\nadata.var        # Gene metadata (DataFrame)\nadata.uns        # Unstructured annotations (dict)\nadata.obsm       # Multi-dimensional cell data (PCA, UMAP)\nadata.raw        # Raw data backup\n\n# Access cell and gene names\nadata.obs_names  # Cell barcodes\nadata.var_names  # Gene names\n```\n\n## Standard Analysis Workflow\n\n### 1. Quality Control\n\nIdentify and filter low-quality cells and genes:\n\n```python\n# Identify mitochondrial genes\nadata.var['mt'] = adata.var_names.str.startswith('MT-')\n\n# Calculate QC metrics\nsc.pp.calculate_qc_metrics(adata, qc_vars=['mt'], inplace=True)\n\n# Visualize QC metrics\nsc.pl.violin(adata, ['n_genes_by_counts', 'total_counts', 'pct_counts_mt'],\n             jitter=0.4, multi_panel=True)\n\n# Filter cells and genes\nsc.pp.filter_cells(adata, min_genes=200)\nsc.pp.filter_genes(adata, min_cells=3)\nadata = adata[adata.obs.pct_counts_mt \u003C 5, :]  # Remove high MT% cells\n```\n\n**Use the QC script for automated analysis:**\n```bash\npython scripts\u002Fqc_analysis.py input_file.h5ad --output filtered.h5ad\n```\n\n### 2. Normalization and Preprocessing\n\n```python\n# Normalize to 10,000 counts per cell\nsc.pp.normalize_total(adata, target_sum=1e4)\n\n# Log-transform\nsc.pp.log1p(adata)\n\n# Save raw counts for later\nadata.raw = adata\n\n# Identify highly variable genes\nsc.pp.highly_variable_genes(adata, n_top_genes=2000)\nsc.pl.highly_variable_genes(adata)\n\n# Subset to highly variable genes\nadata = adata[:, adata.var.highly_variable]\n\n# Regress out unwanted variation\nsc.pp.regress_out(adata, ['total_counts', 'pct_counts_mt'])\n\n# Scale data\nsc.pp.scale(adata, max_value=10)\n```\n\n### 3. Dimensionality Reduction\n\n```python\n# PCA\nsc.tl.pca(adata, svd_solver='arpack')\nsc.pl.pca_variance_ratio(adata, log=True)  # Check elbow plot\n\n# Compute neighborhood graph\nsc.pp.neighbors(adata, n_neighbors=10, n_pcs=40)\n\n# UMAP for visualization\nsc.tl.umap(adata)\nsc.pl.umap(adata, color='leiden')\n\n# Alternative: t-SNE\nsc.tl.tsne(adata)\n```\n\n### 4. Clustering\n\n```python\n# Leiden clustering (recommended)\nsc.tl.leiden(adata, resolution=0.5)\nsc.pl.umap(adata, color='leiden', legend_loc='on data')\n\n# Try multiple resolutions to find optimal granularity\nfor res in [0.3, 0.5, 0.8, 1.0]:\n    sc.tl.leiden(adata, resolution=res, key_added=f'leiden_{res}')\n```\n\n### 5. Marker Gene Identification\n\n```python\n# Find marker genes for each cluster\nsc.tl.rank_genes_groups(adata, 'leiden', method='wilcoxon')\n\n# Visualize results\nsc.pl.rank_genes_groups(adata, n_genes=25, sharey=False)\nsc.pl.rank_genes_groups_heatmap(adata, n_genes=10)\nsc.pl.rank_genes_groups_dotplot(adata, n_genes=5)\n\n# Get results as DataFrame\nmarkers = sc.get.rank_genes_groups_df(adata, group='0')\n```\n\n### 6. Cell Type Annotation\n\n```python\n# Define marker genes for known cell types\nmarker_genes = ['CD3D', 'CD14', 'MS4A1', 'NKG7', 'FCGR3A']\n\n# Visualize markers\nsc.pl.umap(adata, color=marker_genes, use_raw=True)\nsc.pl.dotplot(adata, var_names=marker_genes, groupby='leiden')\n\n# Manual annotation\ncluster_to_celltype = {\n    '0': 'CD4 T cells',\n    '1': 'CD14+ Monocytes',\n    '2': 'B cells',\n    '3': 'CD8 T cells',\n}\nadata.obs['cell_type'] = adata.obs['leiden'].map(cluster_to_celltype)\n\n# Visualize annotated types\nsc.pl.umap(adata, color='cell_type', legend_loc='on data')\n```\n\n### 7. Save Results\n\n```python\n# Save processed data\nadata.write('results\u002Fprocessed_data.h5ad')\n\n# Export metadata\nadata.obs.to_csv('results\u002Fcell_metadata.csv')\nadata.var.to_csv('results\u002Fgene_metadata.csv')\n```\n\n## Common Tasks\n\n### Creating Publication-Quality Plots\n\n```python\n# Set high-quality defaults\nsc.settings.set_figure_params(dpi=300, frameon=False, figsize=(5, 5))\nsc.settings.file_format_figs = 'pdf'\n\n# UMAP with custom styling\nsc.pl.umap(adata, color='cell_type',\n           palette='Set2',\n           legend_loc='on data',\n           legend_fontsize=12,\n           legend_fontoutline=2,\n           frameon=False,\n           save='_publication.pdf')\n\n# Heatmap of marker genes\nsc.pl.heatmap(adata, var_names=genes, groupby='cell_type',\n              swap_axes=True, show_gene_labels=True,\n              save='_markers.pdf')\n\n# Dot plot\nsc.pl.dotplot(adata, var_names=genes, groupby='cell_type',\n              save='_dotplot.pdf')\n```\n\nRefer to `references\u002Fplotting_guide.md` for comprehensive visualization examples.\n\n### Trajectory Inference\n\n```python\n# PAGA (Partition-based graph abstraction)\nsc.tl.paga(adata, groups='leiden')\nsc.pl.paga(adata, color='leiden')\n\n# Diffusion pseudotime\nadata.uns['iroot'] = np.flatnonzero(adata.obs['leiden'] == '0')[0]\nsc.tl.dpt(adata)\nsc.pl.umap(adata, color='dpt_pseudotime')\n```\n\n### Differential Expression Between Conditions\n\n```python\n# Compare treated vs control within cell types\nadata_subset = adata[adata.obs['cell_type'] == 'T cells']\nsc.tl.rank_genes_groups(adata_subset, groupby='condition',\n                         groups=['treated'], reference='control')\nsc.pl.rank_genes_groups(adata_subset, groups=['treated'])\n```\n\n### Gene Set Scoring\n\n```python\n# Score cells for gene set expression\ngene_set = ['CD3D', 'CD3E', 'CD3G']\nsc.tl.score_genes(adata, gene_set, score_name='T_cell_score')\nsc.pl.umap(adata, color='T_cell_score')\n```\n\n### Batch Correction\n\n```python\n# ComBat batch correction\nsc.pp.combat(adata, key='batch')\n\n# Alternative: use Harmony or scVI (separate packages)\n```\n\n## Key Parameters to Adjust\n\n### Quality Control\n- `min_genes`: Minimum genes per cell (typically 200-500)\n- `min_cells`: Minimum cells per gene (typically 3-10)\n- `pct_counts_mt`: Mitochondrial threshold (typically 5-20%)\n\n### Normalization\n- `target_sum`: Target counts per cell (default 1e4)\n\n### Feature Selection\n- `n_top_genes`: Number of HVGs (typically 2000-3000)\n- `min_mean`, `max_mean`, `min_disp`: HVG selection parameters\n\n### Dimensionality Reduction\n- `n_pcs`: Number of principal components (check variance ratio plot)\n- `n_neighbors`: Number of neighbors (typically 10-30)\n\n### Clustering\n- `resolution`: Clustering granularity (0.4-1.2, higher = more clusters)\n\n## Common Pitfalls and Best Practices\n\n1. **Always save raw counts**: `adata.raw = adata` before filtering genes\n2. **Check QC plots carefully**: Adjust thresholds based on dataset quality\n3. **Use Leiden over Louvain**: More efficient and better results\n4. **Try multiple clustering resolutions**: Find optimal granularity\n5. **Validate cell type annotations**: Use multiple marker genes\n6. **Use `use_raw=True` for gene expression plots**: Shows original counts\n7. **Check PCA variance ratio**: Determine optimal number of PCs\n8. **Save intermediate results**: Long workflows can fail partway through\n\n## Bundled Resources\n\n### scripts\u002Fqc_analysis.py\nAutomated quality control script that calculates metrics, generates plots, and filters data:\n\n```bash\npython scripts\u002Fqc_analysis.py input.h5ad --output filtered.h5ad \\\n    --mt-threshold 5 --min-genes 200 --min-cells 3\n```\n\n### references\u002Fstandard_workflow.md\nComplete step-by-step workflow with detailed explanations and code examples for:\n- Data loading and setup\n- Quality control with visualization\n- Normalization and scaling\n- Feature selection\n- Dimensionality reduction (PCA, UMAP, t-SNE)\n- Clustering (Leiden, Louvain)\n- Marker gene identification\n- Cell type annotation\n- Trajectory inference\n- Differential expression\n\nRead this reference when performing a complete analysis from scratch.\n\n### references\u002Fapi_reference.md\nQuick reference guide for scanpy functions organized by module:\n- Reading\u002Fwriting data (`sc.read_*`, `adata.write_*`)\n- Preprocessing (`sc.pp.*`)\n- Tools (`sc.tl.*`)\n- Plotting (`sc.pl.*`)\n- AnnData structure and manipulation\n- Settings and utilities\n\nUse this for quick lookup of function signatures and common parameters.\n\n### references\u002Fplotting_guide.md\nComprehensive visualization guide including:\n- Quality control plots\n- Dimensionality reduction visualizations\n- Clustering visualizations\n- Marker gene plots (heatmaps, dot plots, violin plots)\n- Trajectory and pseudotime plots\n- Publication-quality customization\n- Multi-panel figures\n- Color palettes and styling\n\nConsult this when creating publication-ready figures.\n\n### assets\u002Fanalysis_template.py\nComplete analysis template providing a full workflow from data loading through cell type annotation. Copy and customize this template for new analyses:\n\n```bash\ncp assets\u002Fanalysis_template.py my_analysis.py\n# Edit parameters and run\npython my_analysis.py\n```\n\nThe template includes all standard steps with configurable parameters and helpful comments.\n\n## Additional Resources\n\n- **Official scanpy documentation**: https:\u002F\u002Fscanpy.readthedocs.io\u002F\n- **Scanpy tutorials**: https:\u002F\u002Fscanpy-tutorials.readthedocs.io\u002F\n- **scverse ecosystem**: https:\u002F\u002Fscverse.org\u002F (related tools: squidpy, scvi-tools, cellrank)\n- **Best practices**: Luecken & Theis (2019) \"Current best practices in single-cell RNA-seq\"\n\n## Tips for Effective Analysis\n\n1. **Start with the template**: Use `assets\u002Fanalysis_template.py` as a starting point\n2. **Run QC script first**: Use `scripts\u002Fqc_analysis.py` for initial filtering\n3. **Consult references as needed**: Load workflow and API references into context\n4. **Iterate on clustering**: Try multiple resolutions and visualization methods\n5. **Validate biologically**: Check marker genes match expected cell types\n6. **Document parameters**: Record QC thresholds and analysis settings\n7. **Save checkpoints**: Write intermediate results at key steps\n","# Scanpy: Single-Cell Analysis\n\n## Overview\n\nScanpy is a scalable Python toolkit for analyzing single-cell RNA-seq data, built on AnnData. Apply this skill for complete single-cell workflows including quality control, normalization, dimensionality reduction, clustering, marker gene identification, visualization, and trajectory analysis.\n\n## When to Use This Skill\n\nThis skill should be used when:\n- Analyzing single-cell RNA-seq data (.h5ad, 10X, CSV formats)\n- Performing quality control on scRNA-seq datasets\n- Creating UMAP, t-SNE, or PCA visualizations\n- Identifying cell clusters and finding marker genes\n- Annotating cell types based on gene expression\n- Conducting trajectory inference or pseudotime analysis\n- Generating publication-quality single-cell plots\n\n## Quick Start\n\n### Basic Import and Setup\n\n```python\nimport scanpy as sc\nimport pandas as pd\nimport numpy as np\n\n# Configure settings\n# sc.settings.verbosity = 'hint'  # enable for debugging\nsc.settings.figdir = '.\u002Ffigures\u002F'\nsc.print_header()  # in notebooks\n```\n\n### Loading Data\n\n```python\n# From 10X Genomics\nadata = sc.read_10x_mtx('path\u002Fto\u002Fdata\u002F')\nadata = sc.read_10x_h5('path\u002Fto\u002Fdata.h5')\n\n# From h5ad (AnnData format)\nadata = sc.read_h5ad('path\u002Fto\u002Fdata.h5ad')\n\n# From CSV\nadata = sc.read_csv('path\u002Fto\u002Fdata.csv')\n```\n\n### Understanding AnnData Structure\n\nThe AnnData object is the core data structure in scanpy:\n\n```python\nadata.X          # Expression matrix (cells × genes)\nadata.obs        # Cell metadata (DataFrame)\nadata.var        # Gene metadata (DataFrame)\nadata.uns        # Unstructured annotations (dict)\nadata.obsm       # Multi-dimensional cell data (PCA, UMAP)\nadata.raw        # Raw data backup\n\n# Access cell and gene names\nadata.obs_names  # Cell barcodes\nadata.var_names  # Gene names\n```\n\n## Standard Analysis Workflow\n\n### 1. Quality Control\n\nIdentify and filter low-quality cells and genes:\n\n```python\n# Identify mitochondrial genes\nadata.var['mt'] = adata.var_names.str.startswith('MT-')\n\n# Calculate QC metrics\nsc.pp.calculate_qc_metrics(adata, qc_vars=['mt'], inplace=True)\n\n# Visualize QC metrics\nsc.pl.violin(adata, ['n_genes_by_counts', 'total_counts', 'pct_counts_mt'],\n             jitter=0.4, multi_panel=True)\n\n# Filter cells and genes\nsc.pp.filter_cells(adata, min_genes=200)\nsc.pp.filter_genes(adata, min_cells=3)\nadata = adata[adata.obs.pct_counts_mt \u003C 5, :]  # Remove high MT% cells\n```\n\n**Use the QC script for automated analysis:**\n```bash\npython scripts\u002Fqc_analysis.py input_file.h5ad --output filtered.h5ad\n```\n\n### 2. Normalization and Preprocessing\n\n```python\n# Normalize to 10,000 counts per cell\nsc.pp.normalize_total(adata, target_sum=1e4)\n\n# Log-transform\nsc.pp.log1p(adata)\n\n# Save raw counts for later\nadata.raw = adata\n\n# Identify highly variable genes\nsc.pp.highly_variable_genes(adata, n_top_genes=2000)\nsc.pl.highly_variable_genes(adata)\n\n# Subset to highly variable genes\nadata = adata[:, adata.var.highly_variable]\n\n# Regress out unwanted variation\nsc.pp.regress_out(adata, ['total_counts', 'pct_counts_mt'])\n\n# Scale data\nsc.pp.scale(adata, max_value=10)\n```\n\n### 3. Dimensionality Reduction\n\n```python\n# PCA\nsc.tl.pca(adata, svd_solver='arpack')\nsc.pl.pca_variance_ratio(adata, log=True)  # Check elbow plot\n\n# Compute neighborhood graph\nsc.pp.neighbors(adata, n_neighbors=10, n_pcs=40)\n\n# UMAP for visualization\nsc.tl.umap(adata)\nsc.pl.umap(adata, color='leiden')\n\n# Alternative: t-SNE\nsc.tl.tsne(adata)\n```\n\n### 4. Clustering\n\n```python\n# Leiden clustering (recommended)\nsc.tl.leiden(adata, resolution=0.5)\nsc.pl.umap(adata, color='leiden', legend_loc='on data')\n\n# Try multiple resolutions to find optimal granularity\nfor res in [0.3, 0.5, 0.8, 1.0]:\n    sc.tl.leiden(adata, resolution=res, key_added=f'leiden_{res}')\n```\n\n### 5. Marker Gene Identification\n\n```python\n# Find marker genes for each cluster\nsc.tl.rank_genes_groups(adata, 'leiden', method='wilcoxon')\n\n# Visualize results\nsc.pl.rank_genes_groups(adata, n_genes=25, sharey=False)\nsc.pl.rank_genes_groups_heatmap(adata, n_genes=10)\nsc.pl.rank_genes_groups_dotplot(adata, n_genes=5)\n\n# Get results as DataFrame\nmarkers = sc.get.rank_genes_groups_df(adata, group='0')\n```\n\n### 6. Cell Type Annotation\n\n```python\n# Define marker genes for known cell types\nmarker_genes = ['CD3D', 'CD14', 'MS4A1', 'NKG7', 'FCGR3A']\n\n# Visualize markers\nsc.pl.umap(adata, color=marker_genes, use_raw=True)\nsc.pl.dotplot(adata, var_names=marker_genes, groupby='leiden')\n\n# Manual annotation\ncluster_to_celltype = {\n    '0': 'CD4 T cells',\n    '1': 'CD14+ Monocytes',\n    '2': 'B cells',\n    '3': 'CD8 T cells',\n}\nadata.obs['cell_type'] = adata.obs['leiden'].map(cluster_to_celltype)\n\n# Visualize annotated types\nsc.pl.umap(adata, color='cell_type', legend_loc='on data')\n```\n\n### 7. Save Results\n\n```python\n# Save processed data\nadata.write('results\u002Fprocessed_data.h5ad')\n\n# Export metadata\nadata.obs.to_csv('results\u002Fcell_metadata.csv')\nadata.var.to_csv('results\u002Fgene_metadata.csv')\n```\n\n## Common Tasks\n\n### Creating Publication-Quality Plots\n\n```python\n# Set high-quality defaults\nsc.settings.set_figure_params(dpi=300, frameon=False, figsize=(5, 5))\nsc.settings.file_format_figs = 'pdf'\n\n# UMAP with custom styling\nsc.pl.umap(adata, color='cell_type',\n           palette='Set2',\n           legend_loc='on data',\n           legend_fontsize=12,\n           legend_fontoutline=2,\n           frameon=False,\n           save='_publication.pdf')\n\n# Heatmap of marker genes\nsc.pl.heatmap(adata, var_names=genes, groupby='cell_type',\n              swap_axes=True, show_gene_labels=True,\n              save='_markers.pdf')\n\n# Dot plot\nsc.pl.dotplot(adata, var_names=genes, groupby='cell_type',\n              save='_dotplot.pdf')\n```\n\nRefer to `references\u002Fplotting_guide.md` for comprehensive visualization examples.\n\n### Trajectory Inference\n\n```python\n# PAGA (Partition-based graph abstraction)\nsc.tl.paga(adata, groups='leiden')\nsc.pl.paga(adata, color='leiden')\n\n# Diffusion pseudotime\nadata.uns['iroot'] = np.flatnonzero(adata.obs['leiden'] == '0')[0]\nsc.tl.dpt(adata)\nsc.pl.umap(adata, color='dpt_pseudotime')\n```\n\n### Differential Expression Between Conditions\n\n```python\n# Compare treated vs control within cell types\nadata_subset = adata[adata.obs['cell_type'] == 'T cells']\nsc.tl.rank_genes_groups(adata_subset, groupby='condition',\n                         groups=['treated'], reference='control')\nsc.pl.rank_genes_groups(adata_subset, groups=['treated'])\n```\n\n### Gene Set Scoring\n\n```python\n# Score cells for gene set expression\ngene_set = ['CD3D', 'CD3E', 'CD3G']\nsc.tl.score_genes(adata, gene_set, score_name='T_cell_score')\nsc.pl.umap(adata, color='T_cell_score')\n```\n\n### Batch Correction\n\n```python\n# ComBat batch correction\nsc.pp.combat(adata, key='batch')\n\n# Alternative: use Harmony or scVI (separate packages)\n```\n\n## Key Parameters to Adjust\n\n### Quality Control\n- `min_genes`: Minimum genes per cell (typically 200-500)\n- `min_cells`: Minimum cells per gene (typically 3-10)\n- `pct_counts_mt`: Mitochondrial threshold (typically 5-20%)\n\n### Normalization\n- `target_sum`: Target counts per cell (default 1e4)\n\n### Feature Selection\n- `n_top_genes`: Number of HVGs (typically 2000-3000)\n- `min_mean`, `max_mean`, `min_disp`: HVG selection parameters\n\n### Dimensionality Reduction\n- `n_pcs`: Number of principal components (check variance ratio plot)\n- `n_neighbors`: Number of neighbors (typically 10-30)\n\n### Clustering\n- `resolution`: Clustering granularity (0.4-1.2, higher = more clusters)\n\n## Common Pitfalls and Best Practices\n\n1. **Always save raw counts**: `adata.raw = adata` before filtering genes\n2. **Check QC plots carefully**: Adjust thresholds based on dataset quality\n3. **Use Leiden over Louvain**: More efficient and better results\n4. **Try multiple clustering resolutions**: Find optimal granularity\n5. **Validate cell type annotations**: Use multiple marker genes\n6. **Use `use_raw=True` for gene expression plots**: Shows original counts\n7. **Check PCA variance ratio**: Determine optimal number of PCs\n8. **Save intermediate results**: Long workflows can fail partway through\n\n## Bundled Resources\n\n### scripts\u002Fqc_analysis.py\nAutomated quality control script that calculates metrics, generates plots, and filters data:\n\n```bash\npython scripts\u002Fqc_analysis.py input.h5ad --output filtered.h5ad \\\n    --mt-threshold 5 --min-genes 200 --min-cells 3\n```\n\n### references\u002Fstandard_workflow.md\nComplete step-by-step workflow with detailed explanations and code examples for:\n- Data loading and setup\n- Quality control with visualization\n- Normalization and scaling\n- Feature selection\n- Dimensionality reduction (PCA, UMAP, t-SNE)\n- Clustering (Leiden, Louvain)\n- Marker gene identification\n- Cell type annotation\n- Trajectory inference\n- Differential expression\n\nRead this reference when performing a complete analysis from scratch.\n\n### references\u002Fapi_reference.md\nQuick reference guide for scanpy functions organized by module:\n- Reading\u002Fwriting data (`sc.read_*`, `adata.write_*`)\n- Preprocessing (`sc.pp.*`)\n- Tools (`sc.tl.*`)\n- Plotting (`sc.pl.*`)\n- AnnData structure and manipulation\n- Settings and utilities\n\nUse this for quick lookup of function signatures and common parameters.\n\n### references\u002Fplotting_guide.md\nComprehensive visualization guide including:\n- Quality control plots\n- Dimensionality reduction visualizations\n- Clustering visualizations\n- Marker gene plots (heatmaps, dot plots, violin plots)\n- Trajectory and pseudotime plots\n- Publication-quality customization\n- Multi-panel figures\n- Color palettes and styling\n\nConsult this when creating publication-ready figures.\n\n### assets\u002Fanalysis_template.py\nComplete analysis template providing a full workflow from data loading through cell type annotation. Copy and customize this template for new analyses:\n\n```bash\ncp assets\u002Fanalysis_template.py my_analysis.py\n# Edit parameters and run\npython my_analysis.py\n```\n\nThe template includes all standard steps with configurable parameters and helpful comments.\n\n## Additional Resources\n\n- **Official scanpy documentation**: https:\u002F\u002Fscanpy.readthedocs.io\u002F\n- **Scanpy tutorials**: https:\u002F\u002Fscanpy-tutorials.readthedocs.io\u002F\n- **scverse ecosystem**: https:\u002F\u002Fscverse.org\u002F (related tools: squidpy, scvi-tools, cellrank)\n- **Best practices**: Luecken & Theis (2019) \"Current best practices in single-cell RNA-seq\"\n\n## Tips for Effective Analysis\n\n1. **Start with the template**: Use `assets\u002Fanalysis_template.py` as a starting point\n2. **Run QC script first**: Use `scripts\u002Fqc_analysis.py` for initial filtering\n3. **Consult references as needed**: Load workflow and API references into context\n4. **Iterate on clustering**: Try multiple resolutions and visualization methods\n5. **Validate biologically**: Check marker genes match expected cell types\n6. **Document parameters**: Record QC thresholds and analysis settings\n7. **Save checkpoints**: Write intermediate results at key steps\n",{"name":5,"description":7},"main","a6e6f93e9a4baaa6ff337aee5505bf5c2bae4ce6","cli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscanpy",3909,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates","https:\u002F\u002Faitmpl.com","https:\u002F\u002Fgithub.com\u002Fdavila7","https:\u002F\u002Fdanielavila.me","Building AI dev tools with LLMs","2026-11-11 11:53:30",{"source":8,"skillName":5,"commands":59,"prompt":69,"zipAvailable":70},[60,63,66],{"tool":61,"command":62},"npx","npx skills add davila7\u002Fclaude-code-templates --skill scanpy",{"tool":64,"command":65},"bunx","bunx skills add davila7\u002Fclaude-code-templates --skill scanpy",{"tool":67,"command":68},"pnpm","pnpm dlx skills add davila7\u002Fclaude-code-templates --skill scanpy","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscanpy\u002FSKILL.md",true,[72,78,84,88,92],{"path":73,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":76,"sourceHtmlUrl":77},"assets\u002Fanalysis_template.py","SCRIPT","脚本",9515,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscanpy\u002Fassets\u002Fanalysis_template.py",{"path":79,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":82,"sourceHtmlUrl":83},"references\u002Fapi_reference.md","REFERENCE","参考文档",7415,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscanpy\u002Freferences\u002Fapi_reference.md",{"path":85,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":86,"sourceHtmlUrl":87},"references\u002Fplotting_guide.md",9695,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscanpy\u002Freferences\u002Fplotting_guide.md",{"path":89,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":90,"sourceHtmlUrl":91},"references\u002Fstandard_workflow.md",5529,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscanpy\u002Freferences\u002Fstandard_workflow.md",{"path":93,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":94,"sourceHtmlUrl":95},"scripts\u002Fqc_analysis.py",6706,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fscanpy\u002Fscripts\u002Fqc_analysis.py",[97,124,151,184,219,243],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":104,"publishedAt":43},"01M70NHBTQ8BV0A2SCAZXEPHCX","wealthville-pool-scoring","Score DeFi liquidity pools before providing liquidity. Returns a 0-100 pool score and an Enter\u002FHold\u002FExit\u002FReduce\u002FAvoid verdict with calibrated confidence for ~68,800 Solana pools and 575 EVM pools, plus a public miss-inclusive track record. Use when asked whether a pool is worth LPing into, which pools look best right now, or how accurate the scores have actually been.","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fweb-data\u002Fwealthville-pool-scoring\u002FSKILL.md",[103],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[105,106,107,108,109,26,110,111,112,113,114,115,116,117,118,119,120,121,122,123],"scoring","pool","wealthville pool scoring","liquidity","which","exit","now","use","when","reduce","with","record","track","verdict","evm","solana","how","public","look",{"skillNo":125,"name":126,"nameZh":6,"description":127,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":128,"categories":129,"keywords":131,"publishedAt":43},"01M70MB6VR8ERJ4EM8D5KHBMEV","technical-debt-auditor","Scans a codebase and produces a quantified technical debt report with a prioritized remediation plan. Analyzes dead code, TODO\u002FFIXME\u002FHACK markers, dependency staleness, complexity hotspots, code duplication signals, test coverage gaps, unused exports, and outdated patterns. Use this skill when the user asks to audit their codebase for tech debt, wants a health check of their code quality, says things like \"where should I focus refactoring\", \"find code smells\", \"audit my codebase\", \"what technical debt do we have\", \"prioritize cleanup work\", or asks about code quality metrics. Also trigger when the user mentions \"code rot\", \"legacy cleanup\", \"refactoring priorities\", or wants to understand the overall health of a project before a major effort. Trigger even if the user doesn't say \"technical debt\" explicitly — any request to systematically assess code quality and identify improvement priorities belongs here.","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Ftechnical-debt-auditor\u002FSKILL.md",[130],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[132,133,134,135,136,137,138,139,140,141,142,113,143,144,145,146,147,148,149,150],"technical debt","debt","technical","technical debt auditor","auditor","coverage","complexity","markers","project","cleanup","unused","code","todo","work","plan","focus","signals","audit","dependency",{"skillNo":152,"name":153,"nameZh":6,"description":154,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":155,"categories":156,"keywords":166,"publishedAt":43},"01M70KPYH9QNHCNME5GJQGE22K","readonly-sql-guard","Make an agent's database access provably read-only. Use when an agent runs caller-supplied SQL against a production\u002FERP\u002Fanalytics database (a \"query\" MCP tool, text-to-SQL, an admin console), or when reviewing DB-access code for write\u002FDDL\u002Fside-effect\u002Ftransaction-escape risks. Checks what a statement CALLS, not just its shape.","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdatabase\u002Freadonly-sql-guard\u002FSKILL.md",[157,160,161],{"categoryNo":158,"categoryName":159,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":162,"categoryName":163,"taxonomyType":164,"taxonomyTypeDesc":165},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[167,168,169,170,171,172,173,26,174,175,176,177,178,179,180,112,181,182,113,183],"readonly","guard","sql guard","sql","readonly sql guard","erp","effect","read-only","db","just","tool","calls","only","MCP","access","database","query",{"skillNo":185,"name":186,"nameZh":6,"description":187,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":188,"licenseFileUrl":189,"sourceHtmlUrl":190,"categories":191,"keywords":195,"publishedAt":43},"01M6AFY6F7CC2BBZP1QD6VTNVC","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FSKILL.md",[192],{"categoryNo":193,"categoryName":194,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发",[196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,26,218],"artifacts builder","web","web artifacts builder","artifacts","builder","state","routing","state management","component","css","frontend","ui","Tools","file","components","shadcn","react","Tailwind","suite","jsx","html","single-file","ui components",{"skillNo":220,"name":221,"nameZh":6,"description":222,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":188,"licenseFileUrl":223,"sourceHtmlUrl":224,"categories":225,"keywords":230,"publishedAt":43},"01M6AFWF33SFV9Z3SF4PEEE4BF","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FSKILL.md",[226,229],{"categoryNo":227,"categoryName":228,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":193,"categoryName":194,"taxonomyType":21,"taxonomyTypeDesc":22},[231,232,233,234,235,197,236,206,207,237,238,239,240,26,241,115,242],"webapp testing","testing","webapp","browser","playwright","applications","debugging","toolkit","logs","screenshots","local","behavior",{"skillNo":244,"name":245,"nameZh":6,"description":246,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":188,"licenseFileUrl":247,"sourceHtmlUrl":248,"categories":249,"keywords":257,"publishedAt":43},"01M6AF67Q67JJJ5V51JR2P52KA","discernment-nudge","After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals, or emails, estimates or projections, analysis or interpretation of data, factual claims they may rely on, or a multi-step argument — invoke this skill BEFORE finalizing your reply and then, if it applies, append 2-3 short follow-up questions, each tied to something specific in what you just produced, that help the user check key facts, probe the reasoning or assumptions, and notice missing context. Do this at most once per conversation. Skip it when the user asked a trivial how-to or simple lookup, wants a purely educational explanation, asked you only to format, convert, or assemble a file from content they provided, is writing code they will run, is doing creative writing or casual chat, or already asked you to double-check, cite, or review — the skill file explains these boundaries and the exact output format.","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fdiscernment-nudge\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fdiscernment-nudge\u002FSKILL.md",[250,253,254],{"categoryNo":251,"categoryName":252,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":255,"categoryName":256,"taxonomyType":164,"taxonomyTypeDesc":165},"01JBSEEDCAT000000000000036","内容创作者",[258,259,260,261,262,263,34,264,199,265,209,143,266,267,268,269,270,179,271,113,272,41,273,274,275,121,276],"discernment nudge","nudge","interpretation","help","run","reasoning","writing","lookup","content","review","conversation","short","up","invoke","you","claims","argument","assemble","recommendations"]