[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73J957XVQDFV06CHPCS0FTA":3,"skill-same:01M73J957XVQDFV06CHPCS0FTA":48},{"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":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M73J957XVQDFV06CHPCS0FTA","samtools-bam-processing",null,"CLI toolkit for SAM\u002FBAM\u002FCRAM: sort, index, convert, filter, QC alignments. Core commands: view, sort, index, flagstat, stats, depth, markdup, merge. Required between alignment and variant\u002Fpeak calling. Use pysam for Python-native BAM access; deeptools for normalized coverage tracks.","bg-szy\u002FTOP-SKILLS","bg-szy","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F106576190?v=4","01M73A4E8KPV67SFXRY8XZGNBX","ShuZhiyong","01M73A4E96MQ294MHM74TZBVQD",6,"MIT","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fawesome-skills\u002Fsamtools-bam-processing\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: \"samtools-bam-processing\"\ndescription: \"CLI toolkit for SAM\u002FBAM\u002FCRAM: sort, index, convert, filter, QC alignments. Core commands: view, sort, index, flagstat, stats, depth, markdup, merge. Required between alignment and variant\u002Fpeak calling. Use pysam for Python-native BAM access; deeptools for normalized coverage tracks.\"\nlicense: \"MIT\"\n---\n\n# samtools — SAM\u002FBAM\u002FCRAM Alignment Toolkit\n\n## Overview\n\nsamtools is the standard command-line toolkit for processing sequence alignment files in SAM, BAM, and CRAM formats. It handles the complete alignment file lifecycle: format conversion, coordinate sorting, index creation, quality control statistics, read filtering, duplicate marking, and multi-file merging. samtools is a near-universal component of NGS pipelines between alignment (STAR, BWA) and downstream analysis (variant calling, peak calling, coverage).\n\n## When to Use\n\n- Sorting BAM files by coordinate after alignment (required before indexing)\n- Indexing sorted BAM files for random access and region queries\n- Converting between SAM, BAM, and CRAM formats to save storage\n- Generating alignment QC metrics: mapping rates, insert sizes, per-chromosome stats\n- Filtering reads by mapping quality, FLAG bits, or genomic regions\n- Marking or removing PCR duplicates before variant calling\n- Merging multiple BAM files from different lanes or samples\n- Calculating per-base depth or coverage breadth for target regions\n- Use `pysam` instead for Python-native BAM manipulation in custom scripts\n- Use `deeptools bamCoverage` instead when you need normalized bigWig coverage tracks\n- Use `mosdepth` instead for whole-genome per-base depth (faster, parallelized)\n\n## Prerequisites\n\n- **Installation**: samtools 1.17+ recommended\n- **Input requirements**: SAM\u002FBAM\u002FCRAM files; CRAM requires FASTA reference\n- **Companion tools**: `samtools faidx` for FASTA indexing; `samtools sort` before `samtools index`\n\n> **Check before installing**: The tool may already be available in the current environment (e.g., inside a `pixi` \u002F `conda` env). Run `command -v samtools` first and skip the install commands below if it returns a path. When running inside a pixi project, invoke the tool via `pixi run samtools` rather than bare `samtools`.\n\n```bash\n# Bioconda (recommended)\nconda install -c bioconda samtools\n\n# Homebrew (macOS)\nbrew install samtools\n\n# Verify\nsamtools --version | head -1\n```\n\n## Pre-flight Interview\n\nSettle these with the user before writing any analysis code.\n\n```yaml\ndecisions:\n  - id: D1\n    param: mappingQualityFloor\n    kind: required\n    source: user\n    ask: \"Below what mapping confidence should reads be dropped? Everything counted downstream inherits this cut.\"\n    default: \"0 - keep every alignment, including ambiguously placed ones\"\n\n  - id: D2\n    param: flagFilter\n    kind: required\n    source: user\n    ask: \"Which read classes should be excluded - unmapped, secondary, supplementary, failed-QC, duplicates?\"\n    default: \"keep all classes\"\n\n  - id: D3\n    param: duplicateHandling\n    kind: required\n    source: user\n    ask: \"Should duplicates be marked and left in place, or physically removed from the file?\"\n    default: \"marked, not removed - downstream tools can then choose\"\n\n  - id: D4\n    param: sortOrder\n    kind: derived\n    source: upstream\n    ask: \"Does the next step need coordinate order, or name order for mate pairing?\"\n    default: \"coordinate\"\n\n  - id: D5\n    param: outputFormat\n    kind: optional\n    source: user\n    ask: \"Write BAM, or CRAM against a reference to save space?\"\n    default: \"BAM\"\n\n  - id: D6\n    param: opticalDuplicateDistance\n    kind: optional_conditional\n    source: data\n    ask: \"Should optical duplicates be distinguished from PCR duplicates, using this platform's pixel distance?\"\n    default: \"not distinguished\"\n\n  - id: D7\n    param: threadsAndMemory\n    kind: never_ask\n    source: data\n    reason: \"Compression threads and per-thread sort memory affect runtime and peak RAM, not the records\"\n    default: \"available cores, 768M per thread\"\n```\n\nD1 and D2 look like plumbing and are not. A MAPQ floor silently removes\nmulti-mapping regions - paralogs, recent duplications, repeat-adjacent genes -\nfrom everything computed afterwards, and a run that keeps secondary alignments\ncounts the same fragment several times. Neither is visible in the output\nfile.\n\n## Quick Start\n\n```bash\n# Typical post-alignment workflow: sort → index → QC\nsamtools sort -@ 8 -o sorted.bam input.bam\nsamtools index sorted.bam\nsamtools flagstat sorted.bam\n```\n\n## Core API\n\n### Module 1: BAM\u002FSAM I\u002FO and Format Conversion\n\nConvert between SAM\u002FBAM\u002FCRAM formats and extract subsets.\n\n```bash\n# SAM → BAM (saves ~75% disk space)\nsamtools view -b -h input.sam -o output.bam\n\n# BAM → CRAM (saves additional 40-50%)\nsamtools view -C -T reference.fa input.bam -o output.cram\n\n# Filter: mapping quality ≥20, exclude unmapped (-F 4)\nsamtools view -q 20 -F 4 input.bam -o filtered.bam\n\n# Extract specific region (requires index)\nsamtools view -h sorted.bam \"chr1:1000000-2000000\" -o region.bam\n\n# Count reads matching filter\nsamtools view -c -F 4 input.bam\n# Output: 45231923 (number of mapped reads)\n```\n\n```bash\n# Extract reads as FASTQ (for realignment or de novo assembly)\nsamtools fastq -@ 4 -1 R1.fastq.gz -2 R2.fastq.gz -0 unpaired.fastq.gz input.bam\n\n# Extract reads as FASTA\nsamtools fasta input.bam > reads.fasta\n\n# Filter by read group\nsamtools view -r SAMPLE_001 multi_rg.bam -o sample001.bam\n```\n\n### Module 2: Sorting and Indexing\n\nOrganize BAM files for efficient random access.\n\n```bash\n# Sort by coordinate (required before indexing)\nsamtools sort -@ 8 -m 2G input.bam -o sorted.bam\n\n# Sort by read name (required for fixmate\u002Fmarkdup)\nsamtools sort -n -@ 8 input.bam -o namesorted.bam\n\n# Index sorted BAM (creates sorted.bam.bai)\nsamtools index sorted.bam\n\n# For chromosomes > 512 Mbp: use CSI index instead\nsamtools index -c sorted.bam\n\n# Group reads by name (fast, for fixmate — no full sort needed)\nsamtools collate -o collated.bam input.bam\n```\n\n### Module 3: Quality Control and Statistics\n\nGenerate alignment QC metrics and coverage reports.\n\n```bash\n# Quick summary: total, mapped, paired, properly paired\nsamtools flagstat sorted.bam\n# Example output:\n# 50000000 + 0 in total (QC-passed reads + QC-failed reads)\n# 48523111 + 0 mapped (97.05% : N\u002FA)\n# 50000000 + 0 paired in sequencing\n# 48490234 + 0 properly paired (96.98% : N\u002FA)\n\n# Per-chromosome mapped\u002Funmapped read counts\nsamtools idxstats sorted.bam\n# chr1  248956422  12345678  0\n# chr2  242193529  11234567  0\n\n# Comprehensive stats (insert sizes, GC content, base quality)\nsamtools stats -r reference.fa sorted.bam > full_stats.txt\ngrep \"^SN\" full_stats.txt | cut -f2,3  # Summary Numbers only\n\n# Coverage report (min\u002Fmax\u002Fmean per region\u002Fchromosome)\nsamtools coverage sorted.bam\n```\n\n```bash\n# Per-base read depth for specific regions\nsamtools depth -b target_regions.bed sorted.bam > depth.txt\n# Output: chr  pos  depth (e.g., chr1  1000  45)\n\n# Statistics split by read group\nsamtools stats -S RG sorted.bam > per_rg_stats.txt\n```\n\n### Module 4: Read Filtering and FLAG Operations\n\nFilter reads using SAM FLAG bits for specific subsets.\n\n```bash\n# FLAG reference — common masks:\n# 1    = paired         4  = unmapped\n# 2    = proper pair    8  = mate unmapped\n# 16   = reverse strand 64 = R1 (first in pair)\n# 128  = R2             256= secondary alignment\n# 1024 = PCR duplicate  2048= supplementary\n\n# Extract properly paired, mapped reads (FLAG 2 set, 4 unset)\nsamtools view -f 2 -F 4 sorted.bam -o proper_pairs.bam\n\n# Extract R1 reads only\nsamtools view -f 64 sorted.bam -o R1.bam\n\n# Remove secondary and supplementary alignments\nsamtools view -F 2304 sorted.bam -o primary.bam\n\n# Extract reads from BED file regions\nsamtools view -L regions.bed -b sorted.bam -o regions.bam\n```\n\n### Module 5: Duplicate Handling\n\nMark or remove PCR duplicates before variant calling.\n\n```bash\n# Full duplicate marking workflow (collate → fixmate → sort → markdup)\nsamtools collate -@ 8 -o collated.bam input.bam\nsamtools fixmate -m -@ 8 collated.bam fixmated.bam\nsamtools sort -@ 8 -o sorted.bam fixmated.bam\nsamtools markdup -@ 8 sorted.bam marked.bam\nsamtools index marked.bam\n\n# Check duplication rate\nsamtools flagstat marked.bam | grep \"duplicates\"\n# Output: 2345678 + 0 duplicates (4.83%)\n```\n\n```bash\n# NovaSeq optical duplicate detection (2500 pixel distance)\nsamtools markdup -d 2500 sorted.bam marked_novaseq.bam\n\n# Remove duplicates instead of marking\nsamtools markdup -r sorted.bam deduped.bam\n\n# Get duplication stats without writing output\nsamtools markdup -s sorted.bam \u002Fdev\u002Fnull\n```\n\n### Module 6: Multi-file Operations and Region Analysis\n\nMerge BAM files and perform region-level analysis.\n\n```bash\n# Merge multiple BAM files (all must be sorted)\nsamtools merge -@ 8 merged.bam lane1.bam lane2.bam lane3.bam\n\n# Merge files listed in a text file (one per line)\nsamtools merge -b bam_list.txt -@ 8 merged.bam\n\n# Merge with read group tags from filenames\nsamtools merge -r merged.bam sample1.bam sample2.bam\n\n# Extract specific chromosome region from merged output\nsamtools view -h merged.bam chr1 -b -o chr1.bam\n```\n\n## Key Concepts\n\n### SAM FLAG Bits\n\nFLAGS encode read properties as a sum of bit values. Common filtering patterns:\n\n| Common Filter | `-f` (require) | `-F` (exclude) | Selects |\n|---------------|----------------|----------------|---------|\n| Mapped reads | — | 4 | All aligned reads |\n| Proper pairs | 2 | — | Properly paired, both mapped |\n| Unique primary | — | 2308 | No secondary\u002Fsupplementary\u002Fduplicate |\n| R1 only | 64 | — | First-in-pair reads |\n| Unmapped | 4 | — | Failed to align |\n\n### CRAM vs BAM vs SAM\n\n| Format | Size | Speed | Requires |\n|--------|------|-------|---------|\n| SAM | ~10× BAM | Slow I\u002FO | Nothing |\n| BAM | 1× | Fast | `.bai` index for random access |\n| CRAM | ~0.6× BAM | Slightly slower | Reference FASTA + index |\n\nUse CRAM for long-term storage; BAM for active analysis.\n\n## Common Workflows\n\n### Workflow 1: Post-Alignment QC and Preparation\n\n**Goal**: Convert aligner output to analysis-ready BAM with QC metrics.\n\n```bash\n#!\u002Fbin\u002Fbash\nSAMPLE=\"sample_001\"\nREF=\"reference.fa\"\nTHREADS=8\n\n# 1. Sort and index (aligner often outputs unsorted SAM\u002FBAM)\nsamtools sort -@ $THREADS -o ${SAMPLE}.sorted.bam ${SAMPLE}.bam\nsamtools index ${SAMPLE}.sorted.bam\n\n# 2. QC metrics\nsamtools flagstat ${SAMPLE}.sorted.bam > ${SAMPLE}.flagstat.txt\nsamtools stats -r $REF ${SAMPLE}.sorted.bam > ${SAMPLE}.stats.txt\nsamtools coverage ${SAMPLE}.sorted.bam > ${SAMPLE}.coverage.txt\n\n# 3. Per-chromosome stats\nsamtools idxstats ${SAMPLE}.sorted.bam > ${SAMPLE}.idxstats.txt\n\necho \"QC complete: $(grep 'mapped (' ${SAMPLE}.flagstat.txt | head -1)\"\n```\n\n### Workflow 2: Full Duplicate-Marking Pipeline\n\n**Goal**: Prepare BAM for GATK or other variant callers requiring deduplicated input.\n\n```bash\n#!\u002Fbin\u002Fbash\nINPUT=\"aligned.bam\"\nFINAL=\"deduped.bam\"\nTHREADS=8\n\n# Collate → fixmate → sort → markdup\nsamtools collate -@ $THREADS -o collated.bam $INPUT\nsamtools fixmate -m -@ $THREADS collated.bam fixmated.bam\nsamtools sort -@ $THREADS -o sorted.bam fixmated.bam\nsamtools markdup -@ $THREADS -s sorted.bam $FINAL\n\n# Clean up intermediates\nrm collated.bam fixmated.bam sorted.bam\n\n# Index and verify\nsamtools index $FINAL\nsamtools flagstat $FINAL | grep \"duplic\"\n# Expected: 3-15% duplicates (WGS); 10-30% for amplicon\n```\n\n## Key Parameters\n\n| Parameter | Command | Default | Range\u002FOptions | Effect |\n|-----------|---------|---------|---------------|--------|\n| `-@` | Most | 0 | 1–N cores | Additional compression\u002FI\u002FO threads |\n| `-m` | sort | 768M | e.g., 2G, 4G | Memory per thread for sorting |\n| `-q` | view | 0 | 0–60 | Minimum mapping quality filter |\n| `-f` | view | 0 | FLAG bits | Include reads with ALL bits set |\n| `-F` | view | 0 | FLAG bits | Exclude reads with ANY bit set |\n| `-b` | view | — | flag | Output BAM format |\n| `-C` | view | — | flag | Output CRAM (requires `-T`) |\n| `-T` | view | — | FASTA path | Reference for CRAM output |\n| `-d` | markdup | 0 | 0–2500 | Optical duplicate pixel distance |\n| `-r` | markdup | — | flag | Remove duplicates (vs just mark) |\n| `-n` | sort | — | flag | Sort by read name instead of position |\n| `-c` | index | — | flag | Create CSI index (needed for chr > 512 Mb) |\n\n## Best Practices\n\n1. **Always sort before indexing**: `samtools index` requires coordinate-sorted input. Attempting to index an unsorted BAM will fail or produce incorrect results.\n\n2. **Use `-@` for all production runs**: Most samtools commands are I\u002FO-bound. Adding `-@ 8` provides near-linear speedup for compression\u002Fdecompression with minimal overhead.\n\n3. **Run flagstat before any analysis**: `samtools flagstat` runs in seconds and catches alignment failures (low mapping rate, unexpected paired-end rates) before wasting time on downstream steps.\n\n4. **Use the collate → fixmate → sort → markdup pipeline**: Running `samtools markdup` directly on coordinate-sorted BAM without fixmate produces incorrect duplicate detection. The mate information added by `fixmate -m` is essential.\n\n5. **Prefer CRAM for archiving**: CRAM reduces storage 40-50% vs BAM with no loss. Always store the reference FASTA alongside CRAM files.\n\n6. **Use `-L bed_file` for targeted analyses**: Restricting `samtools view` to BED-defined target regions (WES capture, amplicons) dramatically reduces I\u002FO for downstream steps.\n\n## Common Recipes\n\n### Recipe: Batch Flagstat for Multiple Samples\n\n```bash\n# Process all BAM files in directory\nfor bam in *.sorted.bam; do\n    echo \"=== $bam ===\"\n    samtools flagstat $bam | grep -E \"mapped|properly paired|duplicates\"\ndone\n```\n\n### Recipe: Extract Unmapped Reads for De Novo Assembly\n\n```bash\n# Pull both unmapped reads (useful for pathogen detection)\nsamtools view -f 4 -b input.bam -o unmapped.bam\nsamtools fastq -@ 4 -1 unmapped_R1.fastq -2 unmapped_R2.fastq unmapped.bam\necho \"Unmapped pairs ready for de novo assembly\"\n```\n\n### Recipe: Downsample BAM to Target Coverage\n\n```bash\n# Estimate current depth, then subsample to ~30×\nTOTAL=$(samtools flagstat input.bam | grep \"mapped (\" | head -1 | awk '{print $1}')\nGENOME_SIZE=3100000000  # hg38\nREAD_LEN=150\nCURRENT_COV=$(echo \"scale=1; $TOTAL * $READ_LEN \u002F $GENOME_SIZE\" | bc)\nTARGET_FRAC=$(echo \"scale=3; 30 \u002F $CURRENT_COV\" | bc)\necho \"Current: ${CURRENT_COV}×; subsample fraction: $TARGET_FRAC\"\nsamtools view -b -s $TARGET_FRAC input.bam -o downsampled.bam\nsamtools index downsampled.bam\n```\n\n## Troubleshooting\n\n| Problem | Cause | Solution |\n|---------|-------|----------|\n| `[bam_index_build2] fail to index` | BAM not sorted by coordinate | Sort first: `samtools sort -o sorted.bam input.bam` |\n| `BAI index too large for chromosome` | Chromosome > 512 Mbp | Use CSI index: `samtools index -c input.bam` |\n| `CRAM: reference not found` | Missing or wrong reference FASTA | Set `REF_PATH` env var or use `-T ref.fa` |\n| Duplicate marking incorrect | `fixmate` step skipped | Run full pipeline: collate → fixmate → sort → markdup |\n| `flagstat` shows 0% properly paired | Paired-end BAM missing mate info | Run `samtools fixmate` to populate mate coordinates |\n| Very slow sorting | Low memory per thread | Increase `-m 4G`; reduce `-@` if memory-limited |\n| Region query returns nothing | BAM not indexed or wrong coords | Run `samtools index`; use 1-based coords: `chr1:1000-2000` |\n| `[E::hts_open_format] fail to open` | File path wrong or BAM corrupt | Verify path; test with `samtools quickcheck file.bam` |\n\n## Related Skills\n\n- **deeptools-ngs-analysis** — normalized bigWig coverage tracks and ChIP-seq visualization downstream of samtools\n- **pysam-genomic-files** — Python API for BAM manipulation in custom scripts\n- **bedtools-genomic-intervals** — genomic interval operations on BAM\u002FBED files produced by samtools\n\n## References\n\n- [samtools documentation](https:\u002F\u002Fwww.htslib.org\u002Fdoc\u002Fsamtools.html) — official man pages and command reference\n- [GitHub: samtools\u002Fsamtools](https:\u002F\u002Fgithub.com\u002Fsamtools\u002Fsamtools) — source, releases, issue tracker\n- Danecek et al. (2021) \"Twelve years of SAMtools and BCFtools\" — [GigaScience 10(2)](https:\u002F\u002Fdoi.org\u002F10.1093\u002Fgigascience\u002Fgiab008)\n- [SAM format specification](https:\u002F\u002Fsamtools.github.io\u002Fhts-specs\u002FSAMv1.pdf) — FLAG bits, CIGAR strings, optional tags\n","# samtools — SAM\u002FBAM\u002FCRAM Alignment Toolkit\n\n## Overview\n\nsamtools is the standard command-line toolkit for processing sequence alignment files in SAM, BAM, and CRAM formats. It handles the complete alignment file lifecycle: format conversion, coordinate sorting, index creation, quality control statistics, read filtering, duplicate marking, and multi-file merging. samtools is a near-universal component of NGS pipelines between alignment (STAR, BWA) and downstream analysis (variant calling, peak calling, coverage).\n\n## When to Use\n\n- Sorting BAM files by coordinate after alignment (required before indexing)\n- Indexing sorted BAM files for random access and region queries\n- Converting between SAM, BAM, and CRAM formats to save storage\n- Generating alignment QC metrics: mapping rates, insert sizes, per-chromosome stats\n- Filtering reads by mapping quality, FLAG bits, or genomic regions\n- Marking or removing PCR duplicates before variant calling\n- Merging multiple BAM files from different lanes or samples\n- Calculating per-base depth or coverage breadth for target regions\n- Use `pysam` instead for Python-native BAM manipulation in custom scripts\n- Use `deeptools bamCoverage` instead when you need normalized bigWig coverage tracks\n- Use `mosdepth` instead for whole-genome per-base depth (faster, parallelized)\n\n## Prerequisites\n\n- **Installation**: samtools 1.17+ recommended\n- **Input requirements**: SAM\u002FBAM\u002FCRAM files; CRAM requires FASTA reference\n- **Companion tools**: `samtools faidx` for FASTA indexing; `samtools sort` before `samtools index`\n\n> **Check before installing**: The tool may already be available in the current environment (e.g., inside a `pixi` \u002F `conda` env). Run `command -v samtools` first and skip the install commands below if it returns a path. When running inside a pixi project, invoke the tool via `pixi run samtools` rather than bare `samtools`.\n\n```bash\n# Bioconda (recommended)\nconda install -c bioconda samtools\n\n# Homebrew (macOS)\nbrew install samtools\n\n# Verify\nsamtools --version | head -1\n```\n\n## Pre-flight Interview\n\nSettle these with the user before writing any analysis code.\n\n```yaml\ndecisions:\n  - id: D1\n    param: mappingQualityFloor\n    kind: required\n    source: user\n    ask: \"Below what mapping confidence should reads be dropped? Everything counted downstream inherits this cut.\"\n    default: \"0 - keep every alignment, including ambiguously placed ones\"\n\n  - id: D2\n    param: flagFilter\n    kind: required\n    source: user\n    ask: \"Which read classes should be excluded - unmapped, secondary, supplementary, failed-QC, duplicates?\"\n    default: \"keep all classes\"\n\n  - id: D3\n    param: duplicateHandling\n    kind: required\n    source: user\n    ask: \"Should duplicates be marked and left in place, or physically removed from the file?\"\n    default: \"marked, not removed - downstream tools can then choose\"\n\n  - id: D4\n    param: sortOrder\n    kind: derived\n    source: upstream\n    ask: \"Does the next step need coordinate order, or name order for mate pairing?\"\n    default: \"coordinate\"\n\n  - id: D5\n    param: outputFormat\n    kind: optional\n    source: user\n    ask: \"Write BAM, or CRAM against a reference to save space?\"\n    default: \"BAM\"\n\n  - id: D6\n    param: opticalDuplicateDistance\n    kind: optional_conditional\n    source: data\n    ask: \"Should optical duplicates be distinguished from PCR duplicates, using this platform's pixel distance?\"\n    default: \"not distinguished\"\n\n  - id: D7\n    param: threadsAndMemory\n    kind: never_ask\n    source: data\n    reason: \"Compression threads and per-thread sort memory affect runtime and peak RAM, not the records\"\n    default: \"available cores, 768M per thread\"\n```\n\nD1 and D2 look like plumbing and are not. A MAPQ floor silently removes\nmulti-mapping regions - paralogs, recent duplications, repeat-adjacent genes -\nfrom everything computed afterwards, and a run that keeps secondary alignments\ncounts the same fragment several times. Neither is visible in the output\nfile.\n\n## Quick Start\n\n```bash\n# Typical post-alignment workflow: sort → index → QC\nsamtools sort -@ 8 -o sorted.bam input.bam\nsamtools index sorted.bam\nsamtools flagstat sorted.bam\n```\n\n## Core API\n\n### Module 1: BAM\u002FSAM I\u002FO and Format Conversion\n\nConvert between SAM\u002FBAM\u002FCRAM formats and extract subsets.\n\n```bash\n# SAM → BAM (saves ~75% disk space)\nsamtools view -b -h input.sam -o output.bam\n\n# BAM → CRAM (saves additional 40-50%)\nsamtools view -C -T reference.fa input.bam -o output.cram\n\n# Filter: mapping quality ≥20, exclude unmapped (-F 4)\nsamtools view -q 20 -F 4 input.bam -o filtered.bam\n\n# Extract specific region (requires index)\nsamtools view -h sorted.bam \"chr1:1000000-2000000\" -o region.bam\n\n# Count reads matching filter\nsamtools view -c -F 4 input.bam\n# Output: 45231923 (number of mapped reads)\n```\n\n```bash\n# Extract reads as FASTQ (for realignment or de novo assembly)\nsamtools fastq -@ 4 -1 R1.fastq.gz -2 R2.fastq.gz -0 unpaired.fastq.gz input.bam\n\n# Extract reads as FASTA\nsamtools fasta input.bam > reads.fasta\n\n# Filter by read group\nsamtools view -r SAMPLE_001 multi_rg.bam -o sample001.bam\n```\n\n### Module 2: Sorting and Indexing\n\nOrganize BAM files for efficient random access.\n\n```bash\n# Sort by coordinate (required before indexing)\nsamtools sort -@ 8 -m 2G input.bam -o sorted.bam\n\n# Sort by read name (required for fixmate\u002Fmarkdup)\nsamtools sort -n -@ 8 input.bam -o namesorted.bam\n\n# Index sorted BAM (creates sorted.bam.bai)\nsamtools index sorted.bam\n\n# For chromosomes > 512 Mbp: use CSI index instead\nsamtools index -c sorted.bam\n\n# Group reads by name (fast, for fixmate — no full sort needed)\nsamtools collate -o collated.bam input.bam\n```\n\n### Module 3: Quality Control and Statistics\n\nGenerate alignment QC metrics and coverage reports.\n\n```bash\n# Quick summary: total, mapped, paired, properly paired\nsamtools flagstat sorted.bam\n# Example output:\n# 50000000 + 0 in total (QC-passed reads + QC-failed reads)\n# 48523111 + 0 mapped (97.05% : N\u002FA)\n# 50000000 + 0 paired in sequencing\n# 48490234 + 0 properly paired (96.98% : N\u002FA)\n\n# Per-chromosome mapped\u002Funmapped read counts\nsamtools idxstats sorted.bam\n# chr1  248956422  12345678  0\n# chr2  242193529  11234567  0\n\n# Comprehensive stats (insert sizes, GC content, base quality)\nsamtools stats -r reference.fa sorted.bam > full_stats.txt\ngrep \"^SN\" full_stats.txt | cut -f2,3  # Summary Numbers only\n\n# Coverage report (min\u002Fmax\u002Fmean per region\u002Fchromosome)\nsamtools coverage sorted.bam\n```\n\n```bash\n# Per-base read depth for specific regions\nsamtools depth -b target_regions.bed sorted.bam > depth.txt\n# Output: chr  pos  depth (e.g., chr1  1000  45)\n\n# Statistics split by read group\nsamtools stats -S RG sorted.bam > per_rg_stats.txt\n```\n\n### Module 4: Read Filtering and FLAG Operations\n\nFilter reads using SAM FLAG bits for specific subsets.\n\n```bash\n# FLAG reference — common masks:\n# 1    = paired         4  = unmapped\n# 2    = proper pair    8  = mate unmapped\n# 16   = reverse strand 64 = R1 (first in pair)\n# 128  = R2             256= secondary alignment\n# 1024 = PCR duplicate  2048= supplementary\n\n# Extract properly paired, mapped reads (FLAG 2 set, 4 unset)\nsamtools view -f 2 -F 4 sorted.bam -o proper_pairs.bam\n\n# Extract R1 reads only\nsamtools view -f 64 sorted.bam -o R1.bam\n\n# Remove secondary and supplementary alignments\nsamtools view -F 2304 sorted.bam -o primary.bam\n\n# Extract reads from BED file regions\nsamtools view -L regions.bed -b sorted.bam -o regions.bam\n```\n\n### Module 5: Duplicate Handling\n\nMark or remove PCR duplicates before variant calling.\n\n```bash\n# Full duplicate marking workflow (collate → fixmate → sort → markdup)\nsamtools collate -@ 8 -o collated.bam input.bam\nsamtools fixmate -m -@ 8 collated.bam fixmated.bam\nsamtools sort -@ 8 -o sorted.bam fixmated.bam\nsamtools markdup -@ 8 sorted.bam marked.bam\nsamtools index marked.bam\n\n# Check duplication rate\nsamtools flagstat marked.bam | grep \"duplicates\"\n# Output: 2345678 + 0 duplicates (4.83%)\n```\n\n```bash\n# NovaSeq optical duplicate detection (2500 pixel distance)\nsamtools markdup -d 2500 sorted.bam marked_novaseq.bam\n\n# Remove duplicates instead of marking\nsamtools markdup -r sorted.bam deduped.bam\n\n# Get duplication stats without writing output\nsamtools markdup -s sorted.bam \u002Fdev\u002Fnull\n```\n\n### Module 6: Multi-file Operations and Region Analysis\n\nMerge BAM files and perform region-level analysis.\n\n```bash\n# Merge multiple BAM files (all must be sorted)\nsamtools merge -@ 8 merged.bam lane1.bam lane2.bam lane3.bam\n\n# Merge files listed in a text file (one per line)\nsamtools merge -b bam_list.txt -@ 8 merged.bam\n\n# Merge with read group tags from filenames\nsamtools merge -r merged.bam sample1.bam sample2.bam\n\n# Extract specific chromosome region from merged output\nsamtools view -h merged.bam chr1 -b -o chr1.bam\n```\n\n## Key Concepts\n\n### SAM FLAG Bits\n\nFLAGS encode read properties as a sum of bit values. Common filtering patterns:\n\n| Common Filter | `-f` (require) | `-F` (exclude) | Selects |\n|---------------|----------------|----------------|---------|\n| Mapped reads | — | 4 | All aligned reads |\n| Proper pairs | 2 | — | Properly paired, both mapped |\n| Unique primary | — | 2308 | No secondary\u002Fsupplementary\u002Fduplicate |\n| R1 only | 64 | — | First-in-pair reads |\n| Unmapped | 4 | — | Failed to align |\n\n### CRAM vs BAM vs SAM\n\n| Format | Size | Speed | Requires |\n|--------|------|-------|---------|\n| SAM | ~10× BAM | Slow I\u002FO | Nothing |\n| BAM | 1× | Fast | `.bai` index for random access |\n| CRAM | ~0.6× BAM | Slightly slower | Reference FASTA + index |\n\nUse CRAM for long-term storage; BAM for active analysis.\n\n## Common Workflows\n\n### Workflow 1: Post-Alignment QC and Preparation\n\n**Goal**: Convert aligner output to analysis-ready BAM with QC metrics.\n\n```bash\n#!\u002Fbin\u002Fbash\nSAMPLE=\"sample_001\"\nREF=\"reference.fa\"\nTHREADS=8\n\n# 1. Sort and index (aligner often outputs unsorted SAM\u002FBAM)\nsamtools sort -@ $THREADS -o ${SAMPLE}.sorted.bam ${SAMPLE}.bam\nsamtools index ${SAMPLE}.sorted.bam\n\n# 2. QC metrics\nsamtools flagstat ${SAMPLE}.sorted.bam > ${SAMPLE}.flagstat.txt\nsamtools stats -r $REF ${SAMPLE}.sorted.bam > ${SAMPLE}.stats.txt\nsamtools coverage ${SAMPLE}.sorted.bam > ${SAMPLE}.coverage.txt\n\n# 3. Per-chromosome stats\nsamtools idxstats ${SAMPLE}.sorted.bam > ${SAMPLE}.idxstats.txt\n\necho \"QC complete: $(grep 'mapped (' ${SAMPLE}.flagstat.txt | head -1)\"\n```\n\n### Workflow 2: Full Duplicate-Marking Pipeline\n\n**Goal**: Prepare BAM for GATK or other variant callers requiring deduplicated input.\n\n```bash\n#!\u002Fbin\u002Fbash\nINPUT=\"aligned.bam\"\nFINAL=\"deduped.bam\"\nTHREADS=8\n\n# Collate → fixmate → sort → markdup\nsamtools collate -@ $THREADS -o collated.bam $INPUT\nsamtools fixmate -m -@ $THREADS collated.bam fixmated.bam\nsamtools sort -@ $THREADS -o sorted.bam fixmated.bam\nsamtools markdup -@ $THREADS -s sorted.bam $FINAL\n\n# Clean up intermediates\nrm collated.bam fixmated.bam sorted.bam\n\n# Index and verify\nsamtools index $FINAL\nsamtools flagstat $FINAL | grep \"duplic\"\n# Expected: 3-15% duplicates (WGS); 10-30% for amplicon\n```\n\n## Key Parameters\n\n| Parameter | Command | Default | Range\u002FOptions | Effect |\n|-----------|---------|---------|---------------|--------|\n| `-@` | Most | 0 | 1–N cores | Additional compression\u002FI\u002FO threads |\n| `-m` | sort | 768M | e.g., 2G, 4G | Memory per thread for sorting |\n| `-q` | view | 0 | 0–60 | Minimum mapping quality filter |\n| `-f` | view | 0 | FLAG bits | Include reads with ALL bits set |\n| `-F` | view | 0 | FLAG bits | Exclude reads with ANY bit set |\n| `-b` | view | — | flag | Output BAM format |\n| `-C` | view | — | flag | Output CRAM (requires `-T`) |\n| `-T` | view | — | FASTA path | Reference for CRAM output |\n| `-d` | markdup | 0 | 0–2500 | Optical duplicate pixel distance |\n| `-r` | markdup | — | flag | Remove duplicates (vs just mark) |\n| `-n` | sort | — | flag | Sort by read name instead of position |\n| `-c` | index | — | flag | Create CSI index (needed for chr > 512 Mb) |\n\n## Best Practices\n\n1. **Always sort before indexing**: `samtools index` requires coordinate-sorted input. Attempting to index an unsorted BAM will fail or produce incorrect results.\n\n2. **Use `-@` for all production runs**: Most samtools commands are I\u002FO-bound. Adding `-@ 8` provides near-linear speedup for compression\u002Fdecompression with minimal overhead.\n\n3. **Run flagstat before any analysis**: `samtools flagstat` runs in seconds and catches alignment failures (low mapping rate, unexpected paired-end rates) before wasting time on downstream steps.\n\n4. **Use the collate → fixmate → sort → markdup pipeline**: Running `samtools markdup` directly on coordinate-sorted BAM without fixmate produces incorrect duplicate detection. The mate information added by `fixmate -m` is essential.\n\n5. **Prefer CRAM for archiving**: CRAM reduces storage 40-50% vs BAM with no loss. Always store the reference FASTA alongside CRAM files.\n\n6. **Use `-L bed_file` for targeted analyses**: Restricting `samtools view` to BED-defined target regions (WES capture, amplicons) dramatically reduces I\u002FO for downstream steps.\n\n## Common Recipes\n\n### Recipe: Batch Flagstat for Multiple Samples\n\n```bash\n# Process all BAM files in directory\nfor bam in *.sorted.bam; do\n    echo \"=== $bam ===\"\n    samtools flagstat $bam | grep -E \"mapped|properly paired|duplicates\"\ndone\n```\n\n### Recipe: Extract Unmapped Reads for De Novo Assembly\n\n```bash\n# Pull both unmapped reads (useful for pathogen detection)\nsamtools view -f 4 -b input.bam -o unmapped.bam\nsamtools fastq -@ 4 -1 unmapped_R1.fastq -2 unmapped_R2.fastq unmapped.bam\necho \"Unmapped pairs ready for de novo assembly\"\n```\n\n### Recipe: Downsample BAM to Target Coverage\n\n```bash\n# Estimate current depth, then subsample to ~30×\nTOTAL=$(samtools flagstat input.bam | grep \"mapped (\" | head -1 | awk '{print $1}')\nGENOME_SIZE=3100000000  # hg38\nREAD_LEN=150\nCURRENT_COV=$(echo \"scale=1; $TOTAL * $READ_LEN \u002F $GENOME_SIZE\" | bc)\nTARGET_FRAC=$(echo \"scale=3; 30 \u002F $CURRENT_COV\" | bc)\necho \"Current: ${CURRENT_COV}×; subsample fraction: $TARGET_FRAC\"\nsamtools view -b -s $TARGET_FRAC input.bam -o downsampled.bam\nsamtools index downsampled.bam\n```\n\n## Troubleshooting\n\n| Problem | Cause | Solution |\n|---------|-------|----------|\n| `[bam_index_build2] fail to index` | BAM not sorted by coordinate | Sort first: `samtools sort -o sorted.bam input.bam` |\n| `BAI index too large for chromosome` | Chromosome > 512 Mbp | Use CSI index: `samtools index -c input.bam` |\n| `CRAM: reference not found` | Missing or wrong reference FASTA | Set `REF_PATH` env var or use `-T ref.fa` |\n| Duplicate marking incorrect | `fixmate` step skipped | Run full pipeline: collate → fixmate → sort → markdup |\n| `flagstat` shows 0% properly paired | Paired-end BAM missing mate info | Run `samtools fixmate` to populate mate coordinates |\n| Very slow sorting | Low memory per thread | Increase `-m 4G`; reduce `-@` if memory-limited |\n| Region query returns nothing | BAM not indexed or wrong coords | Run `samtools index`; use 1-based coords: `chr1:1000-2000` |\n| `[E::hts_open_format] fail to open` | File path wrong or BAM corrupt | Verify path; test with `samtools quickcheck file.bam` |\n\n## Related Skills\n\n- **deeptools-ngs-analysis** — normalized bigWig coverage tracks and ChIP-seq visualization downstream of samtools\n- **pysam-genomic-files** — Python API for BAM manipulation in custom scripts\n- **bedtools-genomic-intervals** — genomic interval operations on BAM\u002FBED files produced by samtools\n\n## References\n\n- [samtools documentation](https:\u002F\u002Fwww.htslib.org\u002Fdoc\u002Fsamtools.html) — official man pages and command reference\n- [GitHub: samtools\u002Fsamtools](https:\u002F\u002Fgithub.com\u002Fsamtools\u002Fsamtools) — source, releases, issue tracker\n- Danecek et al. (2021) \"Twelve years of SAMtools and BCFtools\" — [GigaScience 10(2)](https:\u002F\u002Fdoi.org\u002F10.1093\u002Fgigascience\u002Fgiab008)\n- [SAM format specification](https:\u002F\u002Fsamtools.github.io\u002Fhts-specs\u002FSAMv1.pdf) — FLAG bits, CIGAR strings, optional tags\n",{"name":5,"license":15,"description":7},"master","fd76f882a04e445e899d5cfb2732f2105ea054ee","skills\u002Fawesome-skills\u002Fsamtools-bam-processing",0,"https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS","https:\u002F\u002Fbg-szy.github.io\u002FTOP-SKILLS\u002F","https:\u002F\u002Fgithub.com\u002Fbg-szy","https:\u002F\u002Fwww.ecust.edu.cn\u002F","a student of East China University of Science and Technology","2026-11-12 05:55:03",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add bg-szy\u002FTOP-SKILLS --skill samtools-bam-processing",{"tool":40,"command":41},"bunx","bunx skills add bg-szy\u002FTOP-SKILLS --skill samtools-bam-processing",{"tool":43,"command":44},"pnpm","pnpm dlx skills add bg-szy\u002FTOP-SKILLS --skill samtools-bam-processing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fawesome-skills\u002Fsamtools-bam-processing\u002FSKILL.md",true,[],[49,56,63,72,80,88],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M748C5DS5BQBVBMG22FCGG34","branding","When the user wants to define, audit, or apply brand strategy—purpose, values, positioning, storytelling, voice, narrative (not only visuals). Also use when the user mentions \"brand strategy\", \"brand story\", \"brand storytelling\" or \"brand voice\". For typography, colors, design tokens, and frontend visuals, use brand-visual-generator.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fsuperskills\u002Fbranding\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M748C1GXJ9WRKP18X45DKP6G","brand-visual-generator","When the user wants to define, audit, or apply visual identity (typography, colors, spacing, design tokens, frontend aesthetics). Also use when the user mentions \"brand style guide\", \"visual identity\", \"design system\" or \"typography\". For brand story, positioning, and voice, use branding.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fsuperskills\u002Fbrand-visual-generator\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":67,"licenseFileUrl":68,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M747T565TFEP3RAVWM0Y899Y","mcp-builder","Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node\u002FTypeScript (MCP SDK).","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fskills\u002Fmcp-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fskills\u002Fmcp-builder\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":67,"licenseFileUrl":76,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M747RAJGMBZ2QN4563STB5SH","frontend-design","Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fskills\u002Ffrontend-design\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fskills\u002Ffrontend-design\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":67,"licenseFileUrl":84,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M747NHAY5BE9GXEB31H255R1","claude-api","Reference for the Claude API \u002F Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration.\nTRIGGER — read BEFORE opening the target file; don't skip because it \"looks like a one-liner\" — whenever: the prompt names Claude\u002FAnthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing\u002Fmodel choice\u002Flimits\u002Fcaching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent\u002FMCP\u002Ftool-definition\u002Fmulti-agent\u002FRAG\u002FLLM-judge\u002Fcomputer-use; generate\u002Fsummarize\u002Fextract\u002Fclassify\u002Frewrite\u002Fconverse over NL; debugging refusals\u002Fcutoffs\u002Fstreaming\u002Ftool-calls\u002Ftokens).\nSKIP only when another provider is being worked on (overrides all triggers): OpenAI\u002FGPT\u002FGemini\u002FLlama\u002FMistral\u002FCohere\u002FOllama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file).","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fskills\u002Fclaude-api\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fskills\u002Fclaude-api\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":92,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":19},"01M73WM4TPHEJ57D7G2AZ0ABVT","inbox-guardian-for-gmail","Review a personal Gmail inbox with local, owner-approved spam rules. Use for audit-first quarantine, Trash, repeated-evidence sender learning, and header review. Do not use for automatic unsubscribe requests or unreviewed mailbox actions.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Finbox-guardian-for-gmail\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Finbox-guardian-for-gmail\u002FSKILL.md",[],[]]