Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/tomevault-io/tomes --skill parser-generator명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | parser-generator |
| description | | Use when this capability is needed. |
Generate complete, production-ready parsers for scientific instrument data files.
Always start by analyzing the example input file:
python scripts/analyze_file.py <path_to_example_file>
This script:
Example output:
============================================================
FILE ANALYSIS: example_data.xlsx
============================================================
format: excel
shape: (150, 12)
suggested_schema: plate-reader
measurement_indicators: ['absorbance', 'well', 'plate']
============================================================
✅ RECOMMENDED SCHEMA: plate-reader
============================================================
Review available schemas if auto-detection needs override:
# From within allotropy repository
python scripts/list_schemas.py [optional_filter]
# Use --verbose for detailed output with schema paths
python scripts/list_schemas.py --verbose
The script dynamically scans your local allotropy repository for all available schemas and shows:
Use the create_parser.py script to generate the complete parser:
python scripts/create_parser.py <parser_name> <schema_regex> --display_name "Vendor Instrument" --detection_modes "Absorbance, Fluorescence"
The --detection_modes flag sets the SUPPORTED_DETECTION_MODES class attribute, which populates the instruments table. Use comma-separated values for multiple modes (e.g. "Absorbance, Fluorescence, Luminescence"). Omit for instruments without detection (liquid handlers).
src/allotropy/parsers/{parser_name}/
├── __init__.py # Exports parser class
├── {parser_name}_parser.py # VendorParser subclass
├── {parser_name}_reader.py # File format parser
├── {parser_name}_structure.py # Dataclasses and factories
├── constants.py # Constants (if needed)
└── README.md # Documentation
tests/parsers/{parser_name}/
├── __init__.py
├── test_{parser_name}_parser.py # Test file
└── testdata/
└── example.xlsx # Example test file
Based on file format detection:
Excel files:
read_excel with calamine engineText files:
[Section] patterns)SectionLinesReader or read_csvCreate dataclasses for:
Header - Metadata from file headerMeasurement - Individual measurement datacreate_metadata() - Build Metadata objectcreate_measurement_groups() - Build MeasurementGroup listcreate_calculated_data() - Build calculated data (if applicable)Generate VendorParser subclass with:
DISPLAY_NAME - User-friendly instrument nameRELEASE_STATE - Start with ReleaseState.WORKING_DRAFTSUPPORTED_EXTENSIONS - File extensions (from analysis)SUPPORTED_DETECTION_MODES - Detection modes the parser supports (e.g. "Absorbance, Fluorescence") or None for instruments without detection (e.g. liquid handlers). This populates the "Supported Detection Modes" column in the supported instruments table.SCHEMA_MAPPER - Reference to schema mappercreate_data() - Orchestrate reader + structure → DataThe schema mapper defines the intermediate Data structure and maps it to Allotrope models.
Reuse existing mapper:
from allotropy.allotrope.schema_mappers.adm.{technique}.{org}.{year}.{month}.{technique} import (
Data,
Mapper,
)
Conform your create_data() to return the expected Data structure.
This is rare - most techniques have existing mappers. If needed:
Mapper.map_model() methodGenerate test file:
# tests/parsers/{parser_name}/test_{parser_name}_parser.py
def test_to_allotrope_{parser_name}() -> None:
test_file = "testdata/example.xlsx"
expected_file = "testdata/example.json"
run_allotropy(test_file, expected_file)
Run tests:
hatch run test:pytest tests/parsers/{parser_name}/
Add to src/allotropy/parser_factory.py:
from allotropy.parsers.{parser_name}.{parser_name}_parser import {ParserName}Parser
Vendor enum:class Vendor(Enum):
YOUR_INSTRUMENT = "YOUR_INSTRUMENT"
_VENDOR_TO_PARSER mapping:_VENDOR_TO_PARSER: dict[Vendor, type[VendorParser]] = {
Vendor.YOUR_INSTRUMENT: YourInstrumentParser,
# ... existing parsers
}
analyze_file.pylist_schemas.pycreate_parser.pySUPPORTED_DETECTION_MODES to the correct value for the instrumenttestdata/parser_factory.pyhatch run scripts:update-instrument-table to regenerate the supported instruments tableRELEASE_STATE when stableread_excel, SeriesData, quantity_or_none, etc.plate-readerpcr (qpcr or dpcr)solution-analyzercell-countingspectrophotometryelectrophoresisliquid-chromatographybinding-affinityflow-cytometryIMPORTANT: Never manually generate expected JSON output files using allotrope_from_file() directly. The test framework uses a UUID mocking mechanism that replaces random UUIDs with deterministic test IDs (e.g., BECKMAN_PHARMSPEC_TEST_ID_0). Manually generated JSON will have random UUIDs that won't match the test IDs at comparison time.
Correct procedure to generate expected output for new test data files:
.xls, .xlsx, .csv) in the tests/parsers/{parser_name}/testdata/ directory.json file manually--overwrite flag — the framework will write the expected output:
hatch run test_all.py3.10:pytest tests/parsers/{parser_name}/ --overwrite -q
AssertionError: Missing expected output file ... writing expected output because 'write_actual_to_expected_on_fail=True' — this is expected behavior, it means the JSON was writtenhatch run test_all.py3.10:pytest tests/parsers/{parser_name}/ -q
The test framework (in src/allotropy/testing/utils.py) uses mock_uuid_generation(vendor.name) which patches the UUID generator to produce sequential test IDs like {VENDOR_NAME}_TEST_ID_0, {VENDOR_NAME}_TEST_ID_1, etc. This ensures deterministic output for comparison.
After generating the JSON, manually inspect it to verify all expected data from the original input file is present and correct. The test framework only guarantees the parser ran without errors — it cannot verify that all data was captured. Check:
Schema detection fails: Manually specify schema after reviewing list_schemas.py output
File format unclear: Look at similar parsers in the repository
Mapping errors: Check schema mapper Data structure requirements
Tests fail: Validate ASM output structure matches expected schema
Source: Benchling-Open-Source/allotropy — distributed by TomeVault.