AGENTS.md
Guidance for coding agents working on AlexandrAI Tools BMR Calculator in the alexandrai-tools project.
Project overview
This guide covers src/tools/bmr-calculator/index.ts. The tool implements the Mifflin-St Jeor basal metabolic rate equation for male and female inputs, accepts metric inputs directly, and converts imperial pounds and inches into metric before using the same formula.
Primary source files
- src/tools/bmr-calculator/index.ts defines meta, Sex, bmrMetric, and bmrImperial.
- src/tools/bmr-calculator/index.test.ts covers male and female formulas, sex differences, age effects, weight effects, and imperial conversion parity.
- src/tools/bmr-calculator/Body.astro owns browser inputs and display.
- src/tools/bmr-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 and imperial calculations unified through bmrMetric.
- Round final BMR to the nearest whole kcal per day.
- Use the male and female offsets currently encoded in the formula.
- Do not mix BMR with TDEE activity multipliers in this tool.
- Do not present output as a medical or nutrition prescription.
- Keep formatting separate from calculation.
- When adding sex or formula options, update types, copy, and tests together.
Testing
Test male formula, female formula, same-input sex delta, age monotonicity, weight monotonicity, imperial conversion parity, rounding, and invalid input behavior if added.
PR checklist
- npm test passes for bmr-calculator.
- Pure calculation stays separate from display formatting.
- Copy presents outputs as estimates, not medical advice.
- Health or fitness input remains browser-local.