AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Clothing Size Converter in the alexandrai-tools project.
Project overview
This guide covers src/tools/clothing-size-converter/index.ts. The tool exposes fixed men and women size tables for XS through XXL, returns the selected table by gender, finds rows by case-insensitive label, and finds rows by exact US or EU numeric size.
Primary source files
- src/tools/clothing-size-converter/index.ts defines meta, Gender, SizeLabel, ClothingRow, MEN_TABLE, WOMEN_TABLE, getTable, findByLabel, findByUS, and findByEU.
- src/tools/clothing-size-converter/index.test.ts covers men and women label lookups, unknown labels, US lookup, EU lookup, and table field consistency.
- src/tools/clothing-size-converter/Body.astro owns browser controls.
- src/tools/clothing-size-converter/i18n.ts owns localized copy.
- src/lib/tools.ts registers metadata.
Setup commands
npm install npm test npm run typecheck npm run build npm run dev
Change rules
- Keep men and women tables explicit and easy to review.
- Keep labels limited to XS, S, M, L, XL, and XXL unless all tables expand together.
- Make label lookup case-insensitive through uppercase normalization.
- Return null for unknown labels or unmatched numeric sizes.
- Use exact numeric matching for US and EU lookup.
- Keep chest_in values as reference data, not measurement advice.
- If regional systems expand, update tests for every row and lookup path.
Testing
Test every label for both gender tables, unknown labels, lower-case label input, US lookup, EU lookup, table shape, chest_in numeric values, duplicate numeric values if added, and new region coverage.
PR checklist
- npm test passes for clothing-size-converter.
- Unit constants, lookup tables, and rounding rules are covered by tests.
- Same-unit and invalid-input behavior remain documented.
- UI labels, metadata, and pure conversion logic stay in sync.