AGENTS.md
Guidance for coding agents working on AlexandrAI Tools BMI Calculator in the alexandrai-tools project.
Project overview
This guide covers src/tools/bmi-calculator/index.ts. The tool calculates BMI from metric or imperial inputs, rounds to one decimal place, and maps BMI values to four category labels using fixed thresholds.
Primary source files
- src/tools/bmi-calculator/index.ts defines meta, bmiMetric, bmiImperial, BmiCategory, and bmiCategory.
- src/tools/bmi-calculator/index.test.ts covers metric math, imperial math, each category, and threshold boundaries.
- src/tools/bmi-calculator/Body.astro owns browser input and display.
- src/tools/bmi-calculator/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 metric BMI as kg divided by meters squared.
- Keep imperial BMI as 703 times pounds divided by inches squared.
- Round BMI to one decimal place in pure logic.
- Keep category boundaries at 18.5, 25, and 30 unless the copy and tests change together.
- Do not present BMI as a diagnosis or personalized medical advice.
- Keep calculation browser-local.
- If input validation is added, define behavior for zero and negative height explicitly.
Testing
Test metric values, imperial values, one-decimal rounding, all four categories, exact threshold boundaries, high values, low values, and invalid height behavior if validation changes.
PR checklist
- npm test passes for bmi-calculator.
- Pure calculation stays separate from display formatting.
- Copy presents outputs as estimates, not medical advice.
- Health or fitness input remains browser-local.