agentsclimarketplace

Array of objects construction

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/array-of-objects-construction

Use when you have tabular experimental data (e.g., sample metadata, mass spectrometry parameters, NMR acquisition details) in JSON table format and need to produce a list of structured objects for submission to a data repository (e.g., Metabolomics Workbench) or downstream format conversion.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill array-of-objects-construction

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 15 stars15 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

8.8 KB, ~1.4k tokens by cl100k_base, as published. Nobody here has run it

array-of-objects-construction

Summary

Construct a list of dictionaries (array of objects) from tabular JSON records by mapping columns to key–value pairs via headers specification, with optional filtering, sorting, and row-grouping (collation). This skill is essential when converting flat tabular experimental metadata into nested JSON structures suitable for REST API submission or format conversion.

When to use

Apply this skill when you have tabular experimental data (e.g., sample metadata, mass spectrometry parameters, NMR acquisition details) in JSON table format and need to produce a list of structured objects for submission to a data repository (e.g., Metabolomics Workbench) or downstream format conversion. Trigger: the output schema requires an array of objects rather than a flat table, and records may need filtering (e.g., only 'positive' mode samples), ordering (e.g., by acquisition date), or grouping (e.g., all replicates of a sample into a single record).

When NOT to use

  • Input records are already in the desired array-of-objects format (avoid redundant re-structuring).
  • Output should be a single flat string or scalar value (use str directive instead).
  • Records contain nested structures that should be preserved as-is (collation may incorrectly flatten hierarchy).
  • The mapping from table columns to output keys is not declarative via headers (requires custom scripting instead).

Inputs

  • JSON object containing a single table with records (array of row objects)
  • matrix conversion directive (object specifying headers, sort_by, sort_order, test, collate, exclusion_headers fields)

Outputs

  • list of dictionaries (JSON array of objects)

How to apply

Parse the matrix conversion directive to extract the headers key=value specification (mapping table columns to output dictionary keys), sort_by and sort_order fields (to reorder records), test filter expression (field=value syntax to select matching records), and collate field (to group multiple records by shared value). First, apply the test filter to select only records satisfying the condition (e.g., 'instrument_type=Orbitrap'). Next, sort the filtered records by the fields listed in sort_by in the specified sort_order (ascending or descending). Then, group records by the collate field value if specified, creating one output dictionary per group. For each record or group, iterate through the headers specification and extract table column values, mapping them to the corresponding dictionary key names; literal strings in the headers specification are preserved as-is. Finally, exclude any fields listed in exclusion_headers from the output, assemble all dictionaries into a single list, and return. The rationale is that collation and sorting normalize record order and structure before key–value extraction, ensuring deterministic, reproducible output suitable for validation and repository submission.

Related tools

Evaluation signals

  • Output is a valid JSON array (not a single object or flat table).
  • Each element in the output array is a dictionary with keys matching the headers specification (verify via schema validation).
  • If a test filter was specified, all records in the output satisfy the filter condition (e.g., all records have instrument_type='Orbitrap').
  • If sort_by was specified, records are ordered by the specified fields in the declared sort_order (ascending/descending); verify by spot-checking first and last records.
  • If collate was specified, no two dictionaries share the same value for the collate field; verify cardinality matches the number of unique collate field values in the input.
  • Fields listed in exclusion_headers do not appear as keys in any output dictionary.
  • The output passes validation against the project's JSON Schema and the target format schema (e.g., mwTab format schema).

Limitations

  • The headers specification uses only key=value pairs referencing table columns or literal strings; complex computations or nested object construction are not supported by the matrix directive alone (would require chaining with str directive or post-processing).
  • Collation groups records by exact match on a single field; more complex multi-field or conditional grouping logic requires pre-processing or custom scripting.
  • The test filter supports only field=value equality conditions; range queries, regex matching, or boolean logic are not natively supported.
  • If the collate field contains null or missing values, those records may be grouped unexpectedly or excluded; the article does not clarify handling of missing collate values.
  • Sorting is applied globally before collation; within-group ordering is not preserved or user-controllable.

Evidence

  • [other] The matrix directive constructs a list of dictionaries by iterating over records in a table, building each dictionary using headers specified as key=value pairs where keys/values reference record fields or literal strings.: "The matrix directive constructs a list of dictionaries by iterating over records in a table, building each dictionary using headers specified as key=value pairs where keys/values reference record"
  • [other] Records are preprocessed via sort_by/sort_order (to reorder), test field (to filter matching records), and the collate field groups multiple records into single dictionaries based on a shared field value.: "Records are preprocessed via sort_by/sort_order (to reorder), test field (to filter matching records), and the collate field groups multiple records into single dictionaries based on a shared field"
  • [intro] The matrix directive assumes that you want to create a list of dictionaries (aka array of objects) from information in the input JSON, and that that information is contained within a single table.: "The matrix directive assumes that you want to create a list of dictionaries (aka array of objects) from information in the input JSON, and that that information is contained within a single table."
  • [intro] Sort records by specified fields before extraction using sort_by and sort_order fields: "sort_by - a list of fields to sort the input JSON records by before building the value from them. sort_order - a string value that is either "ascending" or "descending""
  • [intro] Filter records using 'test' field with field=value syntax before building string values: "test - a string of the form "field=value" where field is a field in the records being iterated over and value is what the field must be equal to in order to be used to build the string value."
  • [intro] The "exclusion_headers" field can then be used to exclude fields from being added.: "The "exclusion_headers" field can then be used to exclude fields from being added."
  • [readme] MESSES (Metadata from Experimental SpreadSheets Extraction System) is a Python package that facilitates the conversion of tabular data into other formats.: "MESSES (Metadata from Experimental SpreadSheets Extraction System) is a Python package that facilitates the conversion of tabular data into other formats."

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.