ClaudeCodeforScientists
CLAUDE.md1 starsChanged 10 months agoMITView on GitHub
Compatibility: This file works as CLAUDE.md (Claude Code), AGENTS.md (Cursor, Zed, OpenCode), or COPILOT-INSTRUCTIONS.md (GitHub Copilot). Copy and rename as needed. Project name: <your-project-name> Organism / system: <e.g. Gossypium hirsutum, Homo sapiens, mixed-species metagenome> Analysis type: <e.g. WGS variant calling, RNA-seq differential expression, metagenomics> Workflow engine: <snakemake | nextflow | bash> Package manager: <conda/mamba | uv | docker | singularity> One-sentence description: <!-- What question is this analysis answering? -->
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
30 rules. About 0 are common, 12 are distinctive, and 18 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
18
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 108
Config is centralised: No hardcoded paths, sample names, or thresholds in scripts.
- Very specific: line 109
The pipeline is the source of truth: Every result must be reproducible via workflow/Snakefile (or main.nf).
- Very specific: line 154
No hardcoded paths: Use config["param"] in Snakemake or params.param in Nextflow.
- Very specific: line 172
IMPORTANT: Read @agent_docs/data_conventions.md before creating, moving, or transforming data files.
- Distinctive: line 189
Never commit files > 1 MB to git.
- Very specific: line 190
Use .gitignore to exclude data/raw/, data/processed/, resources/, logs/.
- Very specific: line 197
IMPORTANT: Read @agent_docs/workflow_guide.md before writing or modifying workflow rules.
- Very specific: line 227
Every rule has a docstring, log:, conda: (or container:), threads:, and resources:.
- Very specific: line 230
Use expand() only in rule all.
- Very specific: line 262
IMPORTANT: Read @agent_docs/visualisation_guide.md for plotting standards and colour palettes.
- Distinctive: line 265
Generate many cheap diagnostic plots: Use them to sanity-check data at every stage: coverage distributions, PCA projections, mapping rate …
- Very specific: line 266
Scripts over notebooks for reproducibility: Prefer scripts/plot_coverage.py that dumps a PNG to results/figures/.
- Distinctive: line 268
Prefer text-based notebooks: marimo (.py), jupytext (.py), quarto (.qmd), Rmarkdown (.Rmd).
- Distinctive: line 269
If using Jupyter, always restart kernel and run all cells before committing.
- Very specific: line 270
Never leave large base64-encoded images in .ipynb files in version control.
- Distinctive: line 272
Colour: Use colourblind-safe palettes (viridis, cividis, or the Okabe-Ito palette).
- Very specific: line 279
IMPORTANT: Read @agent_docs/testing_strategy.md for full testing patterns.
- Very specific: line 294
Keep small representative data in tests/test_data/ (< 5 MB total).
- Very specific: line 320
Commit early, commit often.
- Distinctive: line 321
Delete dead code aggressively — git has your back.
- Distinctive: line 323
Never commit secrets, credentials, or absolute paths.
- Distinctive: line 342
YOU MUST: follow these rules when working in this repository:
- Distinctive: line 344
Search before creating: Before writing a new function or script, grep the codebase for existing implementations.
- Very specific: line 345
Never modify
data/raw/: Treat it as immutable. All transforms write to data/processed/. - Very specific: line 346
Never hardcode paths or sample names: Read from config/config.yaml or accept as function parameters.
- Very specific: line 349
Write tests alongside new
src/code: If you add a function, add a test. - Very specific: line 350
Keep notebooks clean: No data processing logic in notebooks.
- Distinctive: line 352
Do not install packages globally: Use the project environment.
- Distinctive: line 353
When uncertain about biological interpretation, say so: Do not hallucinate domain knowledge.
- Distinctive: line 359
Read these files when working on the relevant area.
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md — Bioinformatics Project Agent Instructions
Compatibility: This file works as
CLAUDE.md(Claude Code),AGENTS.md(Cursor, Zed, OpenCode), orCOPILOT-INSTRUCTIONS.md(GitHub Copilot). Copy and rename as needed.
Project overview
<!-- EDIT THIS SECTION for every new project -->Project name: <your-project-name>
Organism / system: <e.g. Gossypium hirsutum, Homo sapiens, mixed-species metagenome>
Analysis type: <e.g. WGS variant calling, RNA-seq differential expression, metagenomics>
Workflow engine: <snakemake | nextflow | bash>
Package manager: <conda/mamba | uv | docker | singularity>
One-sentence description:
<!-- What question is this analysis answering? -->Repository structure
project-root/
│
├── CLAUDE.md # ← You are here. Agent instructions.
├── README.md # Human-readable project overview
├── LICENSE
├── .gitignore
│
├── config/ # Configuration — the only place for tuneable parameters
│ ├── config.yaml # Pipeline parameters (samples, paths, thresholds)
│ ├── samples.tsv # Sample sheet / manifest
│ └── cluster.yaml # HPC resource profiles (optional)
│
├── workflow/ # Computational pipeline definition
│ ├── Snakefile # — OR main.nf for Nextflow
│ ├── rules/ # Modular rule files (.smk)
│ │ ├── qc.smk
│ │ ├── alignment.smk
│ │ ├── calling.smk
│ │ └── annotation.smk
│ ├── envs/ # Per-tool conda environment YAMLs
│ │ ├── fastqc.yaml
│ │ ├── bwa.yaml
│ │ └── samtools.yaml
│ └── scripts/ # Helper scripts invoked by rules
│ ├── parse_vcf.py
│ └── merge_counts.R
│
├── src/ # Reusable library code (installable package)
│ ├── __init__.py
│ ├── io.py # Data loading / parsing utilities
│ ├── transforms.py # Data transformation functions
│ └── stats.py # Statistical methods
│
├── notebooks/ # Exploratory analysis & visualisation ONLY
│ ├── 01_qc_overview.py # Prefer text-based formats: marimo, jupytext, quarto
│ ├── 02_pca_clustering.py
│ └── 03_differential.py
│
├── scripts/ # Standalone analysis / plotting scripts
│ ├── plot_coverage.py
│ ├── generate_report.py
│ └── run_pipeline.sh # One-command full pipeline execution
│
├── data/ # DATA — never commit large files to git
│ ├── raw/ # Immutable original data (symlink or .gitkeep)
│ ├── processed/ # Pipeline outputs (intermediate & final)
│ ├── generated/ # AI-generated data (synthetic, augmented, imputed)
│ ├── external/ # Third-party resources (databases, references)
│ └── metadata/ # Sample metadata, clinical data, phenotypes
│
├── results/ # Final outputs for publication / sharing
│ ├── figures/ # Publication-ready figures (PDF/SVG/PNG)
│ ├── tables/ # Summary tables (TSV/CSV)
│ └── reports/ # Rendered reports (HTML/PDF)
│
├── resources/ # Reference genomes, annotations, indices
│ └── .gitkeep
│
├── tests/ # Automated tests
│ ├── test_io.py
│ ├── test_transforms.py
│ └── test_data/ # Small fixture datasets for testing
│ └── tiny_reads.fq.gz
│
├── agent_docs/ # Extended agent instructions (progressive disclosure)
│ ├── data_conventions.md
│ ├── workflow_guide.md
│ ├── coding_standards.md
│ ├── testing_strategy.md
│ ├── visualisation_guide.md
│ └── hpc_deployment.md
│
├── logs/ # Pipeline execution logs
│ └── .gitkeep
│
├── envs/ # Project-level environment definitions
│ └── environment.yaml # — OR pyproject.toml with [project.dependencies]
│
└── pyproject.toml # Project metadata, build config, tool settingsKey principles behind this layout
- Separate data processing from visualisation. Pipeline logic lives in
workflow/andsrc/. Plotting lives innotebooks/andscripts/. Never mix them. - Data has a lifecycle.
raw/→processed/→results/. Raw is immutable. Processed can be regenerated. Generated is flagged as AI-produced. - Config is centralised. No hardcoded paths, sample names, or thresholds in scripts. Everything flows from
config/. - The pipeline is the source of truth. Every result must be reproducible via
workflow/Snakefile(ormain.nf). If it can't be re-run from raw, it doesn't count.
Commands
# Environment setup
mamba env create -f envs/environment.yaml
conda activate <project-name>
# Run pipeline (Snakemake)
snakemake --cores all --use-conda
snakemake -n # Dry run
snakemake --dag | dot -Tpdf > dag.pdf # Visualise DAG
snakemake --report results/reports/pipeline_report.html
# Run pipeline (Nextflow)
nextflow run workflow/main.nf -profile conda,local -params-file config/config.yaml
# Linting & formatting
ruff check src/ scripts/ workflow/scripts/
ruff format src/ scripts/ workflow/scripts/
# Tests
pytest tests/ -v
pytest tests/test_io.py::test_parse_vcf -v # Single test
# Notebooks (marimo)
marimo edit notebooks/01_qc_overview.py
# Notebooks (jupytext)
jupytext --to notebook notebooks/01_qc_overview.py && jupyter notebookCoding standards
Language: Python 3.10+ (primary), R 4.x (statistical models, Bioconductor), Bash (glue).
Style:
- Python: follow
ruffdefaults (based on PEP 8). Max line length 100. - R: follow
tidyversestyle guide. - Snakemake: one rule per logical step. Name rules as verbs (
align_reads,call_variants). - No hardcoded paths. Use
config["param"]in Snakemake orparams.paramin Nextflow. - No magic numbers. Thresholds, quality cutoffs, and window sizes go in
config/config.yaml.
Naming:
- Files:
snake_case.py,snake_case.smk,kebab-case.yaml. - Functions/variables:
snake_case. - Classes:
PascalCase. - Constants:
UPPER_SNAKE_CASE. - Notebooks: numbered prefix
01_,02_for execution order.
Docstrings: Required for all public functions. Use Google style.
Type hints: Required for all function signatures in src/.
Data conventions
IMPORTANT: Read @agent_docs/data_conventions.md before creating, moving, or transforming data files.
data/raw/— Never modify. Treat as read-only. Symlink from shared storage if large.data/processed/— Pipeline outputs. Must be reproducible from raw via the workflow. Safe to delete and regenerate.data/generated/— AI-generated or synthetic data. Always tag provenance (model, date, parameters) in a sidecar.meta.yaml.data/external/— Downloaded databases, reference panels. Record URL + version + download date.data/metadata/— Sample sheets, clinical data, phenotype files.results/— Final publication-ready outputs only. Figures as vector (SVG/PDF) + raster (PNG 300dpi).
File formats:
- Sequences: FASTQ (gzipped), FASTA
- Alignments: BAM/CRAM (sorted, indexed)
- Variants: VCF/BCF (bgzipped, tabix-indexed)
- Counts/matrices: TSV or Parquet (prefer Parquet for large matrices)
- Tabular results: TSV with header row. No Excel files in the pipeline.
Git & large files:
- Never commit files > 1 MB to git.
- Use
.gitignoreto excludedata/raw/,data/processed/,resources/,logs/. - Track large files with DVC or Git LFS if versioning is needed.
Workflow conventions
IMPORTANT: Read @agent_docs/workflow_guide.md before writing or modifying workflow rules.
Snakemake rules
rule align_reads:
"""Align reads to reference genome using BWA-MEM2."""
input:
reads=expand("data/raw/{sample}_{pair}.fq.gz", pair=[1, 2], allow_missing=True),
ref=config["reference"]["genome"],
output:
bam="data/processed/alignments/{sample}.sorted.bam",
bai="data/processed/alignments/{sample}.sorted.bam.bai",
log:
"logs/align/{sample}.log",
conda:
"../envs/bwa.yaml"
threads: 8
resources:
mem_mb=32000,
runtime=240,
shell:
"""
(bwa-mem2 mem -t {threads} {input.ref} {input.reads} \
| samtools sort -@ {threads} -o {output.bam}) 2> {log}
samtools index {output.bam} 2>> {log}
"""Rule conventions:
- Every rule has a docstring,
log:,conda:(orcontainer:),threads:, andresources:. - Inputs and outputs use full relative paths from project root.
- Wrap shell commands in
(command) 2> {log}for consistent error capture. - Use
expand()only inrule all. Individual rules use wildcards.
Nextflow processes
process ALIGN_READS {
tag "${meta.id}"
conda "envs/bwa.yaml"
publishDir "data/processed/alignments", mode: 'copy'
cpus 8
memory '32 GB'
input:
tuple val(meta), path(reads)
path(reference)
output:
tuple val(meta), path("*.sorted.bam"), path("*.sorted.bam.bai"), emit: bam
script:
"""
bwa-mem2 mem -t ${task.cpus} ${reference} ${reads} \
| samtools sort -@ ${task.cpus} -o ${meta.id}.sorted.bam
samtools index ${meta.id}.sorted.bam
"""
}Visualisation guidelines
IMPORTANT: Read @agent_docs/visualisation_guide.md for plotting standards and colour palettes.
- Separate processing from plotting. Plotting scripts read from
data/processed/and write toresults/figures/. They do NOT run analysis. - Generate many cheap diagnostic plots. Use them to sanity-check data at every stage: coverage distributions, PCA projections, mapping rate bar charts, insert size histograms. Individually low-value, collectively they catch errors early.
- Scripts over notebooks for reproducibility. Prefer
scripts/plot_coverage.pythat dumps a PNG toresults/figures/. Reserve notebooks for genuinely interactive exploration. - Notebook handling:
- Prefer text-based notebooks: marimo (.py), jupytext (.py), quarto (.qmd), Rmarkdown (.Rmd).
- If using Jupyter, always restart kernel and run all cells before committing. Better: convert via jupytext.
- Never leave large base64-encoded images in
.ipynbfiles in version control.
- Plotting libraries: matplotlib/seaborn (static), plotly (interactive), altair (declarative). Use a consistent theme across the project.
- Colour: Use colourblind-safe palettes (viridis, cividis, or the Okabe-Ito palette). Never use jet/rainbow.
- Figures for publication: SVG or PDF for vector, PNG at 300 DPI for raster. Set
figsizeexplicitly.
Testing & validation strategy
IMPORTANT: Read @agent_docs/testing_strategy.md for full testing patterns.
Tests are not optional. When the AI writes the code, tests are how you verify it is doing what you think.
What to test:
src/library functions: unit tests with known inputs → expected outputs.- File parsers: roundtrip tests (read → write → read → compare).
- Statistical functions: test against published results or hand-calculated examples.
- Workflow rules: dry-run (
snakemake -n) and integration test with tiny fixtures intests/test_data/.
What NOT to test with unit tests:
- Visualisation aesthetics (review manually).
- Third-party tool correctness (trust samtools; test your invocation of it).
Test fixtures:
- Keep small representative data in
tests/test_data/(< 5 MB total). - Subsample real data:
seqtk sample -s42 reads.fq.gz 1000 | gzip > tests/test_data/tiny_reads.fq.gz.
Running tests:
pytest tests/ -v --tb=shortEnvironment & reproducibility
- Pin all versions.
envs/environment.yamlshould specifytool=x.y.z, nevertool>=x. - One conda env per tool in workflow (via
conda:directive in Snakemake rules), OR one master environment for the whole project. Document which approach you chose inREADME.md. - Containers for production. For shared pipelines or publication, provide a
Dockerfileor Singularity definition. - Record the execution environment:
conda list --export > envs/frozen-environment.txt snakemake --version >> envs/frozen-environment.txt
Git workflow
- Work on feature branches:
git checkout -b feature/add-variant-filtering. - Commit early, commit often. Messages follow:
type: short description(e.g.feat: add GATK HaplotypeCaller rule,fix: correct BAM sort order,docs: update README). - Delete dead code aggressively — git has your back.
- Tag releases that correspond to manuscript submissions:
git tag -a v1.0-submission -m "Initial submission to Nature Genetics". - Never commit secrets, credentials, or absolute paths.
Common pitfalls — things to watch for
| Symptom | Likely cause | Fix |
| Pipeline works on one sample but fails on others | Hardcoded sample name somewhere | Grep for the sample name; parameterise via config |
| Results differ between runs | Non-deterministic tool or unseeded random | Set --seed / random_state everywhere; pin tool versions |
| Disk full during pipeline | BAM/VCF intermediates accumulating | Use temp() in Snakemake outputs for intermediates |
| AI-generated code silently reads wrong column | Column name drift between data versions | Add assertions at data load: assert "gene_id" in df.columns |
| Notebook outputs differ from script outputs | Stale notebook kernel state | Restart kernel + run all, or switch to marimo/jupytext |
| Pipeline DAG is a mess | Rules too granular or too monolithic | One rule = one logical bioinformatics step |
Agent behaviour rules
YOU MUST follow these rules when working in this repository:
- Search before creating. Before writing a new function or script, grep the codebase for existing implementations. Extend, don't duplicate.
- Never modify
data/raw/. Treat it as immutable. All transforms write todata/processed/. - Never hardcode paths or sample names. Read from
config/config.yamlor accept as function parameters. - Always add a log directive to new Snakemake rules or Nextflow processes.
- Always add a conda/container directive for reproducibility.
- Write tests alongside new
src/code. If you add a function, add a test. - Keep notebooks clean. No data processing logic in notebooks. Import from
src/instead. - Commit messages follow conventional format.
feat:,fix:,docs:,refactor:,test:,chore:. - Do not install packages globally. Use the project environment.
- When uncertain about biological interpretation, say so. Do not hallucinate domain knowledge. Flag it for human review.
Extended documentation (progressive disclosure)
Read these files when working on the relevant area. Do NOT read all of them at once — load on demand.
| File | When to read |
@agent_docs/data_conventions.md | Creating, moving, or transforming data files |
@agent_docs/workflow_guide.md | Writing or modifying Snakemake/Nextflow rules |
@agent_docs/coding_standards.md | Writing Python/R library code in src/ |
@agent_docs/testing_strategy.md | Writing or running tests |
@agent_docs/visualisation_guide.md | Creating plots or figures |
@agent_docs/hpc_deployment.md | Running on HPC clusters (SLURM/PBS) |
@README.md | Project overview, installation, quickstart |
@config/config.yaml | Understanding pipeline parameters |
Quick reference — what goes where?
| I need to... | Put it in... |
| Add a new pipeline step | workflow/rules/ (new .smk file or add to existing) |
| Write a reusable function | src/ (and add a test in tests/) |
| Create a one-off analysis script | scripts/ |
| Explore data interactively | notebooks/ (text-based format) |
| Store a new tool's conda env | workflow/envs/ |
| Add a helper script for a rule | workflow/scripts/ |
| Save a publication figure | results/figures/ |
| Download a reference genome | resources/ |
| Record a parameter or threshold | config/config.yaml |
| Document something for the AI agent | agent_docs/ |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

