agentleFS
janussonjanusson/MSMCP/skills/ms-data-ingestion/SKILL.md

ms-data-ingestion

Skill1 starsChanged 24 days agoMITView on GitHub

Rules for reading mass-spectrometry files in msmcp: supported formats, the single dispatch point, reader semantics, and what must never be invented.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this when reading an acquisition or adding support for a new format.

    line 10
  2. Very specific:

    All ingestion goes through ingest.resolve_source(path, policy).

    line 16
  3. Very specific:

    Do not call massflow_io, mzml, or mgf directly from a tool.

    line 25
  4. Very specific:

    Do not invent cvParams, retention times, MS levels, or precursor m/z that the file does not state.

    line 68
  5. Distinctive:

    Do not convert between units unless the file states the unit.

    line 70
  6. Very specific:

    Every read goes through the security boundary (see the security-boundary skill): allowed root, file size, and spectrum count all apply to …

    line 71

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

MS data ingestion

Use this when reading an acquisition or adding support for a new format. The guiding constraint: do not silently change mzML/MGF semantics, and do not invent metadata.

One entry point

All ingestion goes through ingest.resolve_source(path, policy). It picks the reader from the file extension and returns a Source whose spectra are all the same msmcp.mzml.Spectrum type, so no downstream tool knows or cares which library parsed the file.

file -> ingest.resolve_source -> (MassFlow | msmcp reader) -> Spectrum -> DataReference

Do not call massflow_io, mzml, or mgf directly from a tool. Tools depend on the interface (resolve_source), not the mechanism.

Supported formats

FormatExtensionsReader / backend
mzML.mzML, .mzML.gzmsmcp.mzml
MGF.mgf, .mgf.gzmsmcp.mgf
imzML (imaging).imzML (+ .ibd)MassFlow (massflow.imzML)

The reader chosen is carried into provenance as Source.backend, which is what makes it possible to tell later whether two results came from the same parsing path.

Unsupported formats

Vendor formats are recognised and rejected with actionable guidance, not a generic failure:

SuffixVendor
.rawThermo
.dAgilent / Bruker
.wiffSCIEX
.mzxmllegacy mzXML

The error directs the user to convert with ProteoWizard MSConvert (except imzML, which is passed through directly). A new UnsupportedFormatError case should name the vendor and the next step, mirroring ingest.py.

Reader semantics to preserve

  • An empty scan is legal and must not abort a run. Real Bruker mzML files contain thousands of legitimately empty spectra; tests/conftest.py models this with the "empty" and "absent" payload modes.
  • A file that declares peaks but carries none is corruption, not emptiness. Distinguish the two; do not treat a malformed payload as a valid empty scan.
  • Empty arrays are spelled several legal ways in the wild (<binary/> with encodedLength="0", or <binary> omitted entirely). Handle both.

Metadata honesty

  • Do not invent cvParams, retention times, MS levels, or precursor m/z that the file does not state. Report None when absent.
  • Do not convert between units unless the file states the unit.
  • Every read goes through the security boundary (see the security-boundary skill): allowed root, file size, and spectrum count all apply to ingestion.

Tests

Ingestion tests build fixtures rather than committing binary data. See tests/conftest.py for the mzML/MGF builders and tests/test_ingest.py, tests/test_mzml.py, tests/test_mgf.py. The imzML fixture is written with pyimzml (a MassFlow dependency) and skipped when that dependency is absent, rather than faked.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.